Skip to content

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

sfwebui: move static directory to spiderfoot package directory (#1235)

bcoles1917477162e4
diff --git a/sf.py b/sf.py
index 5f557f75..8ebc1f87 100755
--- a/sf.py
+++ b/sf.py
@@ -71,7 +71,8 @@ def main():
sfWebUiConfig = {
'host': '127.0.0.1',
'port': 5001,
- 'root': '/'
+ 'root': '/',
+ 'cors_origins': [],
}
# 'Global' configuration options
@@ -455,10 +456,7 @@ def start_web_server(sfWebUiConfig, sfConfig):
web_host = sfWebUiConfig.get('host', '127.0.0.1')
web_port = sfWebUiConfig.get('port', 5001)
web_root = sfWebUiConfig.get('root', '/')
-
- # Place your whitelisted CORS origins here
- # Example: cors_origins = ['http://example.com']
- cors_origins = []
+ cors_origins = sfWebUiConfig.get('cors_origins', [])
cherrypy.config.update({
'log.screen': False,
@@ -468,9 +466,6 @@ def start_web_server(sfWebUiConfig, sfConfig):
log.info(f"Starting web server at {web_host}:{web_port} ...")
- # Disable auto-reloading of content
- cherrypy.engine.autoreload.unsubscribe()
-
sf = SpiderFoot(sfConfig)
# Enable access to static files via the web directory
@@ -482,7 +477,7 @@ def start_web_server(sfWebUiConfig, sfConfig):
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': 'static',
- 'tools.staticdir.root': sf.myPath()
+ 'tools.staticdir.root': f"{sf.myPath()}/spiderfoot"
}
}
@@ -548,17 +543,14 @@ def start_web_server(sfWebUiConfig, sfConfig):
if using_ssl:
url = "https://"
- cors_origins.append(f"https://{web_host}:{web_port}")
else:
url = "http://"
- cors_origins.append(f"http://{web_host}:{web_port}")
if web_host == "0.0.0.0": # nosec
- url = f"{url}<IP of this host>"
+ url = f"{url}127.0.0.1:{web_port}"
else:
- url = f"{url}{web_host}"
-
- url = f"{url}:{web_port}{web_root}"
+ url = f"{url}{web_host}:{web_port}{web_root}"
+ cors_origins.append(url)
cherrypy_cors.install()
cherrypy.config.update({
@@ -574,6 +566,9 @@ def start_web_server(sfWebUiConfig, sfConfig):
print("*************************************************************")
print("")
+ # Disable auto-reloading of content
+ cherrypy.engine.autoreload.unsubscribe()
+
cherrypy.quickstart(SpiderFootWebUi(sfWebUiConfig, sfConfig), script_name=web_root, config=conf)
diff --git a/static/css/alertify.min.css b/spiderfoot/static/css/alertify.min.css
similarity index 100%
rename from static/css/alertify.min.css
rename to spiderfoot/static/css/alertify.min.css
diff --git a/static/css/bootstrap.min.css b/spiderfoot/static/css/bootstrap.min.css
similarity index 100%
rename from static/css/bootstrap.min.css
rename to spiderfoot/static/css/bootstrap.min.css
diff --git a/static/css/dark.css b/spiderfoot/static/css/dark.css
similarity index 100%
rename from static/css/dark.css
rename to spiderfoot/static/css/dark.css
diff --git a/static/css/spiderfoot.css b/spiderfoot/static/css/spiderfoot.css
similarity index 100%
rename from static/css/spiderfoot.css
rename to spiderfoot/static/css/spiderfoot.css
diff --git a/static/css/tablesorter-theme.default.min.css b/spiderfoot/static/css/tablesorter-theme.default.min.css
similarity index 100%
rename from static/css/tablesorter-theme.default.min.css
rename to spiderfoot/static/css/tablesorter-theme.default.min.css
diff --git a/static/fonts/glyphicons-halflings-regular.woff b/spiderfoot/static/fonts/glyphicons-halflings-regular.woff
similarity index 100%
rename from static/fonts/glyphicons-halflings-regular.woff
rename to spiderfoot/static/fonts/glyphicons-halflings-regular.woff
diff --git a/static/fonts/glyphicons-halflings-regular.woff2 b/spiderfoot/static/fonts/glyphicons-halflings-regular.woff2
similarity index 100%
rename from static/fonts/glyphicons-halflings-regular.woff2
rename to spiderfoot/static/fonts/glyphicons-halflings-regular.woff2
diff --git a/static/img/loader.gif b/spiderfoot/static/img/loader.gif
similarity index 100%
rename from static/img/loader.gif
rename to spiderfoot/static/img/loader.gif
diff --git a/static/img/spiderfoot-header-dark.png b/spiderfoot/static/img/spiderfoot-header-dark.png
similarity index 100%
rename from static/img/spiderfoot-header-dark.png
rename to spiderfoot/static/img/spiderfoot-header-dark.png
diff --git a/static/img/spiderfoot-header.png b/spiderfoot/static/img/spiderfoot-header.png
similarity index 100%
rename from static/img/spiderfoot-header.png
rename to spiderfoot/static/img/spiderfoot-header.png
diff --git a/static/img/spiderfoot-icon.png b/spiderfoot/static/img/spiderfoot-icon.png
similarity index 100%
rename from static/img/spiderfoot-icon.png
rename to spiderfoot/static/img/spiderfoot-icon.png
diff --git a/static/js/LICENSE.d3 b/spiderfoot/static/js/LICENSE.d3
similarity index 100%
rename from static/js/LICENSE.d3
rename to spiderfoot/static/js/LICENSE.d3
diff --git a/static/js/alertify.min.js b/spiderfoot/static/js/alertify.min.js
similarity index 100%
rename from static/js/alertify.min.js
rename to spiderfoot/static/js/alertify.min.js
diff --git a/static/js/bootstrap.min.js b/spiderfoot/static/js/bootstrap.min.js
similarity index 100%
rename from static/js/bootstrap.min.js
rename to spiderfoot/static/js/bootstrap.min.js
diff --git a/static/js/d3.min.js b/spiderfoot/static/js/d3.min.js
similarity index 100%
rename from static/js/d3.min.js
rename to spiderfoot/static/js/d3.min.js
diff --git a/static/js/jquery.min.js b/spiderfoot/static/js/jquery.min.js
similarity index 100%
rename from static/js/jquery.min.js
rename to spiderfoot/static/js/jquery.min.js
diff --git a/static/js/jquery.tablesorter.min.js b/spiderfoot/static/js/jquery.tablesorter.min.js
similarity index 100%
rename from static/js/jquery.tablesorter.min.js
rename to spiderfoot/static/js/jquery.tablesorter.min.js
diff --git a/static/js/jquery.tablesorter.pager.min.js b/spiderfoot/static/js/jquery.tablesorter.pager.min.js
similarity index 100%
rename from static/js/jquery.tablesorter.pager.min.js
rename to spiderfoot/static/js/jquery.tablesorter.pager.min.js
diff --git a/static/js/sigma.layout.forceAtlas2.min.js b/spiderfoot/static/js/sigma.layout.forceAtlas2.min.js
similarity index 100%
rename from static/js/sigma.layout.forceAtlas2.min.js
rename to spiderfoot/static/js/sigma.layout.forceAtlas2.min.js
diff --git a/static/js/sigma.min.js b/spiderfoot/static/js/sigma.min.js
similarity index 100%
rename from static/js/sigma.min.js
rename to spiderfoot/static/js/sigma.min.js
diff --git a/static/js/sigma.parsers.gexf.min.js b/spiderfoot/static/js/sigma.parsers.gexf.min.js
similarity index 100%
rename from static/js/sigma.parsers.gexf.min.js
rename to spiderfoot/static/js/sigma.parsers.gexf.min.js
diff --git a/static/js/sigma.parsers.json.min.js b/spiderfoot/static/js/sigma.parsers.json.min.js
similarity index 100%
rename from static/js/sigma.parsers.json.min.js
rename to spiderfoot/static/js/sigma.parsers.json.min.js
diff --git a/static/js/sigma.plugins.dragNodes.min.js b/spiderfoot/static/js/sigma.plugins.dragNodes.min.js
similarity index 100%
rename from static/js/sigma.plugins.dragNodes.min.js
rename to spiderfoot/static/js/sigma.plugins.dragNodes.min.js
diff --git a/static/js/sigma.renderers.snapshot.min.js b/spiderfoot/static/js/sigma.renderers.snapshot.min.js
similarity index 100%
rename from static/js/sigma.renderers.snapshot.min.js
rename to spiderfoot/static/js/sigma.renderers.snapshot.min.js
diff --git a/static/js/spiderfoot.js b/spiderfoot/static/js/spiderfoot.js
similarity index 100%
rename from static/js/spiderfoot.js
rename to spiderfoot/static/js/spiderfoot.js
diff --git a/static/js/spiderfoot.newscan.js b/spiderfoot/static/js/spiderfoot.newscan.js
similarity index 100%
rename from static/js/spiderfoot.newscan.js
rename to spiderfoot/static/js/spiderfoot.newscan.js
diff --git a/static/js/spiderfoot.opts.js b/spiderfoot/static/js/spiderfoot.opts.js
similarity index 100%
rename from static/js/spiderfoot.opts.js
rename to spiderfoot/static/js/spiderfoot.opts.js
diff --git a/static/js/spiderfoot.scanlist.js b/spiderfoot/static/js/spiderfoot.scanlist.js
similarity index 100%
rename from static/js/spiderfoot.scanlist.js
rename to spiderfoot/static/js/spiderfoot.scanlist.js
diff --git a/static/js/viz.js b/spiderfoot/static/js/viz.js
similarity index 100%
rename from static/js/viz.js
rename to spiderfoot/static/js/viz.js
diff --git a/test/integration/test_sfwebui.py b/test/integration/test_sfwebui.py
index b20f7281..3bce4762 100644
--- a/test/integration/test_sfwebui.py
+++ b/test/integration/test_sfwebui.py
@@ -78,7 +78,7 @@ class TestSpiderFootWebUiRoutes(helper.CPWebCase):
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': 'static',
- 'tools.staticdir.root': sf.myPath()
+ 'tools.staticdir.root': f"{sf.myPath()}/spiderfoot",
}
}