Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Reverted back to 2.1.5 changes, oops..

smicallefb038cb61c3e5
diff --git a/evtypes.sql b/evtypes.sql
index ea914c42..96912b34 100644
--- a/evtypes.sql
+++ b/evtypes.sql
@@ -16,7 +16,6 @@ INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('DEFACED_AFF
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('DEFACED_COHOST', 'Defaced Co-Hosted Site', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('DEFACED_AFFILIATE_IPADDR', 'Defaced Affiliate IP Address', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('DEVICE_TYPE', 'Device Type', 0);
-INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('DOMAIN_NAME', 'Domain Name', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('GEOINFO', 'Physical Location', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('HTTP_CODE', 'HTTP Status Code', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('HUMAN_NAME', 'Human Name', 0);
@@ -29,7 +28,6 @@ INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('LINKED_URL_
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_ASN', 'Malicious AS', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_IPADDR', 'Malicious IP Address', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_COHOST', 'Malicious Co-Hosted Site', 0);
-INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_DOMAIN_NAME', 'Malicious Domain Name', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_SUBDOMAIN', 'Malicious Sub-domain/Host', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_AFFILIATE', 'Malicious Affiliate', 0);
INSERT INTO tbl_event_types (event, event_descr, event_raw) VALUES ('MALICIOUS_AFFILIATE_IPADDR', 'Malicious Affiliate IP Address', 0);
diff --git a/modules/sfp_affilinfo.py b/modules/sfp_affilinfo.py
index b498dec8..978943a0 100644
--- a/modules/sfp_affilinfo.py
+++ b/modules/sfp_affilinfo.py
@@ -31,12 +31,14 @@ class sfp_affilinfo(SpiderFootPlugin):
}
# Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
diff --git a/modules/sfp_bingsearch.py b/modules/sfp_bingsearch.py
index 77c83378..40f2ac0a 100644
--- a/modules/sfp_bingsearch.py
+++ b/modules/sfp_bingsearch.py
@@ -33,12 +33,15 @@ class sfp_bingsearch(SpiderFootPlugin):
'pages': "Number of Bing results pages to iterate through."
}
+ # Target
+ baseDomain = None
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -46,27 +49,18 @@ class sfp_bingsearch(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME" ]
+ return None
# What events this module produces
# This is to support the end user in selecting modules based on events
# produced.
def producedEvents(self):
- return [ "LINKED_URL_INTERNAL", "SEARCH_ENGINE_WEB_CONTENT" ]
-
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if eventData in self.results:
- sf.debug("Already did a search for " + eventData + ", skipping.")
- return None
- else:
- self.results.append(eventData)
+ return [ "LINKED_URL_INTERNAL", "SEARCH_ENGINE_WEB_CONTENT",
+ "CO_HOSTED_SITE" ]
+ def start(self):
# Sites hosted on the domain
- pages = sf.bingIterate("site:" + eventData, dict(limit=self.opts['pages'],
+ pages = sf.bingIterate("site:" + self.baseDomain, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'], timeout=self.opts['_fetchtimeout']))
if pages == None:
sf.info("No results returned from Bing.")
@@ -89,7 +83,7 @@ class sfp_bingsearch(SpiderFootPlugin):
# We can optionally fetch links to our domain found in the search
# results. These may not have been identified through spidering.
if self.opts['fetchlinks']:
- links = sf.parseLinks(page, pages[page], eventData)
+ links = sf.parseLinks(page, pages[page], self.baseDomain)
if len(links) == 0:
continue
@@ -98,7 +92,7 @@ class sfp_bingsearch(SpiderFootPlugin):
continue
else:
self.results.append(link)
- if sf.urlBaseUrl(link).endswith(eventData):
+ if sf.urlBaseUrl(link).endswith(self.baseDomain):
sf.debug("Found a link: " + link)
if self.checkForStop():
return None
diff --git a/modules/sfp_blacklist.py b/modules/sfp_blacklist.py
index c22e6da2..3061c1bd 100644
--- a/modules/sfp_blacklist.py
+++ b/modules/sfp_blacklist.py
@@ -32,6 +32,7 @@ class sfp_blacklist(SpiderFootPlugin):
}
# Target
+ baseDomain = None
results = dict()
# Whole bunch here:
@@ -79,6 +80,7 @@ class sfp_blacklist(SpiderFootPlugin):
sf = sfc
self.results = dict()
+ self.baseDomain = target
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
diff --git a/modules/sfp_defaced.py b/modules/sfp_defaced.py
index a3b20063..e3e1a5fc 100644
--- a/modules/sfp_defaced.py
+++ b/modules/sfp_defaced.py
@@ -38,12 +38,15 @@ class sfp_defaced(SpiderFootPlugin):
# Be sure to completely clear any class variables in setup()
# or you run the risk of data persisting between scan runs.
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
# Clear / reset any other class member variables here
@@ -55,7 +58,7 @@ class sfp_defaced(SpiderFootPlugin):
# What events is this module interested in for input
# * = be notified about all events.
def watchedEvents(self):
- return ["DOMAIN_NAME", "IP_ADDRESS", "SUBDOMAIN",
+ return ["IP_ADDRESS", "SUBDOMAIN",
"AFFILIATE_DOMAIN", "AFFILIATE_IPADDR",
"CO_HOSTED_SITE" ]
@@ -143,4 +146,16 @@ class sfp_defaced(SpiderFootPlugin):
evt = SpiderFootEvent(evtType, text, self.__name__, event)
self.notifyListeners(evt)
-# End of sfp_defaced class
+ return None
+
+ def start(self):
+ if self.checkForStop():
+ return None
+
+ url = self.lookupItem(self.baseDomain, 'domain')
+ if url != None:
+ text = self.baseDomain + "\n" + url
+ evt = SpiderFootEvent('DEFACED', text, self.__name__)
+ self.notifyListeners(evt)
+
+# End of sfp_malcheck class
diff --git a/modules/sfp_filemeta.py b/modules/sfp_filemeta.py
index 61cb9efd..bbcf04f4 100644
--- a/modules/sfp_filemeta.py
+++ b/modules/sfp_filemeta.py
@@ -40,12 +40,15 @@ class sfp_filemeta(SpiderFootPlugin):
'timeout': "Download timeout for files, in seconds."
}
+ # Target
+ baseDomain = None
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
diff --git a/modules/sfp_geoip.py b/modules/sfp_geoip.py
index 9d518152..c5073c31 100644
--- a/modules/sfp_geoip.py
+++ b/modules/sfp_geoip.py
@@ -23,12 +23,16 @@ class sfp_geoip(SpiderFootPlugin):
# Default options
opts = { }
+
+ # Target
+ baseDomain = None
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.py
index 601add44..9d66e73b 100644
--- a/modules/sfp_googlesearch.py
+++ b/modules/sfp_googlesearch.py
@@ -34,12 +34,14 @@ class sfp_googlesearch(SpiderFootPlugin):
}
# Target
+ baseDomain = None
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -47,7 +49,7 @@ class sfp_googlesearch(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME" ]
+ return None
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -55,19 +57,9 @@ class sfp_googlesearch(SpiderFootPlugin):
def producedEvents(self):
return [ "LINKED_URL_INTERNAL", "SEARCH_ENGINE_WEB_CONTENT" ]
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if eventData in self.results:
- sf.debug("Already did a search for " + eventData + ", skipping.")
- return None
- else:
- self.results.append(eventData)
-
+ def start(self):
# Sites hosted on the domain
- pages = sf.googleIterate("site:" + eventData,
+ pages = sf.googleIterate("site:" + self.baseDomain,
dict(limit=self.opts['pages'], useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
if pages == None:
@@ -91,7 +83,7 @@ class sfp_googlesearch(SpiderFootPlugin):
# We can optionally fetch links to our domain found in the search
# results. These may not have been identified through spidering.
if self.opts['fetchlinks']:
- links = sf.parseLinks(page, pages[page], eventData)
+ links = sf.parseLinks(page, pages[page], self.baseDomain)
if len(links) == 0:
continue
@@ -101,7 +93,7 @@ class sfp_googlesearch(SpiderFootPlugin):
else:
self.results.append(link)
sf.debug("Found a link: " + link)
- if sf.urlBaseUrl(link).endswith(eventData):
+ if sf.urlBaseUrl(link).endswith(self.baseDomain):
if self.checkForStop():
return None
diff --git a/modules/sfp_honeypot.py b/modules/sfp_honeypot.py
index acd920ed..6b8c87ac 100644
--- a/modules/sfp_honeypot.py
+++ b/modules/sfp_honeypot.py
@@ -38,6 +38,8 @@ class sfp_honeypot(SpiderFootPlugin):
'timelimit': "Maximum days old an entry can be. 255 is the maximum, 0 means you'll get nothing."
}
+ # Target
+ baseDomain = None
results = dict()
# Status codes according to:
@@ -61,6 +63,7 @@ class sfp_honeypot(SpiderFootPlugin):
sf = sfc
self.results = dict()
+ self.baseDomain = target
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
diff --git a/modules/sfp_intfiles.py b/modules/sfp_intfiles.py
index b4528d7f..0489f2b2 100644
--- a/modules/sfp_intfiles.py
+++ b/modules/sfp_intfiles.py
@@ -39,12 +39,15 @@ class sfp_intfiles(SpiderFootPlugin):
'searchengine': "If using a search engine, which one? google, yahoo or bing."
}
+ # Target
+ baseDomain = None
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -52,7 +55,7 @@ class sfp_intfiles(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME", "LINKED_URL_INTERNAL" ]
+ return [ "LINKED_URL_INTERNAL" ]
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -60,9 +63,6 @@ class sfp_intfiles(SpiderFootPlugin):
def producedEvents(self):
return [ "SEARCH_ENGINE_WEB_CONTENT", "INTERESTING_FILE" ]
- def yahooCleaner(self, string):
- return " url=\"" + urllib.unquote(string.group(1)) + "\" "
-
# Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
@@ -71,43 +71,38 @@ class sfp_intfiles(SpiderFootPlugin):
sf.debug("Received event, " + eventName + ", from " + srcModuleName)
- if eventName == "DOMAIN_NAME" and not self.opts['usesearch']:
- sf.debug("Not using a search engine to find interesting files.")
- return None
+ for fileExt in self.opts['fileexts']:
+ if "." + fileExt.lower() in eventData.lower():
+ if eventData in self.results:
+ continue
+ else:
+ self.results.append(eventData)
+ evt = SpiderFootEvent("INTERESTING_FILE", eventData, self.__name__)
+ self.notifyListeners(evt)
- if eventData in self.results:
- return None
- else:
- self.results.append(eventData)
+ def yahooCleaner(self, string):
+ return " url=\"" + urllib.unquote(string.group(1)) + "\" "
- if eventName == "LINKED_URL_INTERNAL":
- for fileExt in self.opts['fileexts']:
- if "." + fileExt.lower() in eventData.lower():
- if eventData in self.results:
- continue
- else:
- self.results.append(eventData)
- evt = SpiderFootEvent("INTERESTING_FILE", eventData, self.__name__)
- self.notifyListeners(evt)
+ def start(self):
+ if not self.opts['usesearch']:
return None
- # Handling DOMAIN_NAME event..
for fileExt in self.opts['fileexts']:
# Sites hosted on the domain
if self.opts['searchengine'].lower() == "google":
- pages = sf.googleIterate("site:" + eventData + "+" + \
+ pages = sf.googleIterate("site:" + self.baseDomain + "+" + \
"%2Bext:" + fileExt, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
if self.opts['searchengine'].lower() == "bing":
- pages = sf.bingIterate("site:" + eventData + "+" + \
+ pages = sf.bingIterate("site:" + self.baseDomain + "+" + \
"%2Bext:" + fileExt, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
if self.opts['searchengine'].lower() == "yahoo":
- pages = sf.yahooIterate("site:" + eventData + "+" + \
+ pages = sf.yahooIterate("site:" + self.baseDomain + "+" + \
"%2Bext:" + fileExt, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
@@ -137,7 +132,7 @@ class sfp_intfiles(SpiderFootPlugin):
else:
res = pages[page]
- links = sf.parseLinks(page, res, eventData)
+ links = sf.parseLinks(page, res, self.baseDomain)
if len(links) == 0:
continue
@@ -147,7 +142,7 @@ class sfp_intfiles(SpiderFootPlugin):
else:
self.results.append(link)
- if sf.urlBaseUrl(link).endswith(eventData) and \
+ if sf.urlBaseUrl(link).endswith(self.baseDomain) and \
"." + fileExt.lower() in link.lower():
sf.info("Found an interesting file: " + link)
evt = SpiderFootEvent("INTERESTING_FILE", link, self.__name__)
diff --git a/modules/sfp_malcheck.py b/modules/sfp_malcheck.py
index e3068794..64967118 100644
--- a/modules/sfp_malcheck.py
+++ b/modules/sfp_malcheck.py
@@ -266,12 +266,15 @@ class sfp_malcheck(SpiderFootPlugin):
# Be sure to completely clear any class variables in setup()
# or you run the risk of data persisting between scan runs.
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
# Clear / reset any other class member variables here
@@ -283,8 +286,8 @@ class sfp_malcheck(SpiderFootPlugin):
# What events is this module interested in for input
# * = be notified about all events.
def watchedEvents(self):
- return ["DOMAIN_NAME", "IP_ADDRESS", "BGP_AS", "SUBDOMAIN",
- "IP_SUBNET", "AFFILIATE_DOMAIN", "AFFILIATE_IPADDR",
+ return ["IP_ADDRESS", "BGP_AS", "SUBDOMAIN", "IP_SUBNET",
+ "AFFILIATE_DOMAIN", "AFFILIATE_IPADDR",
"CO_HOSTED_SITE", "NETBLOCK" ]
# What events this module produces
@@ -293,7 +296,7 @@ class sfp_malcheck(SpiderFootPlugin):
def producedEvents(self):
return [ "MALICIOUS_ASN", "MALICIOUS_IPADDR", "MALICIOUS_SUBDOMAIN",
"MALICIOUS_AFFILIATE_IPADDR", "MALICIOUS_AFFILIATE", "MALICIOUS_SUBNET",
- "MALICIOUS_COHOST", "MALICIOUS_DOMAIN_NAME" ]
+ "MALICIOUS_COHOST" ]
# Check the regexps to see whether the content indicates maliciousness
def contentMalicious(self, content, goodregex, badregex):
@@ -457,13 +460,10 @@ class sfp_malcheck(SpiderFootPlugin):
typeId = 'asn'
evtType = 'MALICIOUS_ASN'
- if eventName in [ 'DOMAIN_NAME', 'CO_HOSTED_SITE',
- 'AFFILIATE_DOMAIN', 'SUBDOMAIN' ]:
+ if eventName in [ 'CO_HOSTED_SITE', 'AFFILIATE_DOMAIN', 'SUBDOMAIN' ]:
typeId = 'domain'
- if eventName == 'SUBDOMAIN':
+ if eventName == 'SUBDOMAIN':
evtType = 'MALICIOUS_SUBDOMAIN'
- if eventName == "DOMAIN_NAME":
- evtType = "MALICIOUS_DOMAIN_NAME"
if eventName == 'AFFILIATE_DOMAIN':
evtType = 'MALICIOUS_AFFILIATE'
if eventName == 'CO_HOSTED_SITE':
@@ -488,4 +488,22 @@ class sfp_malcheck(SpiderFootPlugin):
return None
+ def start(self):
+ if self.baseDomain in self.results:
+ return None
+ else:
+ self.results.append(self.baseDomain)
+
+ for check in malchecks.keys():
+ if self.checkForStop():
+ return None
+
+ cid = malchecks[check]['id']
+ if self.opts[cid]:
+ url = self.lookupItem(cid, 'domain', self.baseDomain)
+ if url != None:
+ text = check + " [" + self.baseDomain + "]\n<SFURL>" + url + "</SFURL>"
+ evt = SpiderFootEvent('MALICIOUS_SUBDOMAIN', text, self.__name__)
+ self.notifyListeners(evt)
+
# End of sfp_malcheck class
diff --git a/modules/sfp_names.py b/modules/sfp_names.py
index 636ff990..806bdf64 100644
--- a/modules/sfp_names.py
+++ b/modules/sfp_names.py
@@ -29,6 +29,11 @@ class sfp_names(SpiderFootPlugin):
'algotune': "A value between 0-100 to tune the sensitivity of the name finder. Less than 40 will give you a lot of junk, over 50 and you'll probably miss things but will have less false positives."
}
+ # Be sure to completely clear any class variables in setup()
+ # or you run the risk of data persisting between scan runs.
+
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
d = None
n = None
@@ -51,6 +56,7 @@ class sfp_names(SpiderFootPlugin):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
d = self.builddict(["english.0", "english.2", "english.4",
diff --git a/modules/sfp_pastebin.py b/modules/sfp_pastebin.py
index d3c600df..62454633 100644
--- a/modules/sfp_pastebin.py
+++ b/modules/sfp_pastebin.py
@@ -32,12 +32,15 @@ class sfp_pastebin(SpiderFootPlugin):
'pages': "Number of search results pages to iterate through."
}
+ # Target
+ baseDomain = None
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -45,7 +48,7 @@ class sfp_pastebin(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME", "IP_ADDRESS", "EMAILADDR" ]
+ return None
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -53,19 +56,10 @@ class sfp_pastebin(SpiderFootPlugin):
def producedEvents(self):
return [ "SEARCH_ENGINE_WEB_CONTENT", "PASTEBIN_CONTENT" ]
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if eventData in self.results:
- return None
- else:
- self.results.append(eventData)
-
+ def start(self):
# Sites hosted on the domain
- pages = sf.googleIterate("site:pastebin.com +\"" + eventData + "\"",
- dict(limit=self.opts['pages'],
+ pages = sf.googleIterate("site:pastebin.com+\"" + \
+ self.baseDomain + "\"", dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'], timeout=self.opts['_fetchtimeout']))
if pages == None:
@@ -114,13 +108,13 @@ class sfp_pastebin(SpiderFootPlugin):
self.notifyListeners(evt)
# Sometimes pastebin search results false positives
- if re.search("[^a-zA-Z\-\_0-9]" + re.escape(eventData) + \
- "[^a-zA-Z\-\_0-9]", res['content'], re.IGNORECASE) == None:
+ if re.search("[^a-zA-Z\-\_]" + re.escape(self.baseDomain) + \
+ "[^a-zA-Z\-\_]", res['content'], re.IGNORECASE) == None:
continue
try:
- startIndex = res['content'].index(eventData)-120
- endIndex = startIndex+len(eventData)+240
+ startIndex = res['content'].index(self.baseDomain)-120
+ endIndex = startIndex+len(self.baseDomain)+240
except BaseException as e:
sf.debug("String not found in pastebin content.")
continue
diff --git a/modules/sfp_portscan_basic.py b/modules/sfp_portscan_basic.py
index 19caa6ca..7c120482 100644
--- a/modules/sfp_portscan_basic.py
+++ b/modules/sfp_portscan_basic.py
@@ -50,6 +50,8 @@ class sfp_portscan_basic(SpiderFootPlugin):
'netblockscanmax': "Maximum netblock/subnet size to scan IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
}
+ # Target
+ baseDomain = None
results = dict()
portlist = list()
portResults = dict()
@@ -58,6 +60,7 @@ class sfp_portscan_basic(SpiderFootPlugin):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
diff --git a/modules/sfp_shodan.py b/modules/sfp_shodan.py
index 3469fa18..2628d6d9 100644
--- a/modules/sfp_shodan.py
+++ b/modules/sfp_shodan.py
@@ -29,12 +29,18 @@ class sfp_shodan(SpiderFootPlugin):
"apikey": "Your SHODAN API Key."
}
+ # Be sure to completely clear any class variables in setup()
+ # or you run the risk of data persisting between scan runs.
+
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
# Clear / reset any other class member variables here
diff --git a/modules/sfp_similar.py b/modules/sfp_similar.py
index 450b3e02..ac610fb9 100644
--- a/modules/sfp_similar.py
+++ b/modules/sfp_similar.py
@@ -62,10 +62,14 @@ class sfp_similar(SpiderFootPlugin):
# Internal results tracking
results = list()
+ # Target
+ baseDomain = None
+
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -79,7 +83,7 @@ class sfp_similar(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME" ]
+ return None
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -193,6 +197,9 @@ class sfp_similar(SpiderFootPlugin):
# Store the result internally and notify listening modules
def storeResult(self, source, result):
+ if result == self.baseDomain:
+ return
+
sf.info("Found a similar domain: " + result)
self.results.append(result)
@@ -212,18 +219,9 @@ class sfp_similar(SpiderFootPlugin):
# Search for similar sounding domains
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if eventData in self.results:
- return None
- else:
- self.results.append(eventData)
-
- keyword = sf.domainKeyword(eventData, self.opts['_internettlds'])
- sf.debug("Keyword extracted from " + eventData + ": " + keyword)
+ def start(self):
+ keyword = sf.domainKeyword(self.baseDomain, self.opts['_internettlds'])
+ sf.debug("Keyword extracted from " + self.baseDomain + ": " + keyword)
# No longer seems to work.
#if "whois" in self.opts['source'] or "ALL" in self.opts['source']:
diff --git a/modules/sfp_social.py b/modules/sfp_social.py
index 48e5f35a..02bf716c 100644
--- a/modules/sfp_social.py
+++ b/modules/sfp_social.py
@@ -42,12 +42,15 @@ class sfp_social(SpiderFootPlugin):
# to the end-user.
}
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
diff --git a/modules/sfp_sslcert.py b/modules/sfp_sslcert.py
index b4fe0cd4..42af6bce 100644
--- a/modules/sfp_sslcert.py
+++ b/modules/sfp_sslcert.py
@@ -40,12 +40,15 @@ class sfp_sslcert(SpiderFootPlugin):
# Be sure to completely clear any class variables in setup()
# or you run the risk of data persisting between scan runs.
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
# Clear / reset any other class member variables here
diff --git a/modules/sfp_template.py b/modules/sfp_template.py
index 024ce771..cfee93d1 100644
--- a/modules/sfp_template.py
+++ b/modules/sfp_template.py
@@ -32,12 +32,14 @@ class sfp_XXX(SpiderFootPlugin):
# or you run the risk of data persisting between scan runs.
# Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
# Clear / reset any other class member variables here
diff --git a/modules/sfp_tldsearch.py b/modules/sfp_tldsearch.py
index 671a2ec7..0680bd31 100644
--- a/modules/sfp_tldsearch.py
+++ b/modules/sfp_tldsearch.py
@@ -41,6 +41,9 @@ class sfp_tldsearch(SpiderFootPlugin):
# Internal results tracking
results = list()
+ # Target
+ baseDomain = None
+
# Track TLD search results between threads
tldResults = dict()
@@ -48,6 +51,7 @@ class sfp_tldsearch(SpiderFootPlugin):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -55,7 +59,7 @@ class sfp_tldsearch(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME" ]
+ return None
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -100,6 +104,9 @@ class sfp_tldsearch(SpiderFootPlugin):
# Store the result internally and notify listening modules
def sendEvent(self, source, result):
+ if result == self.baseDomain:
+ return
+
sf.info("Found a TLD with the target's name: " + result)
self.results.append(result)
@@ -118,18 +125,9 @@ class sfp_tldsearch(SpiderFootPlugin):
self.notifyListeners(evt)
# Search for similar sounding domains
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if eventData in self.results:
- return None
- else:
- self.results.append(eventData)
-
- keyword = sf.domainKeyword(eventData, self.opts['_internettlds'])
- sf.debug("Keyword extracted from " + eventData + ": " + keyword)
+ def start(self):
+ keyword = sf.domainKeyword(self.baseDomain, self.opts['_internettlds'])
+ sf.debug("Keyword extracted from " + self.baseDomain + ": " + keyword)
targetList = list()
# Look through all TLDs for the existence of this target keyword
diff --git a/modules/sfp_virustotal.py b/modules/sfp_virustotal.py
index 27927bf9..e26d0a57 100644
--- a/modules/sfp_virustotal.py
+++ b/modules/sfp_virustotal.py
@@ -39,12 +39,15 @@ class sfp_virustotal(SpiderFootPlugin):
# Be sure to completely clear any class variables in setup()
# or you run the risk of data persisting between scan runs.
+ # Target
+ baseDomain = None # calculated from the URL in setup
results = dict()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = dict()
# Clear / reset any other class member variables here
@@ -55,14 +58,14 @@ class sfp_virustotal(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["IP_ADDRESS", "AFFILIATE_IPADDR", "DOMAIN_NAME",
+ return ["IP_ADDRESS", "AFFILIATE_IPADDR",
"AFFILIATE_DOMAIN", "CO_HOSTED_SITE"]
# What events this module produces
def producedEvents(self):
return ["MALICIOUS_IPADDR", "MALICIOUS_SUBDOMAIN",
"MALICIOUS_COHOST", "MALICIOUS_AFFILIATE",
- "MALICIOUS_AFFILIATE_IPADDR", "MALICIOUS_DOMAIN_NAME"]
+ "MALICIOUS_AFFILIATE_IPADDR"]
# Handle events sent to this module
def handleEvent(self, event):
@@ -121,10 +124,6 @@ class sfp_virustotal(SpiderFootPlugin):
evt = "MALICIOUS_AFFILIATE_IPADDR"
infotype = "ip-address"
- if eventName == "DOMAIN_NAME":
- evt = "MALICIOUS_DOMAIN_NAME"
- infotype = "domain"
-
if eventName == "AFFILIATE_DOMAIN":
evt = "MALICIOUS_AFFILIATE"
infotype = "domain"
@@ -141,4 +140,37 @@ class sfp_virustotal(SpiderFootPlugin):
infourl, self.__name__, event)
self.notifyListeners(e)
+ def start(self):
+ if self.baseDomain in self.results.keys():
+ return None
+ else:
+ self.results[self.baseDomain] = True
+
+ url = "https://www.virustotal.com/vtapi/v2/domain/report?domain="
+ res = sf.fetchUrl(url + self.baseDomain + "&apikey=" + self.opts['apikey'],
+ timeout=self.opts['_fetchtimeout'], useragent="SpiderFoot")
+
+ if res['code'] == 403:
+ sf.error("VirusTotal API limit reached or invalid API key.", False)
+ return None
+
+ if res['content'] == None:
+ sf.info("No VirusTotal info found for " + self.baseDomain)
+ return None
+
+ try:
+ info = json.loads(res['content'])
+ except Exception as e:
+ sf.error("Error processing JSON response from VirusTotal.", False)
+ return None
+
+ if info.has_key('detected_urls'):
+ infourl = "<SFURL>https://www.virustotal.com/en/domain/" + self.baseDomain + \
+ "/information/</SFURL>"
+
+ # Notify other modules of what you've found
+ e = SpiderFootEvent("MALICIOUS_SUBDOMAIN", "VirusTotal [" + \
+ self.baseDomain + "]\n" + infourl, self.__name__)
+ self.notifyListeners(e)
+
# End of sfp_virustotal class
diff --git a/modules/sfp_yahoosearch.py b/modules/sfp_yahoosearch.py
index 50703e4b..f299555b 100644
--- a/modules/sfp_yahoosearch.py
+++ b/modules/sfp_yahoosearch.py
@@ -34,12 +34,15 @@ class sfp_yahoosearch(SpiderFootPlugin):
'pages': "Number of Yahoo results pages to iterate through."
}
+ # Target
+ baseDomain = None
results = list()
def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
@@ -47,30 +50,21 @@ class sfp_yahoosearch(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return [ "DOMAIN_NAME" ]
+ return None
# What events this module produces
# This is to support the end user in selecting modules based on events
# produced.
def producedEvents(self):
- return [ "LINKED_URL_INTERNAL", "SEARCH_ENGINE_WEB_CONTENT" ]
+ return [ "LINKED_URL_INTERNAL", "SEARCH_ENGINE_WEB_CONTENT",
+ "CO_HOSTED_SITE" ]
def yahooCleaner(self, string):
return " url=\"" + urllib.unquote(string.group(1)) + "\" "
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if eventData in self.results:
- sf.debug("Already did a search for " + eventData + ", skipping.")
- return None
- else:
- self.results.append(eventData)
-
+ def start(self):
# Sites hosted on the domain
- pages = sf.yahooIterate("site:" + eventData, dict(limit=self.opts['pages'],
+ pages = sf.yahooIterate("site:" + self.baseDomain, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'], timeout=self.opts['_fetchtimeout']))
if pages == None:
sf.info("No results returned from Yahoo.")
@@ -95,7 +89,7 @@ class sfp_yahoosearch(SpiderFootPlugin):
# We can optionally fetch links to our domain found in the search
# results. These may not have been identified through spidering.
if self.opts['fetchlinks']:
- links = sf.parseLinks(page, content, eventData)
+ links = sf.parseLinks(page, content, self.baseDomain)
if len(links) == 0:
continue
@@ -104,7 +98,7 @@ class sfp_yahoosearch(SpiderFootPlugin):
continue
else:
self.results.append(link)
- if sf.urlBaseUrl(link).endswith(eventData):
+ if sf.urlBaseUrl(link).endswith(self.baseDomain):
sf.debug("Found a link: " + link)
if self.checkForStop():
return None
diff --git a/sflib.py b/sflib.py
index 35c19530..0a8becd0 100644
--- a/sflib.py
+++ b/sflib.py
@@ -753,7 +753,6 @@ class SpiderFoot:
# We attempt to make the URL look as authentically human as possible
seedUrl = "http://www.google.com/search?q={0}".format(searchString) + \
"&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a"
-
firstPage = self.fetchUrl(seedUrl, timeout=opts['timeout'],
useragent=opts['useragent'])
if firstPage['code'] == 403 or firstPage['code'] == 503: