Guest User

Untitled

a guest
Aug 4th, 2016
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. <?php
  2. // defines
  3. $charset = Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0','-','_');
  4. $wordlist = Array();
  5. $param_file = './params.txt';
  6. $separator = '_';
  7. $words = Array();
  8. $maxlen = $_GET['length'];
  9. $def_length=0;
  10. $site = $_GET['url'];
  11. $count = 0;
  12. $type = $_GET['type'];
  13. $symbol = $_GET['sym'];
  14. $arr = $_GET['arr'];
  15. $max_len_of_url=2048;
  16. $proxy = 'http://127.0.0.1:8080';
  17. $headers[] = 'User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)';
  18. //$headers[] = 'Authorization: Basic QXZndXI6Q29tcDI0Mg==';
  19.  
  20. function getlen($site_check)
  21. {
  22. global $proxy,$headers;
  23. $ch = curl_init();
  24. curl_setopt($ch, CURLOPT_URL,$site_check);
  25. curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
  26. curl_setopt($ch, CURLOPT_FAILONERROR, 0);
  27. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  29. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  30. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  31. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  32. $length = strlen(curl_exec($ch));
  33. curl_close($ch);
  34. return $length;
  35. }
  36.  
  37. function check($site_check,$from,$to)
  38. {
  39. global $def_length,
  40. $words,$site,$symbol,$content,$arr;
  41. $curr_len = getlen($site_check);
  42. if ($curr_len<>$def_length)
  43. {
  44. echo '<b>[+] Find <a href='.$site_check.'>smth</a> Try to detect.</b><br>';
  45. flush();
  46. $site_1 = $site;
  47. $site_2 = $site;
  48.  
  49. if ($to-1-$from > 0)
  50. {
  51. for ($i=$from;$i<=$to-1;$i++)
  52. {
  53. if ($i<=$from+(($to-$from)/2) - 1)
  54. {$site_1 .= $words[$i].'='.$symbol.'&';}
  55. else
  56. {$site_2 .= $words[$i].'='.$symbol.'&';}
  57. }
  58. check($site_1 ,$from,(int)($from+(($to-$from)/2)));
  59. check($site_2 ,(int)($from+(($to-$from)/2)),$to);
  60. flush();
  61. }
  62. else
  63. {
  64. echo '<b>[+] Find! <a href='.$site_check.'>'.$site_check.'</a></b><br>';
  65. }
  66. }
  67. }
  68.  
  69.  
  70. function recurse($width, $position, $base_string)
  71. {
  72. global $charset,$site_new,$site,$words,$count, $values,$type,$separator,$wordlist,$symbol,$max_len_of_url,$arr;
  73.  
  74. for ($i = 0; $i < count($charset); ++$i)
  75. {
  76. // anee aeeia niiauaiey iaiuoa o?aaoaiie - aa?ai neiaie e ?aeo?neaii aucuaaai naie naay
  77. if ($position < $width - 1)
  78. {
  79. recurse($width, $position + 1, $base_string . $charset[$i]);
  80. }
  81. // eiaaa ?aeo?neaiua auciau caeai?eaa?ony, aica?auaainy ia oaa iacaa ii ?eneo neiaieia e auaiaei
  82. if (!in_array($base_string.$charset[$i],$values))
  83. {
  84. $words[$count] = $base_string.$charset[$i].(($arr==1)?'[]':'');
  85. $count++;
  86. $site_new .= $base_string . $charset[$i].(($arr==1)?'[]':'').'='.$symbol.'&';
  87. }
  88.  
  89. if ((strlen($site_new)+strlen($base_string)+4)>$max_len_of_url)
  90. {
  91. check($site_new,0,$count);$site_new = $site;$count = 0;
  92. }
  93. }
  94. if (($position == 0) && ($site_new != $site))
  95. {check($site_new,0,$count);}
  96. }
  97.  
  98. if (empty($_GET['url']) || empty($_GET['length']) || empty($_GET['type']) || empty($_GET['sym']))
  99. {
  100. echo '<b>[+] Use http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?url=&lt;url&gt;&type=&lt;type of attack&gt;&length=&lt;max len&gt;&sym=&lt;parameter value&gt;<br> </b>
  101. <b> url examples:</b> <br/> http://site.com/index.php <br/> http://site.com/index.php?param=123 <br/> http://site.com/index.php?param=123%26param2=q <br/>
  102. <b> types of attack:<br/> </b>
  103. 1 - only bruteforce<br/>
  104. 2 - only wordlist<br/>
  105. 3 - word+separator+brute values<br/>
  106. &arr=1 - try [] postfix values<br/>
  107. </b>';
  108. exit;
  109. }
  110.  
  111. if (strpos($site,'?')>0)
  112. {$site=$site.'&';}
  113. else
  114. {$site=$site.'?';}
  115. $site_new = $site;
  116. // iaeaai ana ia?aiao?u
  117. preg_match_all("/[\?&]?([^&?=]+)=([a-zA-Z0-9\-_\.%]+)&/",
  118. $site,
  119. $out, PREG_PATTERN_ORDER);
  120. $values = $out[1];
  121.  
  122. echo '<b>[+] Analyze <a href='.$site.'>'.$site.'</a></b><br>';
  123. flush();
  124.  
  125. if ($type >=2)
  126. {
  127. $file = fopen($param_file,"r");
  128. if(!file)
  129. {
  130. echo("<b>[+] Error: wordlist not exists - ".$param_file.'</b></br>');
  131. }
  132. else
  133. {
  134. while ($wordlist[] = trim(fgets($file)))
  135. {}
  136. unset ($wordlist[count($wordlist)-1]);
  137. echo "<b>[+] Wordlist loaded...".count($wordlist)." words.</b><br/>";
  138. }
  139.  
  140. }
  141. // ii?aaaeei aaoieoiua cia?aiey
  142. $def_length = getlen($site);
  143. switch ($type) {
  144. case 1:
  145. recurse($maxlen, 0, '');
  146. break;
  147. case 2:
  148. unset($charset);
  149. $charset[] = '';
  150. for ($j = 0; $j < count($wordlist);$j++)
  151. {
  152. if (!in_array($wordlist[$j],$values))
  153. {
  154. $words[$count] = $wordlist[$j].(($arr==1)?'[]':'');
  155. $count++;
  156. $site_new .= $wordlist[$j].(($arr==1)?'[]':'').'='.$symbol.'&';
  157. }
  158.  
  159. if ((strlen($site_new)+strlen($base_string)+4)>2048)
  160. {
  161. check($site_new,0,$count);$site_new = $site;$count = 0;
  162. }
  163. }
  164. if ($site_new != $site)
  165. {check($site_new,0,$count);}
  166.  
  167. break;
  168. case 3:
  169. if (!in_array('',$charset))
  170. {$charset[count($charset)]='';}
  171. for ($j = 0; $j < count($wordlist);$j++)
  172. {recurse($maxlen, 0, $wordlist[$j].$separator);}
  173. break;
  174. }
  175.  
  176.  
  177. echo '<b>[+] Done</b><br>';
  178.  
  179. ?>
Advertisement
Add Comment
Please, Sign In to add comment