Skip to content

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

Removed dead code, fixed bug degrading performance when user opts to not scan netblocks.

Steve117fd219a5a2
diff --git a/modules/sfp_alienvault.py b/modules/sfp_alienvault.py
index 6c0178aa..7a4454b4 100644
--- a/modules/sfp_alienvault.py
+++ b/modules/sfp_alienvault.py
@@ -25,14 +25,22 @@ class sfp_alienvault(SpiderFootPlugin):
opts = {
"api_key": "",
"age_limit_days": 30,
- "threat_score_min": 2
+ "threat_score_min": 2,
+ 'netblocklookup': True,
+ 'maxnetblock': 24,
+ 'subnetlookup': True,
+ 'maxsubnet': 24
}
# Option descriptions
optdescs = {
"api_key": "Your AlienVault OTX API Key",
"age_limit_days": "Ignore any records older than this many days. 0 = unlimited.",
- "threat_score_min": "Minimum AlienVault threat score."
+ "threat_score_min": "Minimum AlienVault threat score.",
+ 'netblocklookup': "Look up all IPs on netblocks deemed to be owned by your target for possible blacklisted hosts on the same target subdomain/domain?",
+ 'maxnetblock': "If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)",
+ 'subnetlookup': "Look up all IPs on subnets which your target is a part of for blacklisting?",
+ 'maxsubnet': "If looking up subnets, the maximum subnet size to look up all the IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
}
# Be sure to completely clear any class variables in setup()
@@ -127,6 +135,26 @@ class sfp_alienvault(SpiderFootPlugin):
else:
self.results[eventData] = True
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
+
qrylist = list()
if eventName.startswith("NETBLOCK_"):
for ipaddr in IPNetwork(eventData):
diff --git a/modules/sfp_badipscom.py b/modules/sfp_badipscom.py
index cca83173..12bd6a17 100644
--- a/modules/sfp_badipscom.py
+++ b/modules/sfp_badipscom.py
@@ -217,10 +217,6 @@ class sfp_badipscom(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -247,13 +243,6 @@ class sfp_badipscom(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_crt.py b/modules/sfp_crt.py
index f58e4b8e..4d4118a8 100644
--- a/modules/sfp_crt.py
+++ b/modules/sfp_crt.py
@@ -81,6 +81,8 @@ class sfp_crt(SpiderFootPlugin):
matches = re.findall("\"min_cert_id\":(\d+),", res['content'], re.IGNORECASE)
for m in matches:
+ if self.checkForStop():
+ return None
dat = self.sf.fetchUrl("https://crt.sh/?d=" + m, timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
diff --git a/modules/sfp_cybercrimetracker.py b/modules/sfp_cybercrimetracker.py
index 2543bd55..99b78d71 100644
--- a/modules/sfp_cybercrimetracker.py
+++ b/modules/sfp_cybercrimetracker.py
@@ -217,10 +217,6 @@ class sfp_cybercrimetracker(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -247,13 +243,6 @@ class sfp_cybercrimetracker(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_cymon.py b/modules/sfp_cymon.py
index 3b81ca2c..ac00a60f 100644
--- a/modules/sfp_cymon.py
+++ b/modules/sfp_cymon.py
@@ -24,13 +24,21 @@ class sfp_cymon(SpiderFootPlugin):
# Default options
opts = {
"cymon_api_key": "",
- "age_limit_days": 30
+ "age_limit_days": 30,
+ 'netblocklookup': True,
+ 'maxnetblock': 24,
+ 'subnetlookup': True,
+ 'maxsubnet': 24
}
# Option descriptions
optdescs = {
"cymon_api_key": "Your Cymon.io API Key",
- "age_limit_days": "Ignore any records older than this many days. 0 = unlimited."
+ "age_limit_days": "Ignore any records older than this many days. 0 = unlimited.",
+ 'netblocklookup': "Look up all IPs on netblocks deemed to be owned by your target for possible blacklisted hosts on the same target subdomain/domain?",
+ 'maxnetblock': "If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)",
+ 'subnetlookup': "Look up all IPs on subnets which your target is a part of for blacklisting?",
+ 'maxsubnet': "If looking up subnets, the maximum subnet size to look up all the IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
}
# Be sure to completely clear any class variables in setup()
@@ -124,6 +132,26 @@ class sfp_cymon(SpiderFootPlugin):
else:
self.results[eventData] = True
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
+
qrylist = list()
if eventName.startswith("NETBLOCK_"):
for ipaddr in IPNetwork(eventData):
diff --git a/modules/sfp_dnsresolve.py b/modules/sfp_dnsresolve.py
index 5820264a..1fe5fc0b 100644
--- a/modules/sfp_dnsresolve.py
+++ b/modules/sfp_dnsresolve.py
@@ -151,12 +151,15 @@ class sfp_dnsresolve(SpiderFootPlugin):
# Nothing left to do with internal links and raw data
return None
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
- return None
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
# Not handling IPv6 (yet)
if "::" in eventData:
diff --git a/modules/sfp_dronebl.py b/modules/sfp_dronebl.py
index 4be650ef..c402e1bf 100644
--- a/modules/sfp_dronebl.py
+++ b/modules/sfp_dronebl.py
@@ -143,19 +143,25 @@ class sfp_dronebl(SpiderFootPlugin):
return None
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
if eventName.startswith("NETBLOCK_"):
for addr in IPNetwork(eventData):
diff --git a/modules/sfp_fortinet.py b/modules/sfp_fortinet.py
index d25be366..5edadeb9 100644
--- a/modules/sfp_fortinet.py
+++ b/modules/sfp_fortinet.py
@@ -212,10 +212,6 @@ class sfp_fortinet(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -242,13 +238,6 @@ class sfp_fortinet(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_fraudguard.py b/modules/sfp_fraudguard.py
index 315cc22d..e8d3b2fb 100644
--- a/modules/sfp_fraudguard.py
+++ b/modules/sfp_fraudguard.py
@@ -25,14 +25,18 @@ class sfp_fraudguard(SpiderFootPlugin):
opts = {
"fraudguard_api_key_account": "",
"fraudguard_api_key_password": "",
- "age_limit_days": 90
+ "age_limit_days": 90,
+ 'netblocklookup': True,
+ 'maxnetblock': 24
}
# Option descriptions
optdescs = {
"fraudguard_api_key_account": "Your Fraudguard.io API username",
"fraudguard_api_key_password": "Your Fraudguard.io API password",
- "age_limit_days": "Ignore any records older than this many days. 0 = unlimited."
+ "age_limit_days": "Ignore any records older than this many days. 0 = unlimited.",
+ 'netblocklookup': "Look up all IPs on netblocks deemed to be owned by your target for possible blacklisted hosts on the same target subdomain/domain?",
+ 'maxnetblock': "If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
}
# Be sure to completely clear any class variables in setup()
@@ -65,7 +69,6 @@ class sfp_fraudguard(SpiderFootPlugin):
'Authorization': "Basic " + base64.b64encode(self.opts['fraudguard_api_key_account'] + ":" + self.opts['fraudguard_api_key_password'])
}
- print str(headers)
res = self.sf.fetchUrl(fraudguard_url , timeout=self.opts['_fetchtimeout'],
useragent="SpiderFoot", headers=headers)
@@ -78,8 +81,6 @@ class sfp_fraudguard(SpiderFootPlugin):
self.sf.info("No Fraudguard.io info found for " + qry)
return None
- self.sf.debug(str(res['content']))
-
try:
info = json.loads(res['content'])
except Exception as e:
@@ -113,6 +114,16 @@ class sfp_fraudguard(SpiderFootPlugin):
else:
self.results[eventData] = True
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
qrylist = list()
rtype = ""
if eventName.startswith("NETBLOCK_"):
diff --git a/modules/sfp_hackertarget.py b/modules/sfp_hackertarget.py
index 5724118c..de39de40 100644
--- a/modules/sfp_hackertarget.py
+++ b/modules/sfp_hackertarget.py
@@ -23,13 +23,17 @@ class sfp_hackertarget(SpiderFootPlugin):
# Default options
opts = {
'cohostsamedomain': False,
- 'verify': True
+ 'verify': True,
+ 'netblocklookup': True,
+ 'maxnetblock': 24
}
# Option descriptions
optdescs = {
'cohostsamedomain': "Treat co-hosted sites on the same target domain as co-hosting?",
- 'verify': "Verify co-hosts are valid by checking if they still resolve to the shared IP."
+ 'verify': "Verify co-hosts are valid by checking if they still resolve to the shared IP.",
+ 'netblocklookup': "Look up all IPs on netblocks deemed to be owned by your target for possible blacklisted hosts on the same target subdomain/domain?",
+ 'maxnetblock': "If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
}
results = list()
@@ -82,6 +86,16 @@ class sfp_hackertarget(SpiderFootPlugin):
self.sf.debug("Skipping " + eventData + " as already mapped.")
return None
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
qrylist = list()
if eventName.startswith("NETBLOCK_"):
for ipaddr in IPNetwork(eventData):
diff --git a/modules/sfp_honeypot.py b/modules/sfp_honeypot.py
index 790a2e45..aae68918 100644
--- a/modules/sfp_honeypot.py
+++ b/modules/sfp_honeypot.py
@@ -161,19 +161,25 @@ class sfp_honeypot(SpiderFootPlugin):
return None
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
if eventName.startswith("NETBLOCK_"):
for addr in IPNetwork(eventData):
diff --git a/modules/sfp_hostsfilenet.py b/modules/sfp_hostsfilenet.py
index 189f1306..0db8891b 100644
--- a/modules/sfp_hostsfilenet.py
+++ b/modules/sfp_hostsfilenet.py
@@ -214,10 +214,6 @@ class sfp_hostsfilenet(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -244,13 +240,6 @@ class sfp_hostsfilenet(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_isc.py b/modules/sfp_isc.py
index e001e2ba..b4b219ce 100644
--- a/modules/sfp_isc.py
+++ b/modules/sfp_isc.py
@@ -210,10 +210,6 @@ class sfp_isc(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -240,13 +236,6 @@ class sfp_isc(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_malwaredomains.py b/modules/sfp_malwaredomains.py
index 049b7ff0..0025700f 100644
--- a/modules/sfp_malwaredomains.py
+++ b/modules/sfp_malwaredomains.py
@@ -213,10 +213,6 @@ class sfp_malwaredomains(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -243,13 +239,6 @@ class sfp_malwaredomains(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_mcafee.py b/modules/sfp_mcafee.py
index 6da8c183..574e7b10 100644
--- a/modules/sfp_mcafee.py
+++ b/modules/sfp_mcafee.py
@@ -212,10 +212,6 @@ class sfp_mcafee(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -242,13 +238,6 @@ class sfp_mcafee(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_multiproxy.py b/modules/sfp_multiproxy.py
index fdff8912..c21d8732 100644
--- a/modules/sfp_multiproxy.py
+++ b/modules/sfp_multiproxy.py
@@ -212,10 +212,6 @@ class sfp_multiproxy(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -242,13 +238,6 @@ class sfp_multiproxy(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_phishtank.py b/modules/sfp_phishtank.py
index 71b849f2..44408311 100644
--- a/modules/sfp_phishtank.py
+++ b/modules/sfp_phishtank.py
@@ -214,10 +214,6 @@ class sfp_phishtank(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -244,13 +240,6 @@ class sfp_phishtank(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_shodan.py b/modules/sfp_shodan.py
index 090657a2..6a0105af 100644
--- a/modules/sfp_shodan.py
+++ b/modules/sfp_shodan.py
@@ -94,12 +94,15 @@ class sfp_shodan(SpiderFootPlugin):
else:
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
qrylist = list()
if eventName.startswith("NETBLOCK_"):
diff --git a/modules/sfp_sorbs.py b/modules/sfp_sorbs.py
index 8263e594..47679b65 100644
--- a/modules/sfp_sorbs.py
+++ b/modules/sfp_sorbs.py
@@ -136,19 +136,25 @@ class sfp_sorbs(SpiderFootPlugin):
return None
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
if eventName.startswith("NETBLOCK_"):
for addr in IPNetwork(eventData):
diff --git a/modules/sfp_spamcop.py b/modules/sfp_spamcop.py
index d20ba7f9..643ceb36 100644
--- a/modules/sfp_spamcop.py
+++ b/modules/sfp_spamcop.py
@@ -130,19 +130,25 @@ class sfp_spamcop(SpiderFootPlugin):
return None
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
if eventName.startswith("NETBLOCK_"):
for addr in IPNetwork(eventData):
diff --git a/modules/sfp_spamhaus.py b/modules/sfp_spamhaus.py
index e23cf91a..0774ea7a 100644
--- a/modules/sfp_spamhaus.py
+++ b/modules/sfp_spamhaus.py
@@ -139,19 +139,25 @@ class sfp_spamhaus(SpiderFootPlugin):
return None
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
if eventName.startswith("NETBLOCK_"):
for addr in IPNetwork(eventData):
diff --git a/modules/sfp_threatcrowd.py b/modules/sfp_threatcrowd.py
index 1ef6b63a..96dfc968 100644
--- a/modules/sfp_threatcrowd.py
+++ b/modules/sfp_threatcrowd.py
@@ -121,19 +121,25 @@ class sfp_threatcrowd(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE' and not self.opts['checkcohosts']:
return None
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
-
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
qrylist = list()
if eventName.startswith("NETBLOCK_"):
diff --git a/modules/sfp_totalhash.py b/modules/sfp_totalhash.py
index ed61d999..fabda1be 100644
--- a/modules/sfp_totalhash.py
+++ b/modules/sfp_totalhash.py
@@ -216,10 +216,6 @@ class sfp_totalhash(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -246,13 +242,6 @@ class sfp_totalhash(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_uceprotect.py b/modules/sfp_uceprotect.py
index e61ef38f..8e514387 100644
--- a/modules/sfp_uceprotect.py
+++ b/modules/sfp_uceprotect.py
@@ -131,19 +131,25 @@ class sfp_uceprotect(SpiderFootPlugin):
return None
self.results[eventData] = True
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
if eventName.startswith("NETBLOCK_"):
for addr in IPNetwork(eventData):
diff --git a/modules/sfp_virustotal.py b/modules/sfp_virustotal.py
index ac39a21f..9d043127 100644
--- a/modules/sfp_virustotal.py
+++ b/modules/sfp_virustotal.py
@@ -129,19 +129,25 @@ class sfp_virustotal(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE' and not self.opts['checkcohosts']:
return None
- if eventName == 'NETBLOCK_OWNER' and self.opts['netblocklookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxnetblock']))
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
return None
-
- if eventName == 'NETBLOCK_MEMBER' and self.opts['subnetlookup']:
- if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
- self.sf.debug("Network size bigger than permitted: " +
- str(IPNetwork(eventData).prefixlen) + " > " +
- str(self.opts['maxsubnet']))
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
qrylist = list()
if eventName.startswith("NETBLOCK_"):
diff --git a/modules/sfp_vxvault.py b/modules/sfp_vxvault.py
index 4adc80e5..a01defc3 100644
--- a/modules/sfp_vxvault.py
+++ b/modules/sfp_vxvault.py
@@ -217,10 +217,6 @@ class sfp_vxvault(SpiderFootPlugin):
if eventName == 'AFFILIATE_IPADDR' \
and not self.opts.get('checkaffiliates', False):
return None
- if eventName == 'NETBLOCK_OWNER' and not self.opts.get('checknetblocks', False):
- return None
- if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):
- return None
for check in malchecks.keys():
cid = malchecks[check]['id']
@@ -247,13 +243,6 @@ class sfp_vxvault(SpiderFootPlugin):
if eventName == 'CO_HOSTED_SITE':
evtType = 'MALICIOUS_COHOST'
- if eventName == 'NETBLOCK_OWNER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
- if eventName == 'NETBLOCK_MEMBER':
- typeId = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
-
url = self.lookupItem(cid, typeId, eventData)
if self.checkForStop():
return None
diff --git a/modules/sfp_xforce.py b/modules/sfp_xforce.py
index 428cc3b6..e7b35b25 100644
--- a/modules/sfp_xforce.py
+++ b/modules/sfp_xforce.py
@@ -26,14 +26,22 @@ class sfp_xforce(SpiderFootPlugin):
opts = {
"xforce_api_key": "",
"xforce_api_key_password": "",
- "age_limit_days": 30
+ "age_limit_days": 30,
+ 'netblocklookup': True,
+ 'maxnetblock': 24,
+ 'subnetlookup': True,
+ 'maxsubnet': 24
}
# Option descriptions
optdescs = {
"xforce_api_key": "The X-Force Exchange API Key",
"xforce_api_key_password": "The X-Force Exchange API Password",
- "age_limit_days": "Ignore any records older than this many days. 0 = unlimited."
+ "age_limit_days": "Ignore any records older than this many days. 0 = unlimited.",
+ 'netblocklookup': "Look up all IPs on netblocks deemed to be owned by your target for possible blacklisted hosts on the same target subdomain/domain?",
+ 'maxnetblock': "If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)",
+ 'subnetlookup': "Look up all IPs on subnets which your target is a part of for blacklisting?",
+ 'maxsubnet': "If looking up subnets, the maximum subnet size to look up all the IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
}
# Be sure to completely clear any class variables in setup()
@@ -122,6 +130,26 @@ class sfp_xforce(SpiderFootPlugin):
else:
self.results[eventData] = True
+ if eventName == 'NETBLOCK_OWNER':
+ if not self.opts['netblocklookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxnetblock']))
+ return None
+
+ if eventName == 'NETBLOCK_MEMBER':
+ if not self.opts['subnetlookup']:
+ return None
+ else:
+ if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:
+ self.sf.debug("Network size bigger than permitted: " +
+ str(IPNetwork(eventData).prefixlen) + " > " +
+ str(self.opts['maxsubnet']))
+ return None
+
qrylist = list()
if eventName.startswith("NETBLOCK_"):
for ipaddr in IPNetwork(eventData):