SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Updated template for new modules to reflect latest API.
smicallef9130fc67b170
diff --git a/modules/sfp_template.py b/modules/sfp_template.pyindex e5f22b98..203bbcc6 100644--- a/modules/sfp_template.py+++ b/modules/sfp_template.py@@ -1,25 +1,22 @@#-------------------------------------------------------------------------------# Name: sfp_XXX-# Purpose: Template for plug-ins to use.+# Purpose: Description of the plug-in.#-# Author: Steve Micallef <[email protected]>+# Author: Name and e-mail address#-# Created: 02/05/2012-# Copyright: (c) Steve Micallef 2012+# Created: Date+# Copyright: (c) Name# Licence: GPL#-------------------------------------------------------------------------------import sys-import re-from sflib import SpiderFoot, SpiderFootPlugin+from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent# SpiderFoot standard lib (must be initialized in setup)sf = None-# Replace XXX with the name of your module. The comment below it will-# end up in the UI as the module description to the end-user.class sfp_XXX(SpiderFootPlugin):- """About me here.."""+ """Description"""# Default optionsopts = { }@@ -27,7 +24,7 @@ class sfp_XXX(SpiderFootPlugin):# Option descriptionsoptdescs = {# For each option in opts you should have a key/value pair here- # describing it. It will end up in the UI to explain the option+ # describing it. It will end up in the UI to explain the option# to the end-user.}@@ -35,8 +32,8 @@ class sfp_XXX(SpiderFootPlugin):# or you run the risk of data persisting between scan runs.# Target- baseDomain = None- results = dict() # track results for duplicates+ baseDomain = None # calculated from the URL in setup+ results = dict()def setup(self, sfc, target, userOpts=dict()):global sf@@ -52,18 +49,32 @@ class sfp_XXX(SpiderFootPlugin):self.opts[opt] = userOpts[opt]# What events is this module interested in for input+ # * = be notified about all events.def watchedEvents(self):- return ["RAW_DATA"]+ return ["*"]# Handle events sent to this module- def handleEvent(self, srcModuleName, eventName, eventSource, eventSourceEvent, eventData):+ def handleEvent(self, event):+ eventName = event.eventType+ srcModuleName = event.module+ eventData = event.data+ # If you are processing RAW_DATA from sfp_spider, this is how you+ # would get the source of that raw data (e.g. a URL.)+ eventSource = event.sourceEvent.data+sf.debug("Received event, " + eventName + ", from " + srcModuleName)+ # DO SOMETHING HERE++ # Notify other modules of what you've found+ evt = SpiderFootEvent("EVENT_CODE_HERE", "data here", self.__name__, event.sourceEvent)+ self.notifyListeners(evt)+return None# If you intend for this module to act on its own (e.g. not solely rely# on events from other modules, then you need to have a start() method# and within that method call self.checkForStop() to see if you've been- # politely asked by the controller to stop your activities.+ # politely asked by the controller to stop your activities (user abort.)# End of sfp_XXX class