Skip to content

Commit b8da230

Browse files
committed
Only show interactive options and infos when enabled and used
1 parent cade806 commit b8da230

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

web/submission/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ def index(request, task_id=None, resubmit_hash=None):
653653
enabledconf["pre_script"] = web_conf.pre_script.enabled
654654
enabledconf["during_script"] = web_conf.during_script.enabled
655655
enabledconf["downloading_service"] = bool(downloader_services.downloaders)
656+
enabledconf["interactive_desktop"] = web_conf.guacamole.enabled
656657

657658
all_vms_tags = load_vms_tags()
658659

@@ -775,7 +776,7 @@ def status(request, task_id):
775776
"session_data": "",
776777
"target": task.sample.sha256 if getattr(task, "sample") else task.target,
777778
}
778-
if settings.REMOTE_SESSION:
779+
if web_conf.guacamole.enabled and "interactive=1" in task.options:
779780
machine = db.view_machine_by_label(task.machine)
780781
if machine:
781782
guest_ip = machine.ip

web/templates/submission/index.html

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,16 +674,18 @@
674674
<input type="checkbox" name="nohuman" /> Disable automated interaction
675675
</label>
676676
</div>
677+
{% if config.interactive_desktop %}
677678
<div class="form-check">
678679
<label>
679-
<input type="checkbox" name="interactive" /> Interactive desktop
680+
<input type="checkbox" id="interactive" name="interactive" /> Interactive desktop
680681
</label>
681682
</div>
682683
<div class="form-check">
683684
<label>
684-
<input type="checkbox" name="manual" /> Manual detonation. Must be used with Interactive desktop
685+
<input type="checkbox" id="manual" name="manual" disabled /> Manual detonation <span class="text-muted"><small>(Must be used with Interactive desktop!)</small></span>
685686
</label>
686687
</div>
688+
{% endif %}
687689
{% if config.kernel %}
688690
<div class="form-check">
689691
<label>
@@ -711,4 +713,26 @@
711713
</form>
712714
</div>
713715
</div>
716+
<script>
717+
document.addEventListener("DOMContentLoaded", function() {
718+
const interactive = document.getElementById("interactive");
719+
const manual = document.getElementById("manual");
720+
721+
if (interactive && manual) {
722+
// sync initial state
723+
manual.disabled = !interactive.checked;
724+
if (!interactive.checked) {
725+
manual.checked = false;
726+
}
727+
728+
// toggle on change
729+
interactive.addEventListener("change", function() {
730+
manual.disabled = !this.checked;
731+
if (!this.checked) {
732+
manual.checked = false;
733+
}
734+
});
735+
}
736+
});
737+
</script>
714738
{% endblock %}

web/templates/submission/status.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ <h4>Status for task {{task_id}} - {{ target }}</h4>
1515
<p>The analysis is not finished yet, it's still <b>{{status}}</b>. This page will refresh every 30 seconds.</p>
1616
{% if session_data %}
1717
<p>To view the Remote Session - click <a href='javascript:window.open(window.location.origin + "/guac/{{task_id}}/{{session_data}}", "_blank");'>here.</a></p>
18-
<div class="progress progress-striped active" style="margin-top: 10px;">
19-
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:100%"></div>
20-
</div>
2118
{% endif %}
19+
<div class="progress progress-striped active" style="margin-top: 10px;">
20+
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:100%"></div>
21+
</div>
2222
</div>
2323
{% endif %}
2424
{% endblock %}

0 commit comments

Comments
 (0)