diff --git a/bin/Duplicates.py b/bin/Duplicates.py index ecbe20ce..58bad3f0 100755 --- a/bin/Duplicates.py +++ b/bin/Duplicates.py @@ -118,7 +118,6 @@ if __name__ == "__main__": for curr_dico_name, curr_dico_redis in opened_dico: for hash_type, paste_hash in paste_hashes.items(): for dico_hash in curr_dico_redis.smembers('HASHS_'+hash_type): - dico_hash = dico_hash try: if hash_type == 'ssdeep': diff --git a/bin/packages/Paste.py b/bin/packages/Paste.py index d52539e2..332981f9 100755 --- a/bin/packages/Paste.py +++ b/bin/packages/Paste.py @@ -333,13 +333,11 @@ class Paste(object): #json save on redis if json_duplicate is not None: list_duplicate = (json.loads(json_duplicate)) - # avoid duplicate - list_duplicate = set(tuple(row) for row in list_duplicate) - list_duplicate = [list(item) for item in set(tuple(row) for row in list_duplicate)] - - # add new duplicate - list_duplicate.append([hash_type, self.p_path, percent, date]) - self.store.hset(path, attr_name, json.dumps(list_duplicate)) + # avoid duplicate, a paste can be send by multiples modules + to_add = [hash_type, self.p_path, percent, date] + if to_add not in list_duplicate: + list_duplicate.append(to_add) + self.store.hset(path, attr_name, json.dumps(list_duplicate)) else: # create the new list diff --git a/var/www/modules/showpaste/Flask_showpaste.py b/var/www/modules/showpaste/Flask_showpaste.py index 20a9afdc..aea0fa08 100644 --- a/var/www/modules/showpaste/Flask_showpaste.py +++ b/var/www/modules/showpaste/Flask_showpaste.py @@ -101,6 +101,12 @@ def showpaste(content_range): def showsavedpaste(): return showpaste(0) +@showsavedpastes.route("/showsavedrawpaste/") #shows raw +def showsavedrawpaste(): + requested_path = request.args.get('paste', '') + paste = Paste.Paste(requested_path) + content = paste.get_p_content() + return content, 200, {'Content-Type': 'text/plain'} @showsavedpastes.route("/showpreviewpaste/") def showpreviewpaste(): diff --git a/var/www/modules/showpaste/templates/show_saved_paste.html b/var/www/modules/showpaste/templates/show_saved_paste.html index f1e609af..b972ef12 100644 --- a/var/www/modules/showpaste/templates/show_saved_paste.html +++ b/var/www/modules/showpaste/templates/show_saved_paste.html @@ -80,6 +80,7 @@ {% endif %}
{{ content }}