Oto moj kod:
#!/usr/bin/python
import urllib2
import urllib
import threading
import Queue
threads= 5
target_url= "http://test.php.vulnweb.com"
wordlist_file= "all.txt"
resume= None
user_agent= "Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0"
def build_wordlist(wordlist_file):
#Wczytuje liste slow
fd= open(wordlist_file,"rb")
raw_words= fd.readlines()
fd.close()
found_resume= False
words= Queue.Queue()
for word in raw_words:
word= word.rstrip()
if resume is not None:
if found_resume:
words.put(word)
else:
if word==resume:
found_resume= True
print"Wznawianie procesu od: %s" % resume
else:
words.put(word)
return words
def dir_bruter(extensions = None):
while not word_queue.empty():
attempt= word_queue.get()
attempt_list= []
#Sprawdzenie czy jest rozszerzenie pliku
#Jego brak oznacza katlaog
if "." not in attempt:
attempt_list.append("/%s/" % attempt)
else:
attempt_list.append("/%s/" % attempt)
#Jesli chcemy testowac rozszerzenia
if extensions:
for extension in extensions:
attempt_list.append("/%s%s" % (attempt,extension))
#Iteruje przez liczbe oson
for brute in attempt_list:
url= "%s%s" % (target_url,urllib.quote(brute))
try:
headers= {}
headers["User-Agent"]= user_agent
r= urllib2.Request(url,headers= headers)
response= urllib2.urlopen(r)
if len(response.read()):
print"[%d] => %s" % (response.code, url)
except ullib2.URLERROR, e:
if hasattr(e, 'code') and e.code != 404:
print"!!! %d => %s" % (e.code, url)
pass
word_queue= build_wordlist(wordlist_file)
extensions= [".php",".bak",".orig",".inc"]
for i in range(threads):
t= threading.Thread(target=dir_bruter, args=(word_queue, extensions,))
t.start()
gdy go odpale wywala:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: dir_bruter() takes at most 1 argument (2 given)
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: dir_bruter() takes at most 1 argument (2 given)
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: dir_bruter() takes at most 1 argument (2 given)
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: dir_bruter() takes at most 1 argument (2 given)
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: dir_bruter() takes at most 1 argument (2 given)
moglby ktos powiedziec jak to naprawic aby dzialal poprawnie? Widze blad, ze bierze 1 arg a sa 2 ale chcialbym prosic o rade jak to zrobic aby zadzialal (co poprawic) .