Page MenuHomec4science

ex2c.py
No OneTemporary

File Metadata

Created
Mon, Feb 24, 04:09
import hashlib
import itertools
import copy
password_hashes = ["9d53174826fb7530fe7137a4987ec00e5cf3b3e9166c5e26563070e4c1992233",
"e93e89c01bb2cc262f45e54e4148146927b94760810cb51f54765ee6e1d8700e",
"29dd25f393f248f8ef6af74ed42ecdb97c65723856a2201add6effb0ff4174d3",
"6380303bd2f7ae12ff43c3c49de574e12999e4b615a6dc0f5fc89421d3fd6fb8",
"dcee8fb2b8e6d488d0e12cfa58c3c1f9aec3d835fc24384ea620e9d6eceeb3da",
"34acc052b26f2d9a0e40bf77f16a4e74a12d6cdd3cf9bcbb94707c3d24cf229d",
"760e3f33ff61eeba44911e54f0109d3facb1e4ed7bb5c9417c390bafcc2a6954",
"7ecc4a6141bf2bf2b903ff27b51a35ba0ea9d7749c31476a2a6c8e6e144c2dea",
"8af536964fd5a1ad6b82149a095a3bb56c879348099522dde05589e210d4d154",
"04c81b85e84747d641914151c835c8740d2b2e40c27add22d9fa5d0b4291f4c1"]
salts = ["9c", "62", "5a", "58", "0c", "c7", "19", "57", "9f", "1a"]
def sha256_hex(text):
return hashlib.sha256(text).hexdigest()
#add all possible salts
def word_salting(word):
return [word + salt for salt in salts]
def find():
wordlist = open('rockyou.txt', 'r',encoding='latin-1')
results=[]
for word in wordlist:
word_raw = word.rstrip()
#check if all characters alphanumeric
if not word_raw.isalnum():
continue
#create all possible salted words
salted_words = word_salting(word_raw)
for salted_word in salted_words:
word_hash = sha256_hex(salted_word.encode('utf-8'))
#check if right hash
if word_hash in password_hashes:
if word not in results:
results.append(word)
print(word)
if len(results)==10:
break
if len(results)==10:
break
return results
def main():
find()
if __name__ == "__main__":
main()

Event Timeline