mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-27 00:07:16 +00:00
fix duplicate + get raw paste
This commit is contained in:
parent
d7ba5533be
commit
225fe76c96
4 changed files with 12 additions and 8 deletions
|
@ -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':
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
</table>
|
||||
{% endif %}
|
||||
<h3> Content: </h3>
|
||||
<a href="{{ url_for('showsavedpastes.showsavedrawpaste') }}?paste={{ request.args.get('paste') }}" id='raw_paste' > [Raw content] </a>
|
||||
<p data-initsize="{{ initsize }}"> <pre id="paste-holder">{{ content }}</pre></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue