pool = Pool(processes=10)
########################################################################
class path(threading.Thread):
""""""
#----------------------------------------------------------------------
def __init__(self, name, q):
"""Constructor"""
threading.Thread.__init__(self, name = name)
self.data = q
#----------------------------------------------------------------------
def run(self):
""""""
with open('dict/yujian.txt') as f:
path_list = f.readlines()
for i in path_list:
i = i.strip('\r').strip('\n')
self.data.put(i)
print self.data.get()
########################################################################
class conn(threading.Thread):
""""""
#----------------------------------------------------------------------
def __init__(self, name, q):
"""Constructor"""
threading.Thread.__init__(self, name = name)
self.data = q
#----------------------------------------------------------------------
def run(self):
""""""
path = self.data.get()
#print self.data.qsize()
self.data.task_done()
print path
#try:
#req = get_request(name + path)
#if str(req.status_code).startswith('4'):
#pass
#else:
#print i
#print '[+] ' + str(req.status_code) +' ' + name + path + '----Success!'
#print path_list.index(i)
#except Exception,e:
#print str(e)
#pass
#----------------------------------------------------------------------
def get_path():
""""""
q = queue.Queue()
pro = path('1', q)
con = conn('http://www.jianshu.com', q)
pro.start()
con.start()
pro.join()
con.join()
t2 = datetime.datetime.now()
#get_path()
print t2 - t1
#----------------------------------------------------------------------
def path_brute(url):
""""""
with open('dict/yujian.txt') as f:
path_list = f.readlines()
for i in path_list:
i = i.strip('\r').strip('\n')
if i.startswith('/'):
try:
print i
req = get_request(url + i)
if str(req.status_code).startswith('4'):
pass
else:
#print i
print '[+] ' + str(req.status_code) +' ' + url + i + '----Success!'
#print path_list.index(i)
except Exception,e:
print str(e)
pass
#req = get_request('http://www.jianshu.com' + '/robots.txt')
#print req.status_code
#print type(req.status_code)
import queue
q = queue.Queue()
#----------------------------------------------------------------------
def test():
""""""
for i in xrange(50):
t = threading.Thread(target=path_brute('http://jianshu.com'))
t.setDaemon(True)
thread_list.append(t)
for k in thread_list:
t.start()
for k in thread_list:
t.join()
#test()
path_brute('http://www.jianshu.com')
t2 = datetime.datetime.now()
print t1
print t2
print t2 - t1
记录
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 成长记录-连载(三十六) ——我的第一篇五千字长文,说了什么,你一定想不到 并不是不想每天写公众号,而是之前思考怎...
- 前日,钉钉Tower“任务应用”首次开放,1000家企业试用名额,6分钟被抢光! 昨日,钉钉蓝凌“考勤应用”首次开...