forked from smicallef/spiderfoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfp_venmo.py
119 lines (90 loc) · 3.48 KB
/
sfp_venmo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# -------------------------------------------------------------------------------
# Name: sfp_venmo
# Purpose: Gather user information from Venmo API.
#
# Author: <[email protected]>
#
# Created: 2019-07-16
# Copyright: (c) bcoles 2019
# Licence: MIT
# -------------------------------------------------------------------------------
import json
import time
from spiderfoot import SpiderFootEvent, SpiderFootPlugin
class sfp_venmo(SpiderFootPlugin):
meta = {
'name': "Venmo",
'summary': "Gather user information from Venmo API.",
'flags': [],
'useCases': ["Footprint", "Investigate", "Passive"],
'categories': ["Social Media"],
'dataSource': {
'website': "https://venmo.com/",
'model': "FREE_NOAUTH_UNLIMITED",
'references': [],
'favIcon': "https://d1v6x81qdeozhc.cloudfront.net/static/images/logo/apple-touch-icon-1a10ee4b947b728d54265ac8c5084f78.png",
'logo': "https://d1v6x81qdeozhc.cloudfront.net/static/images/logo/apple-touch-icon-1a10ee4b947b728d54265ac8c5084f78.png",
'description': "Venmo is a digital wallet that allows you to send money and make purchases at approved merchants.",
}
}
# Default options
opts = {
}
# Option descriptions
optdescs = {
}
results = None
def setup(self, sfc, userOpts=dict()):
self.sf = sfc
self.results = self.tempStorage()
for opt in list(userOpts.keys()):
self.opts[opt] = userOpts[opt]
# What events is this module interested in for input
def watchedEvents(self):
return ['USERNAME']
# What events this module produces
def producedEvents(self):
return ['RAW_RIR_DATA', 'HUMAN_NAME']
# Query Venmo API
def query(self, qry):
res = self.sf.fetchUrl('https://api.venmo.com/v1/users/' + qry,
timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
time.sleep(1)
if res['content'] is None:
self.debug('No response from api.venmo.com')
return None
try:
data = json.loads(res['content'])
except Exception as e:
self.debug(f"Error processing JSON response: {e}")
return None
json_data = data.get('data')
if not json_data:
self.debug(qry + " is not a valid Venmo username")
return None
return json_data
# Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
srcModuleName = event.module
eventData = event.data
if eventData in self.results:
return
self.results[eventData] = True
self.debug(f"Received event, {eventName}, from {srcModuleName}")
data = self.query(eventData)
if not data:
return
display_name = data.get('display_name')
if " " not in display_name:
if not data.get('first_name') or not data.get('last_name'):
return
display_name = data['first_name'] + " " + data['last_name']
if display_name:
evt = SpiderFootEvent('HUMAN_NAME', display_name, self.__name__, event)
self.notifyListeners(evt)
evt = SpiderFootEvent('RAW_RIR_DATA', str(data),
self.__name__, event)
self.notifyListeners(evt)
# End of sfp_venmo class