Skip to content

Commit

Permalink
start separate summary page
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiestephenson committed Mar 15, 2023
1 parent 97380f5 commit 6357f5a
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 21 deletions.
57 changes: 49 additions & 8 deletions templates/evidence.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>Device information</h2>
What type of device is this?
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for a in ["Android", "iOS"] %}
<label class="btn btn-outline-secondary {% if device==a.lower() %} active {% endif %}">
<label class="btn btn-outline-secondary">
<input type="radio" name="device" id="{{ a | lower }}"
value="{{ a| lower }}" autocomplete="off"
{% if device==a.lower() %} checked {% endif %}
Expand Down Expand Up @@ -72,18 +72,56 @@ <h2>Scan results for {{device_owner}}'s {{device}} device</h2>
</div>
<br/><br/>
{% endif %}

<form method="POST", action="/evidence/summary">
<input type="hidden" name="dual_use" value={{dual_use_str}} />
<input type="hidden" name="spyware" value={{spyware}} />

{% if spyware %}
<h2>Spyware Apps</h2>
{% for app in spyware %}
<div class="jumbotron">
<h3>{{app["title"]}}</h3>
Did you know this app was installed on your device?
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for a in ["Yes", "No"] %}
<label class="btn btn-outline-secondary">
<input type="radio" name="recognize{{app.title | lower}}" id="{{ a | lower }}"
value="{{ a| lower }}" autocomplete="off">
{{ a }}
</label>
{% endfor %}
</div>
<br/><br/>
Did you install this app?
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for a in ["Yes", "No"] %}
<label class="btn btn-outline-secondary">
<input type="radio" name="installed{{app.title | lower}}" id="{{ a | lower }}"
value="{{ a| lower }}" autocomplete="off">
{{ a }}
</label>
{% endfor %}
</div>
<br/><br/>
If you did not install this app, do you know who did? <textarea name="installer{{app.title | lower}}"></textarea>
<br/>
</div>
<hr/>
{% endfor %}
{% endif %}


{% if dual_use %}
<h2>Dual-Use Apps</h2>
{% for app in dual_use %}
<div class="jumbotron">
<h3>{{app["title"]}}</h3>
<form>
Did you know this app was installed on your device?
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for a in ["Yes", "No"] %}
<label class="btn btn-outline-secondary {% if device==a.lower() %} active {% endif %}">
<input type="radio" name="device" id="{{ a | lower }}"
<label class="btn btn-outline-secondary">
<input type="radio" name="recognize{{app.title | lower}}" id="{{ a | lower }}"
value="{{ a| lower }}" autocomplete="off">
{{ a }}
</label>
Expand All @@ -93,21 +131,24 @@ <h3>{{app["title"]}}</h3>
Did you install this app?
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for a in ["Yes", "No"] %}
<label class="btn btn-outline-secondary {% if device==a.lower() %} active {% endif %}">
<input type="radio" name="device" id="{{ a | lower }}"
<label class="btn btn-outline-secondary">
<input type="radio" name="installed{{app.title | lower}}" id="{{ a | lower }}"
value="{{ a| lower }}" autocomplete="off">
{{ a }}
</label>
{% endfor %}
</div>
<br/><br/>
If you did not install this app, do you know who did? <textarea name="installer"></textarea>
If you did not install this app, do you know who did? <textarea name="installer{{app.title | lower}}"></textarea>
<br/>
</form>
</div>
{% endfor %}

<button type="submit">Submit</button>
</form>
{% endif %}


<br><br>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
{% if task == 'evidence' %}
{% include "evidence.html" %}
{% endif %}
{% if task == 'evidencesummary' %}
{% include "summary.html" %}
{% endif %}
{% if task == 'app' %}
{% include "app.html" %}
{% endif %}
Expand Down
35 changes: 35 additions & 0 deletions templates/summary.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<script>
function get(url){
$('#loadingDiv').show();
$('#msg').html("")
$.get(url, function(data) {
$('#msg').html(data);
$('#loadingDiv').hide();
}).done(function(data) {
}).fail(function(data) {
alert("Failed:" + JSON.serialize(data));
})
}

var loading = $('#loadingDiv').hide();
$(document).ready(function() {
$('#loadingDiv').hide();
});

</script>

<div class="container">
<div>
<h4 class="display-4">Evidence Summary</h4>
<hr/>
<h2>Dual-Use apps</h2>
<div>
<i>Snapchat (hardcoded)</i>
{% for app in app_summaries %}
<div>Recognized: {{app["recognized"]}}</div>
<div>Installed: {{app["installed"]}}</div>
<div>Who installed: {{app["installer"]}}</div>
{% endfor %}
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion web/view/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from .error import get_nothing
from .results import view_results
from .save import record_applist, record_scanres, delete_app
from .evidence import evidence, evidence_apps
from .evidence import evidence, evidence_summary
34 changes: 22 additions & 12 deletions web/view/evidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,28 @@ def evidence():

return render_template('main.html', **context)


@app.route("/evidence/summary", methods=['POST'])
def evidence_summary():

@app.route("/evidence/apps", methods=['GET', 'POST'])
def evidence_apps():
"""
TODO: Get list of apps which ISDi flags as dual-use or spyware
"""

# TODO get input from the user
device = 'ios'
device_owner = 'test'
snapchat = dict(
recognize = request.form["recognizesnapchat"],
installed = request.form["installedsnapchat"],
installer = request.form["installersnapchat"],
)

app_summaries = [snapchat]

context = dict(
task="evidencesummary",
device_primary_user=config.DEVICE_PRIMARY_USER,
title=config.TITLE,
name="Sophie",
dual_use=request.form["dual_use"],
spyware=request.form["spyware"],
app_summaries = app_summaries
)

pprint(context["dual_use"])

app_list = get_suspicious_apps(device, device_owner)

return "Hi"
return render_template('main.html', **context)

0 comments on commit 6357f5a

Please sign in to comment.