mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +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 curr_dico_name, curr_dico_redis in opened_dico:
|
||||||
for hash_type, paste_hash in paste_hashes.items():
|
for hash_type, paste_hash in paste_hashes.items():
|
||||||
for dico_hash in curr_dico_redis.smembers('HASHS_'+hash_type):
|
for dico_hash in curr_dico_redis.smembers('HASHS_'+hash_type):
|
||||||
dico_hash = dico_hash
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if hash_type == 'ssdeep':
|
if hash_type == 'ssdeep':
|
||||||
|
|
|
@ -333,13 +333,11 @@ class Paste(object):
|
||||||
#json save on redis
|
#json save on redis
|
||||||
if json_duplicate is not None:
|
if json_duplicate is not None:
|
||||||
list_duplicate = (json.loads(json_duplicate))
|
list_duplicate = (json.loads(json_duplicate))
|
||||||
# avoid duplicate
|
# avoid duplicate, a paste can be send by multiples modules
|
||||||
list_duplicate = set(tuple(row) for row in list_duplicate)
|
to_add = [hash_type, self.p_path, percent, date]
|
||||||
list_duplicate = [list(item) for item in set(tuple(row) for row in list_duplicate)]
|
if to_add not in list_duplicate:
|
||||||
|
list_duplicate.append(to_add)
|
||||||
# add new duplicate
|
self.store.hset(path, attr_name, json.dumps(list_duplicate))
|
||||||
list_duplicate.append([hash_type, self.p_path, percent, date])
|
|
||||||
self.store.hset(path, attr_name, json.dumps(list_duplicate))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# create the new list
|
# create the new list
|
||||||
|
|
|
@ -101,6 +101,12 @@ def showpaste(content_range):
|
||||||
def showsavedpaste():
|
def showsavedpaste():
|
||||||
return showpaste(0)
|
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/")
|
@showsavedpastes.route("/showpreviewpaste/")
|
||||||
def showpreviewpaste():
|
def showpreviewpaste():
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h3> Content: </h3>
|
<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>
|
<p data-initsize="{{ initsize }}"> <pre id="paste-holder">{{ content }}</pre></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue