Skip to content

Instantly share code, notes, and snippets.

@SakiiR
Last active November 1, 2018 18:59
Show Gist options
  • Save SakiiR/fc93a89652528fcb4b463aaac3a76897 to your computer and use it in GitHub Desktop.
Save SakiiR/fc93a89652528fcb4b463aaac3a76897 to your computer and use it in GitHub Desktop.
Workshop Secu 3 - Crackme 2
#!/usr/bin/env python
# coding: utf-8
import sys
import hashlib
FLAG = [
"800618943025315f869e4e1f09471012",
"d20caec3b48a1eef164cb4ca81ba2587",
"7fc56270e7a70fa81a5935b72eacbe29",
"dfcf28d0734569a6a693bc8194de62bf",
"f95b70fdc3088560732a5ac135644506",
"b9ece18c950afbfa6b0fdbfa4ff731d3",
"e1671797c52e15f763380b45e841ec32",
"d20caec3b48a1eef164cb4ca81ba2587",
"d20caec3b48a1eef164cb4ca81ba2587",
"b14a7b8059d9c055954c92674ce60032",
"3a3ea00cfc35332cedf6e5e9a32e94da",
"4b43b0aee35624cd95b910189b3dc231",
"61e9c06ea9a85a5088a499df6458d276",
"0cc175b9c0f1b6a831c399e269772661",
"8d9c307cb7f3c4a32822a51922d1ceaa",
"b14a7b8059d9c055954c92674ce60032",
"57cec4137b614c87cb4e24a3d003a3e0",
"d95679752134a2d9eb61dbd7b91c4bcc",
"7b774effe4a349c6dd82ad4f4f21d34c",
"b14a7b8059d9c055954c92674ce60032",
"800618943025315f869e4e1f09471012",
"d95679752134a2d9eb61dbd7b91c4bcc",
"7b774effe4a349c6dd82ad4f4f21d34c",
"7b8b965ad4bca0e41ab51de7b31363a1",
"f623e75af30e62bbd73d6df5b50bb7b5",
"b14a7b8059d9c055954c92674ce60032",
"b9ece18c950afbfa6b0fdbfa4ff731d3",
"2510c39011c5be704182423e3a695e91",
"3a3ea00cfc35332cedf6e5e9a32e94da",
"b14a7b8059d9c055954c92674ce60032",
"800618943025315f869e4e1f09471012",
"2db95e8e1a9267b7a1188556b2013b33",
"0cc175b9c0f1b6a831c399e269772661",
"dfcf28d0734569a6a693bc8194de62bf",
"cbb184dd8e05c9709e5dcaedaa0495cf",
]
# def generate_flag(password):
# print("FLAG = [")
# for c in password:
# print(" \"{}\",".format(hash(str(c))))
# print("]")
def hash(s):
m = hashlib.md5()
m.update(s)
return m.hexdigest()
def main(password):
for i in range(len(FLAG)):
if hash(str(password[i])) != FLAG[i]:
print("[-] Bad password ... index {} mismatch".format(i));
return 1
if len(password) != len(FLAG):
print("[-] Password and flag have to be the same length !")
return 1
print("[+] Great j0b the fl4g is '{}'".format(password))
if __name__ == "__main__":
if len(sys.argv) < 2:
print("[+] USAGE: {} password".format(sys.argv[0]))
sys.exit(1)
sys.exit(main(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment