Skip to content

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

sfp_webserver: Allow reporting more than one WEBSERVER_TECHNOLOGY (#1370)

bcolesf953c4d05424
diff --git a/modules/sfp_webserver.py b/modules/sfp_webserver.py
index 33daa2d2..19cf43ed 100644
--- a/modules/sfp_webserver.py
+++ b/modules/sfp_webserver.py
@@ -45,8 +45,6 @@ class sfp_webserver(SpiderFootPlugin):
return ["WEBSERVER_HTTPHEADERS"]
# What events this module produces
- # This is to support the end user in selecting modules based on events
- # produced.
def producedEvents(self):
return ["WEBSERVER_BANNER", "WEBSERVER_TECHNOLOGY",
'LINKED_URL_INTERNAL', 'LINKED_URL_EXTERNAL']
@@ -102,40 +100,43 @@ class sfp_webserver(SpiderFootPlugin):
# banners and therefore classifying them further (type and version,
# possibly OS. This could also trigger additional tests, such as 404s
# and other errors to see what the header looks like.
- if 'server' in jdata:
- evt = SpiderFootEvent("WEBSERVER_BANNER", jdata['server'],
- self.__name__, event)
+ server = jdata.get('server')
+ if server:
+ self.sf.info(f"Found web server: {server} ({eventSource})")
+ evt = SpiderFootEvent("WEBSERVER_BANNER", server, self.__name__, event)
self.notifyListeners(evt)
- self.sf.info("Found web server: " + jdata['server'] + " (" + eventSource + ")")
+ cookies = jdata.get('set-cookie')
- if 'x-powered-by' in jdata:
- evt = SpiderFootEvent("WEBSERVER_TECHNOLOGY", jdata['x-powered-by'],
- self.__name__, event)
- self.notifyListeners(evt)
- return
+ tech = list()
+
+ powered_by = jdata.get('x-powered-by')
+ if powered_by:
+ tech.append(powered_by)
- tech = None
- if 'set-cookie' in jdata and 'PHPSESS' in jdata['set-cookie']:
- tech = "PHP"
+ if 'x-aspnet-version' in jdata:
+ tech.append("ASP.NET")
- if 'set-cookie' in jdata and 'JSESSIONID' in jdata['set-cookie']:
- tech = "Java/JSP"
+ if cookies and 'PHPSESS' in cookies:
+ tech.append("PHP")
- if 'set-cookie' in jdata and 'ASP.NET' in jdata['set-cookie']:
- tech = "ASP.NET"
+ if cookies and 'JSESSIONID' in cookies:
+ tech.append("Java/JSP")
- if 'x-aspnet-version' in jdata:
- tech = "ASP.NET"
+ if cookies and 'ASP.NET' in cookies:
+ tech.append("ASP.NET")
+
+ if '.asp' in eventSource:
+ tech.append("ASP")
- if tech is not None and '.jsp' in eventSource:
- tech = "Java/JSP"
+ if '.jsp' in eventSource:
+ tech.append("Java/JSP")
- if tech is not None and '.php' in eventSource:
- tech = "PHP"
+ if '.php' in eventSource:
+ tech.append("PHP")
- if tech is not None:
- evt = SpiderFootEvent("WEBSERVER_TECHNOLOGY", tech, self.__name__, event)
+ for t in set(tech):
+ evt = SpiderFootEvent("WEBSERVER_TECHNOLOGY", t, self.__name__, event)
self.notifyListeners(evt)
# End of sfp_webserver class