From a5117d7cad1f0ee8a0a3093e9042447ea2216302 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Sat, 20 Aug 2016 11:46:22 +0200 Subject: [PATCH] Added top set webpage --- var/www/Flask_server.py | 34 ++ var/www/templates/header.html | 3 +- var/www/templates/terms_management.html | 2 +- var/www/templates/terms_plot_top.html | 424 ++++++++++++++++++++++++ 4 files changed, 461 insertions(+), 2 deletions(-) create mode 100644 var/www/templates/terms_plot_top.html diff --git a/var/www/Flask_server.py b/var/www/Flask_server.py index 9c98642e..be634e77 100755 --- a/var/www/Flask_server.py +++ b/var/www/Flask_server.py @@ -227,6 +227,8 @@ def Term_getValueOverRange(word, startDate, num_day): curr_to_return = 0 for timestamp in range(startDate, startDate - max(num_day)*oneDay, -oneDay): value = r_serv_term.hget(timestamp, word) + print timestamp, word + print value curr_to_return += int(value) if value is not None else 0 for i in num_day: if passed_days == i-1: @@ -675,6 +677,37 @@ def terms_plot_tool(): return render_template("terms_plot_tool.html") +@app.route("/terms_plot_top/") +def terms_plot_top(): + return render_template("terms_plot_top.html") + + +@app.route("/terms_plot_top_data/") +def terms_plot_top_data(): + today = datetime.datetime.now() + today = today.replace(hour=0, minute=0, second=0, microsecond=0) + today_timestamp = calendar.timegm(today.timetuple()) + + the_set = request.args.get('set') + num_day = int(request.args.get('num_day')) + if the_set is None: + return "None" + else: + oneDay = 60*60*24 + to_return = [] + for term in r_serv_term.smembers(the_set): + value_range = [] + tot_sum = 0 + for timestamp in range(today_timestamp, today_timestamp - num_day*oneDay, -oneDay): + value = r_serv_term.hget(timestamp, term) + curr_value_range = int(value) if value is not None else 0 + tot_sum += curr_value_range + value_range.append([timestamp, curr_value_range]) + + to_return.append([term, value_range, tot_sum]) + + return jsonify(to_return) + @app.route("/test/") #completely shows the paste in a new tab def test(): @@ -700,6 +733,7 @@ def test(): # for e in array2: # stri += "

"+ e[0] + "\t" + str(e[1]) +"

" + print stri return stri diff --git a/var/www/templates/header.html b/var/www/templates/header.html index 07e1bdb7..4deb4740 100644 --- a/var/www/templates/header.html +++ b/var/www/templates/header.html @@ -15,7 +15,8 @@ diff --git a/var/www/templates/terms_management.html b/var/www/templates/terms_management.html index f4ebb0cb..02345fca 100644 --- a/var/www/templates/terms_management.html +++ b/var/www/templates/terms_management.html @@ -56,7 +56,7 @@
-

Terms management interface

+

Terms frequency: Management interface

diff --git a/var/www/templates/terms_plot_top.html b/var/www/templates/terms_plot_top.html new file mode 100644 index 00000000..f17e4f37 --- /dev/null +++ b/var/www/templates/terms_plot_top.html @@ -0,0 +1,424 @@ + + + + + + + + Analysis Information Leak framework Dashboard + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+

Terms frequency: Top set information

+
+ +
+ +
+ + +
+
+
+
+
+
+ Today +
+
+
+
+ Today top word +
+
+
+ + + + + + + + + + + +
TermValueActionDisplayed
+
+
+ + + + + + + + + + + +
TermValueActionDisplayed
+
+
+ +
+
+
+ Graph +
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+
+
+
+ Week +
+
+
+
+ Week top word +
+
+
+ + + + + + + + + + + +
TermValueActionDisplayed
+
+
+ + + + + + + + + + + +
TermValueActionDisplayed
+
+
+ +
+
+
+ Graph +
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+
+
+
+ Month +
+
+
+
+ Month top word +
+
+
+ + + + + + + + + + + +
TermValueActionDisplayed
+
+
+ + + + + + + + + + + +
TermValueActionDisplayed
+
+ +
+ +
+
+
+ Graph +
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + + +
+ +
+ + + + + + + + + +