diff --git a/var/www/modules/Tags/Flask_Tags.py b/var/www/modules/Tags/Flask_Tags.py index db501f67..2b723c79 100644 --- a/var/www/modules/Tags/Flask_Tags.py +++ b/var/www/modules/Tags/Flask_Tags.py @@ -5,7 +5,7 @@ Flask functions and routes for the trending modules page ''' import redis -from flask import Flask, render_template, jsonify, request, Blueprint +from flask import Flask, render_template, jsonify, request, Blueprint, redirect, url_for import json @@ -146,5 +146,43 @@ def get_tagged_paste_res(): return render_template("res.html") +@Tags.route("/Tags/remove_tag") +def remove_tag(): + + #TODO verify input + path = request.args.get('paste') + tag = request.args.get('tag') + + #remove tag + r_serv_metadata.srem('tag:'+path, tag) + r_serv_tags.srem(tag, path) + + return redirect(url_for('showsavedpastes.showsavedpaste', paste=path)) + +@Tags.route("/Tags/confirm_tag") +def confirm_tag(): + + #TODO verify input + path = request.args.get('paste') + tag = request.args.get('tag') + + if(tag[9:28] == 'automatic-detection'): + + #remove automatic tag + r_serv_metadata.srem('tag:'+path, tag) + r_serv_tags.srem(tag, path) + + tag = tag.replace('automatic-detection','analyst-detection', 1) + #add analyst tag + r_serv_metadata.sadd('tag:'+path, tag) + r_serv_tags.sadd(tag, path) + #add new tag in list of all used tags + r_serv_tags.sadd('list_tags', tag) + + return redirect(url_for('showsavedpastes.showsavedpaste', paste=path)) + + return 'incompatible tag' + + # ========= REGISTRATION ========= app.register_blueprint(Tags) diff --git a/var/www/modules/Tags/templates/tagged.html b/var/www/modules/Tags/templates/tagged.html index 17e5181b..6102be28 100644 --- a/var/www/modules/Tags/templates/tagged.html +++ b/var/www/modules/Tags/templates/tagged.html @@ -168,7 +168,7 @@ $(document).ready(function(){ var ltags = $('#ltags').tagSuggest({ data: data, - //value: slct_tags, + value: '["infoleak:automatic-detection=\"bitcoin-address\"","infoleak:automatic-detection=\"aws-key\""]', sortOrder: 'name', maxDropHeight: 200, name: 'ltags' diff --git a/var/www/modules/showpaste/templates/show_saved_paste.html b/var/www/modules/showpaste/templates/show_saved_paste.html index 2dae1caa..c0bcd35d 100644 --- a/var/www/modules/showpaste/templates/show_saved_paste.html +++ b/var/www/modules/showpaste/templates/show_saved_paste.html @@ -24,8 +24,37 @@ @@ -55,6 +84,13 @@ + +