Skip to content

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

Dark theme (#1153)

Daniel Yordanov90b1f9e2f359
diff --git a/dyn/HEADER.tmpl b/dyn/HEADER.tmpl
index 57796a75..12274c68 100644
--- a/dyn/HEADER.tmpl
+++ b/dyn/HEADER.tmpl
@@ -11,9 +11,26 @@
<script type='text/javascript' src='${docroot}/static/js/spiderfoot.js'></script>
<script type='text/javascript' src='${docroot}/static/js/viz.js'></script>
- <link href="${docroot}/static/css/bootstrap.min.css" rel="stylesheet">
- <link href='${docroot}/static/css/tablesorter-theme.default.min.css' rel="stylesheet">
<link href="${docroot}/static/css/spiderfoot.css" rel="stylesheet">
+ <link href="${docroot}/static/css/bootstrap.min.css" rel="stylesheet">
+
+
+ <script>
+
+ // Executes the fastes and preloads the stylesheet before the body loads
+ var head = document.getElementsByTagName('HEAD')[0];
+ var link = document.createElement('link');
+
+ // set the attributes for link element
+ link.rel = 'stylesheet';
+ link.type = 'text/css';
+
+ if (localStorage.getItem("theme") === "dark-theme") {
+ link.href = "${docroot}/static/css/dark.css";
+ }
+
+ head.appendChild(link);
+ </script>
</head>
<body>
@@ -27,7 +44,8 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
- <a class="navbar-brand brand-logo" href="${docroot}/"><img class="spiderfoot-header-image" src="${docroot}/static/img/spiderfoot-header.png" /></a>
+ <a class="navbar-brand brand-logo light" href="${docroot}/"><img class="spiderfoot-header-image" src="${docroot}/static/img/spiderfoot-header.png" /></a>
+ <a class="navbar-brand brand-logo dark" href="${docroot}/"><img class="spiderfoot-header-image" src="${docroot}/static/img/spiderfoot-header-dark.png" /></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
@@ -52,7 +70,18 @@ class="nav-item"
class="nav-item"><a href="${docroot}/opts" class="nav-link"><i class="glyphicon glyphicon-wrench"></i>&nbsp;Settings</a></li>
</ul>
+
+
+
+
<ul class="nav navbar-nav navbar-right">
+ <!-- Theme toggler -->
+ <span id="toggler-text">Dark Mode</span>
+ <label class="switch">
+ <input id="theme-toggler" class="theme-toggler" type="checkbox">
+ <span class="slider round"></span>
+ </label>
+
<li><a href="#aboutmodal" data-toggle="modal" data-target="#aboutmodal"><i class="glyphicon glyphicon-info-sign"></i>&nbsp;About</a></li>
</ul>
</div><!-- /.navbar-collapse -->
diff --git a/static/css/dark.css b/static/css/dark.css
new file mode 100644
index 00000000..58a755ba
--- /dev/null
+++ b/static/css/dark.css
@@ -0,0 +1,196 @@
+/* DARK THEME PROPERTIES */
+body {
+ background-color: #1b1b1b;
+ color: #fff;
+}
+
+body button {
+ background-color: #059cd7;
+ border: none;
+}
+
+body button:hover {
+ background-color: #037eaf;
+}
+
+body .navbar-default {
+ border-color: #373737;
+ background: #171717;
+}
+
+body .navbar-default a {
+ color: #fff;
+}
+
+.navbar-default .navbar-nav > li > a {
+ color: #fff !important;
+}
+
+body input {
+ background: #3a3a3a;
+ border-color: #828181;
+}
+
+body .panel-default {
+ background-color: #3a3a3a !important;
+ border-color: #828181 !important;
+}
+
+tr {
+ background-color: #3a3a3a !important;
+}
+
+body tr:nth-child(even) {
+ background-color: #555 !important;
+}
+
+a {
+ color: #059cd7;
+}
+
+#toggler-text {
+ color: #fff;
+}
+
+.active a {
+ background-color: #3a3a3a !important;
+ color: #fff !important;
+}
+
+.alert-info {
+ border-color: #828181;
+ background-color: #3a3a3a;
+ color: #fff;
+}
+
+#btn-save-changes {
+ background-color: #337ab7 !important;
+ border-color: #2e6da4 !important;
+}
+
+#btn-save-changes:hover {
+ background-color: #265b8a !important;
+}
+
+#btn-reset-settings {
+ background-color: #c9302c !important;
+ border-color: #ac2925 !important;
+}
+
+#btn-reset-settings:hover {
+ background-color: #ac2b26 !important;
+}
+
+.form-control {
+ background: #3a3a3a;
+ border-color: #828181;
+ color: #fff !important;
+}
+
+.dark {
+ display: inline;
+}
+
+.light {
+ display: none;
+}
+
+.fade.in {
+ background: #1b1b1b !important;
+}
+
+.modal-content {
+ background-color: #3a3a3a;
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
+}
+
+#btn-filter {
+ background-color: #059cd7;
+ color: #fff;
+ border-color: #059cd7;
+}
+
+.btn-group > .btn + .dropdown-toggle {
+ background-color: #059cd7 !important;
+ color: #fff !important;
+ border-color: #0a81b0;
+ border-left: 1px solid #e7e7e7;
+}
+
+#btn-rerun {
+ background-color: #059cd7 !important;
+ color: #fff !important;
+ border-color: #0a81b0;
+}
+
+#btn-stop {
+ background-color: #059cd7 !important;
+ color: #fff !important;
+ border-color: #0a81b0;
+ border-left: 1px solid #e7e7e7;
+}
+
+#btn-refresh {
+ background-color: #059cd7 !important;
+ color: #fff !important;
+ border-color: #0a81b0;
+}
+
+#btn-export {
+ background-color: #059cd7 !important;
+ color: #fff !important;
+ border-color: #0a81b0;
+ border-left: 1px solid #e7e7e7;
+}
+
+.btn {
+ background-color: #059cd7 !important;
+ color: #fff !important;
+ border-color: #0a81b0;
+}
+
+#scanlist .alert-info {
+ background-color: #282828;
+}
+
+#breadcrumbs {
+ background-color: #3a3a3a;
+}
+
+.table-border-bg-inherit {
+ color: #fff;
+}
+
+svg text {
+ fill: #fff;
+}
+
+.axis path, .axis line {
+ fill: #fff;
+ stroke: #fff;
+}
+
+#errors, #status, #ucounter, #tcounter {
+ opacity: 0.9;
+}
+
+tr.danger {
+ color: #000;
+}
+
+.dropdown-menu {
+ background-color: #555;
+}
+
+.dropdown-menu > li > a {
+ color: #fff !important;
+}
+
+.nav-tabs {
+ border-bottom: none;
+}
+
+.popover-title {
+ background-color: #555;
+ color: #fff;
+}
\ No newline at end of file
diff --git a/static/css/spiderfoot.css b/static/css/spiderfoot.css
index cfaac01c..1939b838 100644
--- a/static/css/spiderfoot.css
+++ b/static/css/spiderfoot.css
@@ -3,10 +3,11 @@ body {
}
.navbar-brand {
- image-rendering: -o-crisp-edges; /* Opera */
- image-rendering: -webkit-optimize-contrast;/* Webkit (non-standard naming) */
+ image-rendering: -o-crisp-edges; /* Opera */
+ image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
image-rendering: crisp-edges;
- -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
+ -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
+ margin-top: -10px;
}
.brand-logo {
@@ -61,6 +62,10 @@ table pre {
font-size: 90%;
}
+#scanlist {
+ margin-top: 1rem;
+}
+
.vertical-align-top {
vertical-align: top;
}
@@ -74,47 +79,122 @@ a.link:hover {
}
.dend-node circle {
-fill: #fff;
-stroke: steelblue;
-stroke-width: 1.5px;
+ fill: #fff;
+ stroke: steelblue;
+ stroke-width: 1.5px;
}
.dend-node {
-font: 10px sans-serif;
+ font: 10px sans-serif;
}
.dend-link {
-fill: none;
-stroke: #ccc;
-stroke-width: 1.5px;
+ fill: none;
+ stroke: #ccc;
+ stroke-width: 1.5px;
}
.axis path,
.axis line {
-fill: none;
-stroke: #000;
-shape-rendering: crispEdges;
+ fill: none;
+ stroke: #000;
+ shape-rendering: crispEdges;
}
.bar {
-fill: orange;
+ fill: orange;
}
.bar:hover {
-fill: orangered ;
+ fill: orangered;
}
.x.axis path {
-display: none;
+ display: none;
}
.fade.in {
- background: #fff;
+ background: #fff;
+}
+
+input[type="checkbox"] {
+ width: 14px;
+ height: 14px;
+ margin: 0px;
+ display: inline;
+}
+
+.dark {
+ display: none;
+}
+
+/* THEME TOGGLER PROPERTIES */
+#toggler-text {
+ float: left;
+ position: absolute;
+ right: 18rem;
+ top: 29%;
+ color: #777777;
+}
+
+.switch {
+ position: relative;
+ display: inline-block;
+ width: 42px;
+ height: 21px;
+ margin-top: 1.3rem;
+ right: 100%;
}
-input[type=checkbox] {
- width: 14px;
- height: 14px;
- margin: 0px;
- display: inline;
+.switch input {
+ opacity: 0;
+ width: 0;
+ height: 0;
+}
+
+.slider {
+ position: absolute;
+ cursor: pointer;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: #ccc;
+ -webkit-transition: .4s;
+ transition: .4s;
}
+
+.slider:before {
+ position: absolute;
+ content: "";
+ height: 14px;
+ width: 14px;
+ left: 4px;
+ bottom: 4px;
+ background-color: white;
+ -webkit-transition: .4s;
+ transition: .4s;
+}
+
+input:checked + .slider {
+ background-color: #059CD7;
+}
+
+input:focus + .slider {
+ box-shadow: 0 0 1px #059CD7;
+}
+
+input:checked + .slider:before {
+ -webkit-transform: translateX(20px);
+ -ms-transform: translateX(20px);
+ transform: translateX(20px);
+}
+
+.slider.round {
+ border-radius: 31px;
+}
+
+.slider.round:before {
+ border-radius: 50%;
+}
+
diff --git a/static/img/spiderfoot-header-dark.png b/static/img/spiderfoot-header-dark.png
new file mode 100644
index 00000000..3fc478db
Binary files /dev/null and b/static/img/spiderfoot-header-dark.png differ
diff --git a/static/js/spiderfoot.js b/static/js/spiderfoot.js
index c8bef72b..0afa2e8a 100644
--- a/static/js/spiderfoot.js
+++ b/static/js/spiderfoot.js
@@ -9,51 +9,105 @@
// Licence: GPL
//-------------------------------------------------------------------------------
-var sf = {}
+// Toggler for theme
+document.addEventListener("DOMContentLoaded", () => {
+ const themeToggler = document.getElementById("theme-toggler");
+ const head = document.getElementsByTagName("HEAD")[0];
+ const togglerText = document.getElementById("toggler-text");
+ let link = document.createElement("link");
-sf.genericError = function(message) {
- sf.log(message);
- alert("Failure: " + message);
-}
+ if (localStorage.getItem("mode") === "Dark Mode") {
+ togglerText.innerText = "Dark Mode";
+ } else {
+ togglerText.innerText = "Light Mode";
+ }
-sf.replace_sfurltag = function(data) {
- if (data.toLowerCase().indexOf("&lt;sfurl&gt;") >= 0) {
- data = data.replace(RegExp("&lt;sfurl&gt;(.*)&lt;/sfurl&gt;", "img"), "<a target=_new href='\$1'>\$1</a>");
- }
- if (data.toLowerCase().indexOf("<sfurl>") >= 0) {
- data = data.replace(RegExp("<sfurl>(.*)</sfurl>", "img"), "<a target=_new href='\$1'>\$1</a>");
- }
- return data;
-}
-sf.remove_sfurltag = function(data) {
- if (data.toLowerCase().indexOf("&lt;sfurl&gt;") >= 0) {
- data = data.toLowerCase().replace("&lt;sfurl&gt;", "").replace("&lt;/sfurl&gt;", "");
- }
- if (data.toLowerCase().indexOf("<sfurl>") >= 0) {
- data = data.toLowerCase().replace("<sfurl>", "").replace("</sfurl>", "");
+ themeToggler.addEventListener("click", () => {
+ togglerText.innerText = "Light Mode";
+
+ if (localStorage.getItem("theme") === "dark-theme") {
+ localStorage.removeItem("theme");
+ localStorage.setItem("mode", "Dark Mode");
+
+ link.rel = "stylesheet";
+ link.type = "text/css";
+ link.href = "${docroot}/static/css/spiderfoot.css";
+
+ head.appendChild(link);
+ location.reload();
+ } else {
+ localStorage.setItem("theme", "dark-theme");
+ localStorage.setItem("mode", "Light Mode");
+
+ link.rel = "stylesheet";
+ link.type = "text/css";
+ link.href = "${docroot}/static/css/dark.css";
+
+ head.appendChild(link);
+ location.reload();
}
- return data;
-}
+ });
+});
-sf.search = function(scan_id, value, type, postFunc) {
- sf.fetchData("/search", { id: scan_id, eventType: type, value: value }, postFunc);
-}
+var sf = {};
-sf.fetchData = function(url, postData, postFunc) {
- var req = $.ajax({
- type: "POST",
- url: url,
- data: postData,
- cache: false,
- dataType: "json"
- });
-
- req.done(postFunc);
- req.fail(function(hr, status) {
- sf.genericError("AJAX Error: " + status)
- });
-}
+sf.genericError = function (message) {
+ sf.log(message);
+ alert("Failure: " + message);
+};
+
+sf.replace_sfurltag = function (data) {
+ if (data.toLowerCase().indexOf("&lt;sfurl&gt;") >= 0) {
+ data = data.replace(
+ RegExp("&lt;sfurl&gt;(.*)&lt;/sfurl&gt;", "img"),
+ "<a target=_new href='$1'>$1</a>"
+ );
+ }
+ if (data.toLowerCase().indexOf("<sfurl>") >= 0) {
+ data = data.replace(
+ RegExp("<sfurl>(.*)</sfurl>", "img"),
+ "<a target=_new href='$1'>$1</a>"
+ );
+ }
+ return data;
+};
+
+sf.remove_sfurltag = function (data) {
+ if (data.toLowerCase().indexOf("&lt;sfurl&gt;") >= 0) {
+ data = data
+ .toLowerCase()
+ .replace("&lt;sfurl&gt;", "")
+ .replace("&lt;/sfurl&gt;", "");
+ }
+ if (data.toLowerCase().indexOf("<sfurl>") >= 0) {
+ data = data.toLowerCase().replace("<sfurl>", "").replace("</sfurl>", "");
+ }
+ return data;
+};
+
+sf.search = function (scan_id, value, type, postFunc) {
+ sf.fetchData(
+ "/search",
+ { id: scan_id, eventType: type, value: value },
+ postFunc
+ );
+};
+
+sf.fetchData = function (url, postData, postFunc) {
+ var req = $.ajax({
+ type: "POST",
+ url: url,
+ data: postData,
+ cache: false,
+ dataType: "json",
+ });
+
+ req.done(postFunc);
+ req.fail(function (hr, status) {
+ sf.genericError("AJAX Error: " + status);
+ });
+};
/*
sf.simpleTable = function(id, data, cols, linkcol=null, linkstring=null, sortable=true, rowfunc=null) {
@@ -86,24 +140,32 @@ sf.simpleTable = function(id, data, cols, linkcol=null, linkstring=null, sortabl
*/
-sf.updateTooltips = function() {
- $(document).ready(function () {
- if ($("[rel=tooltip]").length) {
- $('[rel=tooltip]').tooltip({container: 'body'});
- }
- });
-}
-
-sf.log = function(message) {
- if (typeof console == "object" && typeof console.log == "function") {
- var currentdate = new Date();
- var pad = function(n){return ("0" + n).slice(-2);}
- var datetime = currentdate.getFullYear() + "-"
- + pad(currentdate.getMonth()+1) + "-"
- + pad(currentdate.getDate()) + " "
- + pad(currentdate.getHours()) + ":"
- + pad(currentdate.getMinutes()) + ":"
- + pad(currentdate.getSeconds());
- console.log('[' + datetime + '] ' + message);
+sf.updateTooltips = function () {
+ $(document).ready(function () {
+ if ($("[rel=tooltip]").length) {
+ $("[rel=tooltip]").tooltip({ container: "body" });
}
-}
+ });
+};
+
+sf.log = function (message) {
+ if (typeof console == "object" && typeof console.log == "function") {
+ var currentdate = new Date();
+ var pad = function (n) {
+ return ("0" + n).slice(-2);
+ };
+ var datetime =
+ currentdate.getFullYear() +
+ "-" +
+ pad(currentdate.getMonth() + 1) +
+ "-" +
+ pad(currentdate.getDate()) +
+ " " +
+ pad(currentdate.getHours()) +
+ ":" +
+ pad(currentdate.getMinutes()) +
+ ":" +
+ pad(currentdate.getSeconds());
+ console.log("[" + datetime + "] " + message);
+ }
+};
diff --git a/static/js/spiderfoot.scanlist.js b/static/js/spiderfoot.scanlist.js
index cbc1be52..5e668647 100644
--- a/static/js/spiderfoot.scanlist.js
+++ b/static/js/spiderfoot.scanlist.js
@@ -163,7 +163,7 @@
buttons += "</div>";
buttons += "</div>";
- var table = "<table id='scanlist' class='table table-bordered table-striped tablesorter'>";
+ var table = "<table id='scanlist' class='table table-bordered table-striped'>";
table += "<thead><tr><th class='sorter-false text-center'><input id='checkall' type='checkbox'></th> <th>Name</th> <th>Target</th> <th>Started</th> <th >Finished</th> <th class='text-center'>Status</th> <th class='text-center'>Elements</th><th class='sorter-false text-center'>Action</th> </tr></thead><tbody>";
filtered = 0;
for (var i = 0; i < data.length; i++) {