SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
tests: resolve darglint violations
Brendan Coles29863b4695f0
diff --git a/modules/sfp_abuseipdb.py b/modules/sfp_abuseipdb.pyindex 8b07db31..869fed7d 100644--- a/modules/sfp_abuseipdb.py+++ b/modules/sfp_abuseipdb.py@@ -142,6 +142,7 @@ class sfp_abuseipdb(SpiderFootPlugin):def parseBlacklist(self, blacklist):"""Parse plaintext blacklist+Args:blacklist (str): plaintext blacklist from AbuseIPDBdiff --git a/modules/sfp_hybrid_analysis.py b/modules/sfp_hybrid_analysis.pyindex 23bc4ce1..507f2dbd 100644--- a/modules/sfp_hybrid_analysis.py+++ b/modules/sfp_hybrid_analysis.py@@ -63,9 +63,6 @@ class sfp_hybrid_analysis(SpiderFootPlugin):errorState = Falsedef setup(self, sfc, userOpts=dict()):- """- Initialize module and module options- """self.sf = sfcself.results = self.tempStorage()self.errorState = False@@ -74,21 +71,19 @@ class sfp_hybrid_analysis(SpiderFootPlugin):self.opts[opt] = userOpts[opt]def watchedEvents(self):- """- What events is this module interested in for input- """return ["IP_ADDRESS", "DOMAIN_NAME"]def producedEvents(self):- """- What events this module produces- """return ["RAW_RIR_DATA", "INTERNET_NAME", "DOMAIN_NAME", "LINKED_URL_INTERNAL"]def queryDomain(self, qry):- """- Query domain- https://www.hybrid-analysis.com/docs/api/v2+ """Query a domain++ Args:+ qry (str): domain++ Returns:+ str: API response as JSON"""params = {@@ -111,9 +106,13 @@ class sfp_hybrid_analysis(SpiderFootPlugin):return self.parseAPIResponse(res)def queryHost(self, qry):- """- Query host- https://www.hybrid-analysis.com/docs/api/v2+ """Query a host++ Args:+ qry (str): host++ Returns:+ str: API response as JSON"""params = {@@ -136,9 +135,13 @@ class sfp_hybrid_analysis(SpiderFootPlugin):return self.parseAPIResponse(res)def queryHash(self, qry):- """- Query hash- https://www.hybrid-analysis.com/docs/api/v2+ """Query a hash++ Args:+ qry (str): hash++ Returns:+ str: API response as JSON"""params = {@@ -161,8 +164,13 @@ class sfp_hybrid_analysis(SpiderFootPlugin):return self.parseAPIResponse(res)def parseAPIResponse(self, res):- """- Parse API response+ """Parse HTTP response from API++ Args:+ res (dict): HTTP response from SpiderFoot.fetchUrl()++ Returns:+ str: API response as JSON"""if res['code'] == '400':@@ -194,10 +202,6 @@ class sfp_hybrid_analysis(SpiderFootPlugin):return datadef handleEvent(self, event):- """- Handle events sent to this module- """-eventName = event.eventTypesrcModuleName = event.moduleeventData = event.datadiff --git a/modules/sfp_recondev.py b/modules/sfp_recondev.pyindex fa97c66d..c5b4e242 100644--- a/modules/sfp_recondev.py+++ b/modules/sfp_recondev.py@@ -66,7 +66,14 @@ class sfp_recondev(SpiderFootPlugin):return ["RAW_RIR_DATA", "INTERNET_NAME"]def queryDomain(self, qry):- """https://recon.dev/api/docs"""+ """Query a domain++ Args:+ qry (str): domain++ Returns:+ str: API response as JSON+ """headers = {"Accept": "application/json"diff --git a/setup.cfg b/setup.cfgindex 6d83bcee..62a328ab 100644--- a/setup.cfg+++ b/setup.cfg@@ -1,10 +1,14 @@[flake8]flake8-max-line-length = 120max-complexity = 100-select = C,E,F,W,B,DUO-ignore = E501 W503 B006 DUO130 D+select = C,E,F,W,B,DUO,D+ignore = E501 W503 B006 DUO130per-file-ignores =spiderfoot/__init__.py:F401+ sfcli.py:D+ sflib.py:D+ sfscan.py:D+ sfwebui.py:D[darglint]docstring_style=googlediff --git a/sf.py b/sf.pyindex 3d2fc40d..c6308480 100755--- a/sf.py+++ b/sf.py@@ -422,7 +422,12 @@ def start_scan(sfConfig, sfModules, args):def start_web_server(sfWebUiConfig, sfConfig):- """Start the web server so you can start looking at results"""+ """Start the web server so you can start looking at results++ Args:+ sfWebUiConfig (dict): web server options+ sfConfig (dict): SpiderFoot config options+ """web_host = sfWebUiConfig.get('host', '127.0.0.1')web_port = sfWebUiConfig.get('port', 5001)@@ -531,7 +536,12 @@ def start_web_server(sfWebUiConfig, sfConfig):def handle_abort(signal, frame):- """Handle interrupt and abort scan."""+ """Handle interrupt and abort scan.++ Args:+ signal: TBD+ frame: TBD+ """global dbhglobal scanIddiff --git a/sfscan.py b/sfscan.pyindex edb74616..651db6ca 100644--- a/sfscan.py+++ b/sfscan.py@@ -188,12 +188,10 @@ class SpiderFootScanner():@propertydef scanId(self):- """Unique identifier for this scan"""return self.__scanId@propertydef status(self):- """Status of this scan"""return self.__statusdef __setStatus(self, status, started=None, ended=None):@@ -204,9 +202,6 @@ class SpiderFootScanner():started (float): timestamp at start of scanended (float): timestamp at end of scan- Returns:- None-Raises:TypeError: arg type was invalidValueError: arg value was invaliddiff --git a/spiderfoot/db.py b/spiderfoot/db.pyindex 92cbd4e9..ac0df557 100644--- a/spiderfoot/db.py+++ b/spiderfoot/db.py@@ -252,9 +252,6 @@ class SpiderFootDb:init (bool): initialise the database schema.if the database file does not exist this option will be ignored.- Returns:- None: success-Raises:TypeError: arg type was invalidValueError: arg value was invalid@@ -329,9 +326,6 @@ class SpiderFootDb:def create(self):"""Create the database schema.- Returns:- None: success-Raises:IOError: database I/O failed"""@@ -348,11 +342,7 @@ class SpiderFootDb:raise IOError(f"SQL error encountered when setting up database: {e.args[0]}")def close(self):- """Close the database handle-- Returns:- None: success- """+ """Close the database handle."""with self.dbhLock:self.dbh.close()@@ -467,10 +457,8 @@ class SpiderFootDb:message (str): TBDcomponent (str): TBD- Returns:- None: success-Raises:+ TypeError: arg type was invalidIOError: database I/O failedTodo:@@ -515,9 +503,6 @@ class SpiderFootDb:scanName(str): scan namescanTarget (str): scan target- Returns:- None: success-Raises:TypeError: arg type was invalidIOError: database I/O failed@@ -554,9 +539,6 @@ class SpiderFootDb:ended (str): scan end timestatus (str): scan status- Returns:- None: success-Raises:TypeError: arg type was invalidIOError: database I/O failed@@ -854,9 +836,6 @@ class SpiderFootDb:Args:instanceId (str): scan instance ID- Returns:- None: success-Raises:TypeError: arg type was invalidIOError: database I/O failed@@ -926,9 +905,6 @@ class SpiderFootDb:Args:optMap (dict): config options- Returns:- None: success-Raises:TypeError: arg type was invalidValueError: arg value was invalid@@ -993,9 +969,6 @@ class SpiderFootDb:"""Reset the config to default.Clears the config from the database and lets the hard-coded settings in the code take effect.- Returns:- None: success-Raises:IOError: database I/O failed"""@@ -1015,9 +988,6 @@ class SpiderFootDb:id (int): scan instance IDoptMap (dict): config options- Returns:- None: success-Raises:TypeError: arg type was invalidValueError: arg value was invalid@@ -1095,9 +1065,6 @@ class SpiderFootDb:sfEvent (SpiderFootEvent): event to be stored in the databasetruncateSize (int): truncate size for event data- Returns:- None: success-Raises:TypeError: arg type was invalidValueError: arg value was invalid@@ -1225,6 +1192,9 @@ class SpiderFootDb:def scanResultHistory(self, instanceId):"""History of data from the scan.+ Args:+ instanceId (str): scan instance ID+Returns:list: scan data history@@ -1361,7 +1331,7 @@ class SpiderFootDb:Raises:TypeError: arg type was invalid- IOError: database I/O failed+ ValueError: arg value was invalid"""if not isinstance(instanceId, str):@@ -1432,7 +1402,6 @@ class SpiderFootDb:Raises:TypeError: arg type was invalid- IOError: database I/O failedNote: This function is not the same as the scanElementParent* functions.This function returns only ids.diff --git a/spiderfoot/event.py b/spiderfoot/event.pyindex b6335c57..ba6c00b9 100644--- a/spiderfoot/event.py+++ b/spiderfoot/event.py@@ -46,10 +46,6 @@ class SpiderFootEvent():confidence (int): how sure are we of this data's validity, 0-100visibility (int): how 'visible' was this data, 0-100risk (int): how much risk does this data represent, 0-100-- Raises:- TypeError: arg type was invalid- ValueError: arg value was invalid"""self._generated = time.time()@@ -116,12 +112,10 @@ class SpiderFootEvent():@propertydef actualSource(self):- """actual source"""return self._actualSource@propertydef moduleDataSource(self):- """module data source"""return self._moduleDataSource@property@@ -216,6 +210,9 @@ class SpiderFootEvent():@module.setterdef module(self, module):"""+ Args:+ module (str): module+Raises:TypeError: module type was invalidValueError: module value was invalid@@ -232,7 +229,11 @@ class SpiderFootEvent():@data.setterdef data(self, data):- """+ """Event data++ Args:+ data (str): data+Raises:TypeError: data type was invalidValueError: data value was invalid@@ -248,7 +249,11 @@ class SpiderFootEvent():@sourceEvent.setterdef sourceEvent(self, sourceEvent):- """+ """source event++ Args:+ sourceEvent (SpiderFootEvent): source event+Raises:TypeError: sourceEvent type was invalid"""@@ -295,7 +300,13 @@ class SpiderFootEvent():return evtDictdef getHash(self):- """Required for SpiderFoot HX compatibility of modules"""+ """Event hash++ Note: required for SpiderFoot HX compatibility of modules.++ Returns:+ str: event hash+ """return self.hash# end of SpiderFootEvent classdiff --git a/spiderfoot/plugin.py b/spiderfoot/plugin.pyindex 13033755..43acdc5a 100644--- a/spiderfoot/plugin.py+++ b/spiderfoot/plugin.py@@ -54,7 +54,11 @@ class SpiderFootPlugin():def _updateSocket(self, socksProxy):"""Hack to override module's use of socket, replacing it with- one that uses the supplied SOCKS server."""+ one that uses the supplied SOCKS server.++ Args:+ socksProxy (str): SOCKS proxy+ """self.socksProxy = socksProxydef clearListeners(self):@@ -65,12 +69,22 @@ class SpiderFootPlugin():self._stopScanning = Falsedef setup(self, sf, userOpts={}):- """Will always be overriden by the implementer."""+ """Will always be overriden by the implementer.++ Args:+ sf (SpiderFoot): SpiderFoot object+ userOpts (dict): TBD+ """passdef enrichTarget(self, target):- """Rarely used, only in special cases where a module can find- aliases for a target."""+ """Find aliases for a target.++ Note: rarely used in special cases++ Args:+ target (str): TBD+ """passdef setTarget(self, target):@@ -78,6 +92,9 @@ class SpiderFootPlugin():Args:target (SpiderFootTarget): target++ Raises:+ TypeError: target argument was invalid type"""from spiderfoot import SpiderFootTarget@@ -99,7 +116,10 @@ class SpiderFootPlugin():"""Set the scan ID.Args:- id (str): scan ID+ scanId (str): scan instance ID++ Raises:+ TypeError: scanId argument was invalid type"""if not isinstance(scanId, str):raise TypeError(f"scanId is {type(scanId)}; expected str")@@ -111,6 +131,9 @@ class SpiderFootPlugin():Returns:str: scan ID++ Raises:+ TypeError: Module called getScanId() but no scanId is set."""if not self.__scanId__:raise TypeError("Module called getScanId() but no scanId is set.")@@ -118,7 +141,14 @@ class SpiderFootPlugin():return self.__scanId__def getTarget(self):- """Gets the current target this module is acting against."""+ """Gets the current target this module is acting against.++ Returns:+ str: current target++ Raises:+ TypeError: Module called getTarget() but no target is set.+ """if not self._currentTarget:raise TypeError("Module called getTarget() but no target is set.")@@ -160,6 +190,12 @@ class SpiderFootPlugin():Args:sfEvent (SpiderFootEvent): event++ Returns:+ None++ Raises:+ TypeError: sfEvent argument was invalid type"""from spiderfoot import SpiderFootEventdiff --git a/spiderfoot/target.py b/spiderfoot/target.pyindex 73a5b84d..5af9d48d 100644--- a/spiderfoot/target.py+++ b/spiderfoot/target.py@@ -24,11 +24,6 @@ class SpiderFootTarget():Args:targetValue (str): target valuetypeName (str): target type-- Raises:- TypeError: targetValue type was invalid- ValueError: targetValue value was empty- ValueError: typeName value was an invalid target type"""self.targetType = typeName@@ -106,6 +101,9 @@ class SpiderFootTarget():def _getEquivalents(self, typeName):"""TBD+ Args:+ typeName (str): event type+Returns:list: target aliases"""diff --git a/test/unit/test_spiderfoot_module_loading.py b/test/unit/test_spiderfoot_module_loading.pyindex b2605ef4..577683ba 100644--- a/test/unit/test_spiderfoot_module_loading.py+++ b/test/unit/test_spiderfoot_module_loading.py@@ -33,9 +33,6 @@ class TestSpiderFootModuleLoading(unittest.TestCase):}def test_module_loading(self):- """- Test module loading- """sf = SpiderFoot(self.default_options)# Go through each module in the modules directory with a .py extension