【发布时间】:2016-02-01 02:10:14
【问题描述】:
我已经在业余时间学习 Python 了一小段时间,我给自己设定了一个挑战,为一项非常具体的任务构建密码破解程序,它是测试我的 ADSL 路由器的安全性有多有效(不是很) - 使用 Wireshark 我可以很清楚地看到它是如何通过 http 散列密码的,我开发了一些代码来执行 wordlist 攻击。 (如果您认为我的代码写得不好,我深表歉意——您可能是对的!)。
#!/usr/bin/env python
import hashlib, os, time, math
from hashlib import md5
def screen_clear():
if os.name == 'nt':
return os.system('cls')
else:
return os.system('clear')
screen_clear()
print ""
print "Welcome to the Technicolor md5 cracker"
print ""
user = raw_input("Username: ")
print ""
nonce = raw_input("Nonce: ")
print ""
hash = raw_input("Hash: ")
print ""
file = raw_input("Wordlist: ")
print ""
realm = "Technicolor Gateway"
qop = "auth"
uri = "/login.lp"
HA2 = md5("GET" + ":" + uri).hexdigest()
wordlist = open(file, 'r')
time1 = time.time()
for word in wordlist:
pwd = word.replace("\n","")
HA1 = md5(user + ":" + realm + ":" + pwd).hexdigest()
hidepw = md5(HA1 + ":" + nonce +":" + "00000001" + ":" + "xyz" + ":" + qop + ":" + HA2).hexdigest()
if hidepw == hash:
screen_clear()
time2 = time.time()
timetotal = math.ceil(time2 - time1)
print pwd + " = " + hidepw + " (in " + str(timetotal) + " seconds)"
print ""
end = raw_input("hit enter to exit")
exit()
wordlist.close()
screen_clear()
time2 = time.time()
totaltime = math.ceil(time2 - time1)
print "Sorry, out of " + str(tested) + " passwords tested, your password was not found (in " + str(totaltime) + " seconds)"
print ""
end = raw_input("hit enter to exit")
screen_clear()
exit()
这很好用,但让我想要更多,所以我想我可以为其添加一些多处理功能以加快速度 - 使用各种不同的说明和指南,我未能最终获得成功的结果! (虽然感觉我很亲近)
请有人将我指向“多核 python 密码破解的白痴指南”或帮助我修改我的代码以适应。
附:我最初的计划是使用 opencl 或 cuda ......但我很快就知道我是多么的超出我的深度!
【问题讨论】:
标签: python multithreading passwords multicore cracking