最簡單的PHP小偷源碼

來源:互聯網
上載者:User
各位這隻是簡單的小偷程式,大家學習一下就好,不要做非法用途哈!!

不懂或者不會的請回複
  1. //-------------------------配置參數開始-------------------------
  2. //目標站網址
  3. $url="http://blog.0907.org";
  4. //當前檔案名稱
  5. $thisname='index.php';
  6. //-------------------------配置參數結束-------------------------
  7. header("Content-type: text/html; charset=GBK");
  8. $server_url = preg_replace("/(http|https|ftp|news):\/\//i", "", $url);
  9. $server_url = preg_replace("/\/.*/", "", $server_url);
  10. $server_url = 'http://'.$server_url;
  11. $getid=$_SERVER["REQUEST_URI"];
  12. $scriptname=$_SERVER["SCRIPT_NAME"];
  13. $thisurl="http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  14. if( preg_match('#(http|https|ftp|news):#iUs',$getid) ){
  15. header("Location:".$scriptname);
  16. exit;
  17. }
  18. if( preg_match('#'.$scriptname.'\/#iUs',$getid) ){
  19. $url=$server_url.'/'.str_ireplace($scriptname."/",'',stristr($getid,$scriptname."/"));
  20. }
  21. $thismulu=str_ireplace(stristr($_SERVER['PHP_SELF'],$thisname),'',$thisurl);
  22. function curl_get($url){
  23. if(function_exists('curl_init') && function_exists('curl_exec')){
  24. $ch = curl_init();
  25. $user_agent = "Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)";
  26. curl_setopt($ch, CURLOPT_URL, $url);
  27. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  29. curl_setopt($ch, CURLOPT_REFERER, "http://www.baidu.com/s?wd=%CA%B2%C3%B4");
  30. curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  31. $data = curl_exec($ch);
  32. curl_close($ch);
  33. }else{
  34. for($i=0;$i<3;$i++){
  35. $data = @file_get_contents($url);
  36. if($data) break;
  37. }
  38. }
  39. return $data;
  40. }
  41. function filter($str){
  42. global $server_url;
  43. $str=preg_replace("/]+>/si","",$str);
  44. $str=preg_replace("/\s+/", " ", $str);
  45. $str=preg_replace("/<\!--.*?-->/si","",$str);
  46. $str=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$str);
  47. $str=preg_replace("/<(\/?script.*?)>/si","",$str);
  48. $str=preg_replace("/javascript/si","Javascript",$str);
  49. $str=preg_replace("/vbscript/si","Vbscript",$str);
  50. $str=preg_replace("/on([a-z]+)\s*=/si","On\\1=",$str);
  51. return $str;
  52. }
  53. function urlchange($str) {
  54. global $server_url,$scriptname,$thismulu;
  55. $str = preg_replace('/src=(["|\']?)\//', 'src=\\1'.$server_url.'/', $str);
  56. $str = preg_replace('/<(link[^>]+)href=(["|\']?)\/?/', '<\\1href=\\2'.$server_url.'/', $str);
  57. $str = preg_replace('/<(a[^>]+)href=(["|\']?)\/?/', '<\\1href=\\2'.$scriptname.'/', $str);
  58. $str=str_ireplace('/javascript:;','#',$str);
  59. $str=str_ireplace('"'.$scriptname.'/"',$scriptname,$str);
  60. return $str;
  61. }
  62. function charset($str){
  63. if(preg_match('#]*charset\s*=\s*utf-8#iUs',$str)){
  64. $str=preg_replace('/charset\s*=\s*utf-8/i','charset=gb2312',$str);
  65. $str=iconv("UTF-8", "GB2312//IGNORE", $str);
  66. }
  67. return $str;
  68. }
  69. $body=urlchange(filter(charset(curl_get($url))));
  70. //-------------替換開始----------------------
  71. $body=preg_replace('#>精品推薦(.*)

    " #si',"",$body);

  72. //正則替換,這裡我就不多說啦,PS:其實我也不大會正則
  73. //PS:可寫多個
  74. $body=str_ireplace('action="/v"','action="index.php/v"',$body);
  75. //$body=str_ireplace('您要替換的內容','你想替換成的內容',$body);
  76. //PS:可寫多個
  77. //嘻嘻,歡迎大家去我部落格做客
  78. //------------替換結束------------------------
  79. echo $body;
  80. ?>
複製代碼
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.