if data.find('!mdcrack') != -1:
nick = data.split('!')[ 0 ].replace(':','')
m = hashlib.md5()
hash = ""
hash_file = str(arg[4])
wordlist = arg[5]
try:
wordlistfile = open(wordlist,"r")
except IOError:
sck.send('PRIVMSG ' + chan + " :" 'invalid file' + '\r\n')
else:
pass
for line in wordlistfile:
m = hashlib.md5()
line = line.replace("\n","")
m.update(line)
word_hash = m.hexdigest()
if word_hash==hash_file:
sck.send('PRIVMSG ' + chan + " :" 'Collision! The word corresponding to the given hash is ' + line + '\r\n')
sck.send('PRIVMSG ' + chan + " :" 'The hash given does not correspond to any supplied word in the wordlist' + '\r\n')
このコードは、単語リストの各行をハッシュし、それを指定されたハッシュと比較することによって機能します。
エラーは発生しませんが、ハッシュが見つかると、Collision!
メッセージとメッセージが出力されThe hash given does not correspond to any supplied word in the wordlist
ます。最初はidentの問題だと思っていましたが、今はわかりません。