chg: [hashDecoded] add option to display decoded files, fix #271

This commit is contained in:
Terrtia 2018-12-21 15:18:07 +01:00
parent 306815a31d
commit e93a0b637c
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 29 additions and 15 deletions

View file

@ -101,7 +101,8 @@ def all_hash_search():
date_to = request.form.get('date_to') date_to = request.form.get('date_to')
type = request.form.get('type') type = request.form.get('type')
encoding = request.form.get('encoding') encoding = request.form.get('encoding')
return redirect(url_for('hashDecoded.hashDecoded_page', date_from=date_from, date_to=date_to, type=type, encoding=encoding)) show_decoded_files = request.form.get('show_decoded_files')
return redirect(url_for('hashDecoded.hashDecoded_page', date_from=date_from, date_to=date_to, type=type, encoding=encoding, show_decoded_files=show_decoded_files))
@hashDecoded.route("/hashDecoded/", methods=['GET']) @hashDecoded.route("/hashDecoded/", methods=['GET'])
def hashDecoded_page(): def hashDecoded_page():
@ -109,6 +110,8 @@ def hashDecoded_page():
date_to = request.args.get('date_to') date_to = request.args.get('date_to')
type = request.args.get('type') type = request.args.get('type')
encoding = request.args.get('encoding') encoding = request.args.get('encoding')
show_decoded_files = request.args.get('show_decoded_files')
print(show_decoded_files)
if type == 'All types': if type == 'All types':
type = None type = None
@ -161,14 +164,16 @@ def hashDecoded_page():
daily_date = None daily_date = None
l_64 = set() l_64 = set()
for date in date_range: if show_decoded_files:
if encoding is None: show_decoded_files = True
l_hash = r_serv_metadata.zrange('hash_date:' +date, 0, -1) for date in date_range:
else: if encoding is None:
l_hash = r_serv_metadata.zrange(encoding+'_date:' +date, 0, -1) l_hash = r_serv_metadata.zrange('hash_date:' +date, 0, -1)
if l_hash: else:
for hash in l_hash: l_hash = r_serv_metadata.zrange(encoding+'_date:' +date, 0, -1)
l_64.add(hash) if l_hash:
for hash in l_hash:
l_64.add(hash)
num_day_sparkline = 6 num_day_sparkline = 6
date_range_sparkline = get_date_range(num_day_sparkline) date_range_sparkline = get_date_range(num_day_sparkline)
@ -214,7 +219,7 @@ def hashDecoded_page():
l_type = r_serv_metadata.smembers('hash_all_type') l_type = r_serv_metadata.smembers('hash_all_type')
return render_template("hashDecoded.html", l_64=b64_metadata, vt_enabled=vt_enabled, l_type=l_type, type=type, daily_type_chart=daily_type_chart, daily_date=daily_date, return render_template("hashDecoded.html", l_64=b64_metadata, vt_enabled=vt_enabled, l_type=l_type, type=type, daily_type_chart=daily_type_chart, daily_date=daily_date,
encoding=encoding, all_encoding=all_encoding, date_from=date_from, date_to=date_to) encoding=encoding, all_encoding=all_encoding, date_from=date_from, date_to=date_to, show_decoded_files=show_decoded_files)
@hashDecoded.route('/hashDecoded/hash_by_type') @hashDecoded.route('/hashDecoded/hash_by_type')
def hash_by_type(): def hash_by_type():

View file

@ -121,7 +121,14 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>
<br> <div class="checkbox">
<label>
<input type="checkbox" name="show_decoded_files" value="True" {% if show_decoded_files %}checked{% endif %}>
<div style="color:#286090; display:inline-block">
Show decoded files <i class="fa fa-file"></i>
</div>
</label>
</div>
<button class="btn btn-primary" style="text-align:center;"> <button class="btn btn-primary" style="text-align:center;">
<i class="fa fa-files-o"></i> Search <i class="fa fa-files-o"></i> Search
</button> </button>
@ -189,10 +196,12 @@
</tbody> </tbody>
</table> </table>
{% else %} {% else %}
{% if date_from|string == date_to|string %} {% if show_decoded_files %}
<h3> {{ date_from }}, No Hashes</h3> {% if date_from|string == date_to|string %}
{% else %} <h3> {{ date_from }}, No Hashes</h3>
<h3> {{ date_from }} to {{ date_to }}, No Hashes</h3> {% else %}
<h3> {{ date_from }} to {{ date_to }}, No Hashes</h3>
{% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>