diff --git a/bin/packages/HiddenServices.py b/bin/packages/HiddenServices.py index 9f4e9302..5143553b 100755 --- a/bin/packages/HiddenServices.py +++ b/bin/packages/HiddenServices.py @@ -85,8 +85,8 @@ class HiddenServices(object): paste_parent = father.replace(self.paste_directory, '')[1:] paste_childrens = self.r_serv_metadata.smembers('paste_children:{}'.format(paste_parent)) ## TODO: # FIXME: remove me - if not paste_childrens: - paste_childrens = self.r_serv_metadata.smembers('paste_children:{}'.format(father)) + paste_children = self.r_serv_metadata.smembers('paste_children:{}'.format(father)) + paste_childrens = paste_childrens | paste_children for children in paste_childrens: if self.domain in children: l_crawled_pastes.append(children) diff --git a/var/www/modules/Flask_config.py b/var/www/modules/Flask_config.py index 34e630f2..07a6a3f0 100644 --- a/var/www/modules/Flask_config.py +++ b/var/www/modules/Flask_config.py @@ -150,6 +150,7 @@ bootstrap_label = ['primary', 'success', 'danger', 'warning', 'info'] UPLOAD_FOLDER = os.path.join(os.environ['AIL_FLASK'], 'submitted') +PASTES_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "pastes")) SCREENSHOT_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "crawled_screenshot")) max_dashboard_logs = int(cfg.get("Flask", "max_dashboard_logs")) diff --git a/var/www/modules/hiddenServices/Flask_hiddenServices.py b/var/www/modules/hiddenServices/Flask_hiddenServices.py index 7969aae8..2c0c7e4a 100644 --- a/var/www/modules/hiddenServices/Flask_hiddenServices.py +++ b/var/www/modules/hiddenServices/Flask_hiddenServices.py @@ -19,6 +19,9 @@ import Flask_config app = Flask_config.app cfg = Flask_config.cfg r_serv_onion = Flask_config.r_serv_onion +r_serv_metadata = Flask_config.r_serv_metadata +bootstrap_label = Flask_config.bootstrap_label +PASTES_FOLDER = Flask_config.PASTES_FOLDER hiddenServices = Blueprint('hiddenServices', __name__, template_folder='templates') @@ -79,9 +82,36 @@ def onion_domain(): h = HiddenServices(onion_domain, 'onion') l_pastes = h.get_last_crawled_pastes() - screenshot = h.get_domain_random_screenshot(l_pastes)[0] + screenshot = h.get_domain_random_screenshot(l_pastes) + if screenshot: + screenshot = screenshot[0] + else: + screenshot = 'None' + + paste_tags = [] + path_name = [] + for path in l_pastes: + path_name.append(path.replace(PASTES_FOLDER, '')) + p_tags = r_serv_metadata.smembers('tag:'+path) + l_tags = [] + for tag in p_tags: + complete_tag = tag + tag = tag.split('=') + if len(tag) > 1: + if tag[1] != '': + tag = tag[1][1:-1] + # no value + else: + tag = tag[0][1:-1] + # use for custom tags + else: + tag = tag[0] + l_tags.append( (tag, complete_tag) ) + paste_tags.append(l_tags) return render_template("showDomain.html", domain=onion_domain, last_check=last_check, first_seen=first_seen, + l_pastes=l_pastes, paste_tags=paste_tags, l_tags=l_tags, bootstrap_label=bootstrap_label, + path_name=path_name, domain_paste=domain_paste, screenshot=screenshot) # ============= JSON ============== diff --git a/var/www/modules/hiddenServices/templates/showDomain.html b/var/www/modules/hiddenServices/templates/showDomain.html index 3f5b8736..29aa821c 100644 --- a/var/www/modules/hiddenServices/templates/showDomain.html +++ b/var/www/modules/hiddenServices/templates/showDomain.html @@ -15,9 +15,15 @@ - - - + + + + @@ -28,8 +34,9 @@
-
+
+
Graph @@ -57,11 +64,38 @@ +
+ + + + + + + + + + {% for path in l_pastes %} + + + + {% endfor %} + + +
Crawled Pastes
{{ path_name[loop.index0] }} +
+ {% for tag in paste_tags[loop.index0] %} + + {{ tag[0] }} + + {% endfor %} +
+
+
-
+
@@ -74,6 +108,13 @@ $(document).ready(function(){ activePage = "page-hiddenServices" $("#"+activePage).addClass("active"); + table = $('#myTable_').DataTable( + { + "aLengthMenu": [[5, 10, 15, 20, -1], [5, 10, 15, 20, "All"]], + "iDisplayLength": 5, + "order": [[ 0, "desc" ]] + } + ); });