многопоточный сканер хидеров

Тема в разделе "Сканеры|:|Брут", создана пользователем specialk, 2 сен 2012.

  1. specialk
    specialk Новичок
    Симпатии:
    1
    привет, ищу многпоточный сканнер хидеров на 200, 404, 302 и тд тп
    идеальным вариантом были бы сорцы на асме(вин) или питоне3
    но любые варианты приветствуются
     
    2 сен 2012
  2. specialk
    specialk Новичок
    Симпатии:
    1
    ничего не нашел навскидку, наваял за полчаса многопоточный сканер на питоне, мож кому пригодится
    Код:
    #!/usr/bin/python3
    
    
    import threading, sys, time, _thread, http.client
    
    
    max_threads=50
    
    
    
    def banner():
     print ("This is Threader - the multithread header GET scanner in python3\n ver 0.2b 02.09.2012 by specialkey, no rights reserved")
     print ("Usage: %s" % sys.argv[0], "list_of_urls.txt")
     return 1
    
    
    class MThread(threading.Thread):
    	def run(self):
    #		print ('ok this is url %s' % self.url, end="\n")
    		url=self.url.replace('http://','')
    
    #defining some vars....
    
    		domain	= ""
    		path	= ""
    		u_c	= 0
    
    #separate domain from url....
    
    		for x in url:
    			if x=='/':
    				u_c=1
    			if u_c==0:
    				domain=domain+x
    			if u_c==1:
    				path=path+x
    
    # finally, make the connection....
    		conn=http.client.HTTPConnection(domain.strip())
    		conn.request('GET', path.strip())
    		r=conn.getresponse()
    		if r.status == 200:
    			lines_of_url=r.readlines()
    			print ("[+] Found!!! %s" % url)
    			print ("[~] The size of page is %s" % len(lines_of_url))
    			if len(lines_of_url)==0:
    				print ("[+] Ok, this seems to be valid output for plugin.... %s" % url)
    #			for line in lines_of_url:
    #				print (line)
    		elif r.status == 404:
    			
    #			print ("[-] Not Found.... %s" %domain)
    			time.sleep(.01)
    
    		else:
    			print ("[?] The code is %s" % r.status)	
    			
    		conn.close()
    
    
    def getargs(fname):
     try:
      f=open(fname,'r')
      lines=f.readlines()
      f.close()
      return lines 
     except:
      print ("The opening has failed\n");
      sys.exit(1)
    
    
    
    
    
    def main():
    # argv checks
     if len(sys.argv)<1:
      banner()
      sys.exit(1)
     try:
    # try to get lines from file
      all_urls=getargs(str(sys.argv[1]).strip())
      print ("[~] ok got urls from file, total count",int(len(all_urls)))
      if int(len(all_urls))==0:
       print ("file is empty, c'mon!\n")
       sys.exit(1)
    
     
      j=0 
    
    # null the thread counter
    # staring the threads
       
    
    
    
      while j!=len(all_urls):
     
       for i in range(max_threads-threading.active_count()):
        th=MThread()
        th.url=str(all_urls[j]).strip()
        th.start()
        j=j+1
       time.sleep(.5)
    
    
    
     except:
      return 0
    
    
    
    
    banner()
    main()
    
    
     
    4 сен 2012
Загрузка...