Skip to content

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

sfp_malware fix

Immanuel Georgef64892faeb0c
diff --git a/modules/sfp_malwarepatrol.py b/modules/sfp_malwarepatrol.py
index 03d7196e..4f374c51 100644
--- a/modules/sfp_malwarepatrol.py
+++ b/modules/sfp_malwarepatrol.py
@@ -11,8 +11,10 @@
# Licence: GPL
# -------------------------------------------------------------------------------
-import json
-from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
+from sflib import (
+ SpiderFootPlugin,
+ SpiderFootEvent
+)
class sfp_malwarepatrol(SpiderFootPlugin):
@@ -45,30 +47,44 @@ class sfp_malwarepatrol(SpiderFootPlugin):
# This is to support the end user in selecting modules based on events
# produced.
def producedEvents(self):
- return ["MALICIOUS_IPADDR", "MALICIOUS_INTERNET_NAME",
- "MALICIOUS_AFFILIATE_IPADDR", "MALICIOUS_AFFILIATE_INTERNET_NAME",
- "MALICIOUS_COHOST"]
+ return [
+ "MALICIOUS_IPADDR",
+ "MALICIOUS_INTERNET_NAME",
+ "MALICIOUS_AFFILIATE_IPADDR",
+ "MALICIOUS_AFFILIATE_INTERNET_NAME",
+ "MALICIOUS_COHOST"
+ ]
def queryAddr(self, qaddr):
- data = dict()
- url = "http://lists.malwarepatrol.net/cgi/getfile?receipt=" + \
- self.opts['api_key'] + "&product=8&list=smoothwall"
-
- data['content'] = self.sf.cacheGet("sfmalwarepatrol", 72)
- if data['content'] is None:
- data = self.sf.fetchUrl(url, useragent=self.opts['_useragent'])
+ block_list = [
+ "clamav_basic",
+ "firekeeper",
+ "mailwasher",
+ "mozilla_adblock",
+ "spamassassin",
+ "smoothwall"
+ ]
+
+ for block_name in block_list:
+ data = dict()
+ url = "http://lists.malwarepatrol.net/cgi/getfile?receipt={}&product=32&list={}"
+ url = url.format(self.opts['api_key'], block_name)
+
+ data['content'] = self.sf.cacheGet("sfmalwarepatrol", 72)
if data['content'] is None:
- self.sf.error("Unable to fetch " + url, False)
- return None
- else:
- self.sf.cachePut("sfmalwarepatrol", data['content'])
+ data = self.sf.fetchUrl(url, useragent=self.opts['_useragent'])
+ if data['content'] is None:
+ self.sf.error("Unable to fetch " + url, False)
+ return None
+ else:
+ self.sf.cachePut("sfmalwarepatrol", data['content'])
- for line in data['content'].split('\n'):
- if len(line) < 2 or line.startswith('#'):
- continue
+ for line in data['content'].split('\n'):
+ if len(line) < 2 or line.startswith('#'):
+ continue
- if line.startswith(qaddr):
- return True
+ if line.startswith(qaddr):
+ return True
return False
@@ -84,7 +100,10 @@ class sfp_malwarepatrol(SpiderFootPlugin):
self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)
if not self.opts['api_key']:
- self.sf.error("You enabled sfp_malwarepatrol but did not provide an receipt ID!", False)
+ self.sf.error(
+ "You enabled sfp_malwarepatrol but did not provide an receipt ID!",
+ False
+ )
self.errorState = True
return None
@@ -96,14 +115,20 @@ class sfp_malwarepatrol(SpiderFootPlugin):
self.results[eventData] = True
evtType = ""
- if eventName in ['IP_ADDRESS', 'AFFILIATE_IPADDR']:
+ if eventName in [
+ 'IP_ADDRESS',
+ 'AFFILIATE_IPADDR'
+ ]:
if eventName == 'IP_ADDRESS':
evtType = 'MALICIOUS_IPADDR'
else:
evtType = 'MALICIOUS_AFFILIATE_IPADDR'
- if eventName in ['INTERNET_NAME', 'CO_HOSTED_SITE',
- 'AFFILIATE_INTERNET_NAME' ]:
+ if eventName in [
+ 'INTERNET_NAME',
+ 'CO_HOSTED_SITE',
+ 'AFFILIATE_INTERNET_NAME'
+ ]:
if eventName == "INTERNET_NAME":
evtType = "MALICIOUS_INTERNET_NAME"
if eventName == 'AFFILIATE_INTERNET_NAME':