Advertisement
shutdown57

WebKelon-ing

Jul 23rd, 2022
1,518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.22 KB | None | 0 0
  1. #!/usr/bin/env php
  2. __        __   _     _  __    _            
  3. \ \      / /__| |__ | |/ /___| | ___  _ __  
  4.  \ \ /\ / / _ \ '_ \| ' // _ \ |/ _ \| '_ \
  5.   \ V  V /  __/ |_) | . \  __/ | (_) | | | |
  6.    \_/\_/ \___|_.__/|_|\_\___|_|\___/|_| |_|
  7.                                            
  8.  
  9. <?php
  10. function cli_color($text, $color) {
  11.     $colors = array(
  12.         'black' => '0;30',
  13.         'dark_gray' => '1;30',
  14.         'blue' => '0;34',
  15.         'light_blue' => '1;34',
  16.         'green' => '0;32',
  17.         'light_green' => '1;32',
  18.         'cyan' => '0;36',
  19.         'light_cyan' => '1;36',
  20.         'red' => '0;31',
  21.         'light_red' => '1;31',
  22.         'purple' => '0;35',
  23.         'light_purple' => '1;35',
  24.         'brown' => '0;33',
  25.         'yellow' => '1;33',
  26.         'light_gray' => '0;37',
  27.         'white' => '1;37',
  28.     );
  29.     return "\033[" . $colors[$color] . "m" . $text . "\033[0m";
  30. }
  31.  
  32. echo "[!] Input URL Lists > "; $lists = trim(fgets(STDIN));
  33. $SCAN = explode("\n" , str_replace("\r","",file_get_contents($lists)));
  34. foreach($SCAN as $file)
  35. {
  36.     echo "======================================================================\n";
  37.     echo "[!] Scanning ".cli_color($file,'green')." ...\n";
  38.     $tmp = file_get_contents($file);
  39.     if(preg_match("/<title>(.*)<\/title>/i" , $tmp , $title))
  40.     {
  41.         echo cli_color("[!] Title : ".$title[1]."\n","yellow");
  42.         file_put_contents($title[1].".html" , $tmp);
  43.         $filename = $title[1].".html";
  44.     }
  45.    
  46.     echo cli_color("[####] PROCESS $file \n","blue");
  47.     sleep(2);
  48. $file = file_get_contents($filename);
  49.  
  50. preg_match_all('/(href|src)\s*=\s*"([^\s]+\/\/[^\/]+.\/[^\s]+\.(jpg|jpeg|png|gif|bmp|css|js))/ixu' , $file,$match);
  51.  
  52. $asset = $match[2];
  53. $asset = array_unique($asset);
  54. foreach($asset as $ass)
  55. {
  56.     $folder = str_replace(['http://','https://' , basename($ass)],'',$ass);
  57.     echo "[!] Making folder : ".cli_color($folder,"yellow");
  58.     if(!is_dir($folder))
  59.     {
  60.         @mkdir($folder,0777,true);
  61.         echo cli_color(" OK \n","green");
  62.     }else{
  63.         echo cli_color(" EXISTS \n","red");
  64.     }
  65.     echo "[+] Save output $ass ";
  66.     $ff = @file_get_contents($ass);
  67.     file_put_contents($folder.'/'.basename($ass),$ff);
  68.     echo " OK \n";
  69.  
  70. }
  71.     file_put_contents($filename , str_replace(['http://' , 'https://'],'./' , $file));
  72. echo "======================================================================\n";
  73. sleep(1);
  74. }
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement