diff --git a/bin/Credential.py b/bin/Credential.py index 29a418c7..23c90506 100755 --- a/bin/Credential.py +++ b/bin/Credential.py @@ -24,7 +24,6 @@ if __name__ == "__main__": message = p.get_from_set() if message is None: publisher.debug("Script Credential is Idling 10s") - print('Sleeping') time.sleep(10) continue diff --git a/var/www/Flask_server.py b/var/www/Flask_server.py index 242919a2..33f85c0e 100755 --- a/var/www/Flask_server.py +++ b/var/www/Flask_server.py @@ -86,16 +86,19 @@ def parseStringToList(the_string): return elemList def parseStringToList2(the_string): - res = [] - tab_str = the_string.split('], [') - tab_str[0] = tab_str[0][1:]+']' - tab_str[len(tab_str)-1] = '['+tab_str[len(tab_str)-1][:-1] - res.append(parseStringToList(tab_str[0])) - for i in range(1, len(tab_str)-2): - tab_str[i] = '['+tab_str[i]+']' - res.append(parseStringToList(tab_str[i])) - res.append(parseStringToList(tab_str[len(tab_str)-1])) - return res + if the_string == []: + return [] + else: + res = [] + tab_str = the_string.split('], [') + tab_str[0] = tab_str[0][1:]+']' + tab_str[len(tab_str)-1] = '['+tab_str[len(tab_str)-1][:-1] + res.append(parseStringToList(tab_str[0])) + for i in range(1, len(tab_str)-2): + tab_str[i] = '['+tab_str[i]+']' + res.append(parseStringToList(tab_str[i])) + res.append(parseStringToList(tab_str[len(tab_str)-1])) + return res def showpaste(content_range): @@ -154,6 +157,12 @@ def showpaste(content_range): return render_template("show_saved_paste.html", date=p_date, source=p_source, encoding=p_encoding, language=p_language, size=p_size, mime=p_mime, lineinfo=p_lineinfo, content=p_content, initsize=len(p_content), duplicate_list = p_duplicate_list, simil_list = p_simil_list, hashtype_list = p_hashtype_list) +def getPastebyType(module_name): + all_path = [] + all_path.append("/home/mokaddem/AIL-framework/PASTES/archive/paste.debian.net/2016/06/30/771058.gz") + return all_path + + def get_date_range(num_day): curr_date = datetime.date.today() date = Date(str(curr_date.year)+str(curr_date.month).zfill(2)+str(curr_date.day).zfill(2)) @@ -365,6 +374,29 @@ def trending(): default_display = cfg.get("Flask", "default_display") return render_template("Trending.html", default_display = default_display) +@app.route("/browseImportantPaste/", methods=['GET']) +def browseImportantPaste(): + module_name = request.args.get('moduleName') + + all_content = [] + paste_date = [] + paste_linenum = [] + all_path = [] + + for path in getPastebyType(module_name): + all_path.append(path) + paste = Paste.Paste(path) + content = paste.get_p_content().decode('utf8', 'ignore') + content_range = max_preview_char if len(content)>max_preview_char else len(content)-1 + all_content.append(content[0:content_range]) + curr_date = str(paste._get_p_date()) + curr_date = curr_date[0:4]+'/'+curr_date[4:6]+'/'+curr_date[6:] + paste_date.append(curr_date) + paste_linenum.append(paste.get_lines_info()[0]) + + return render_template("browse_important_paste.html", all_path=all_path, content=all_content, paste_date=paste_date, paste_linenum=paste_linenum, char_to_display=max_preview_modal) + + @app.route("/moduletrending/") def moduletrending(): diff --git a/var/www/templates/browse_important_paste.html b/var/www/templates/browse_important_paste.html new file mode 100644 index 00000000..d9c2de8b --- /dev/null +++ b/var/www/templates/browse_important_paste.html @@ -0,0 +1,236 @@ + + + + + + + + Analysis Information Leak framework Dashboard + + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
+

Browse important pastes

+
+ +
+ +
+ + + +
+ + +
+
+ + + + + + + + + + + + {% set i = 0 %} + {% for path in all_path %} + + + + + + + + {% set i = i + 1 %} + {% endfor %} + +
#PathDate# of linesAction
{{ i + 1 }}{{ path }}{{ paste_date[i] }}{{ paste_linenum[i] }}

+
+
+ coucou2 +
+
+ coucou3 +
+
+ coucou4 +
+
+ +
+ + + + + + + + + +
+ + + diff --git a/var/www/templates/index.html b/var/www/templates/index.html index d12adfa4..b6426ea7 100644 --- a/var/www/templates/index.html +++ b/var/www/templates/index.html @@ -39,6 +39,7 @@
  • Dashboard
  • Trending charts
  • Modules statistics
  • +
  • Browse important pastes
  • diff --git a/var/www/templates/show_saved_paste.html b/var/www/templates/show_saved_paste.html index 0da148f3..75d8ab46 100644 --- a/var/www/templates/show_saved_paste.html +++ b/var/www/templates/show_saved_paste.html @@ -62,7 +62,7 @@ {% endif %}

    Content:

    -

    {{ content }}

    +

    {{ content }}