pyc反编译

pycdc 反编译一下

image

import md5
md5s = [
    0x831DAA3C843BA8B087C895F0ED305CE7L,
    0x6722F7A07246C6AF20662B855846C2C8L,
    0x5F04850FEC81A27AB5FC98BEFA4EB40CL,
    0xECF8DCAC7503E63A6A3667C5FB94F610L,
    0xC0FD15AE2C3931BC1E140523AE934722L,
    0x569F606FD6DA5D612F10CFB95C0BDE6DL,
    0x68CB5A1CF54C078BF0E7E89584C1A4EL,
    0xC11E2CD82D1F9FBD7E4D6EE9581FF3BDL,
    0x1DF4C637D625313720F45706A48FF20FL,
    0x3122EF3A001AAECDB8DD9D843C029E06L,
    0xADB778A0F729293E7E0B19B96A4C5A61L,
    0x938C747C6A051B3E163EB802A325148EL,
    0x38543C5E820DD9403B57BEFF6020596DL]
print 'Can you turn me back to python ? ...'
flag = raw_input('well as you wish.. what is the flag: ')
if len(flag) > 69:
    print 'nice try'
    exit()
if len(flag) % 5 != 0:
    print 'nice try'
    exit()
for i in range(0, len(flag), 5):
    s = flag[i:i + 5]
    if int('0x' + md5.new(s).hexdigest(), 16) != md5s[i / 5]:
        print 'nice try'
        exit()
        continue
print 'Congratz now you have the flag'

每 5 个字符一组计算 MD5,并依次与 13 个哈希比较 爆破一手 刚下了一个这个hashcat 超快

import subprocess
import tempfile
from pathlib import Path

path = Path(r"D:\QQZ\hashcat-7.1.2")

md5s = [
    0x831DAA3C843BA8B087C895F0ED305CE7,
    0x6722F7A07246C6AF20662B855846C2C8,
    0x5F04850FEC81A27AB5FC98BEFA4EB40C,
    0xECF8DCAC7503E63A6A3667C5FB94F610,
    0xC0FD15AE2C3931BC1E140523AE934722,
    0x569F606FD6DA5D612F10CFB95C0BDE6D,
    0x68CB5A1CF54C078BF0E7E89584C1A4E,
    0xC11E2CD82D1F9FBD7E4D6EE9581FF3BD,
    0x1DF4C637D625313720F45706A48FF20F,
    0x3122EF3A001AAECDB8DD9D843C029E06,
    0xADB778A0F729293E7E0B19B96A4C5A61,
    0x938C747C6A051B3E163EB802A325148E,
    0x38543C5E820DD9403B57BEFF6020596D
]

hashes = [f"{x:032x}" for x in md5s]

with tempfile.TemporaryDirectory() as d:
    d = Path(d)
    hash_file = d / "hashes.txt"
    out_file = d / "out.txt"
    pot_file = d / "pot.txt"

    hash_file.write_text("\n".join(hashes), encoding="ascii")

    subprocess.run(
        [
            str(path / "hashcat.exe"),
            "-m", "0",
            "-a", "3",
            str(hash_file),
            "?a?a?a?a?a",
            "-O",
            "--quiet",
            "--potfile-path", str(pot_file),
            "--outfile", str(out_file),
            "--outfile-format", "1,2"
        ],
        cwd=path,
        stdout=subprocess.DEVNULL,
        stderr=subprocess.DEVNULL,
        check=True
    )

    result = {}

    for line in out_file.read_bytes().splitlines():
        h, text = line.split(b":", 1)
        result[h.decode()] = text

    print(b"".join(result[h] for h in hashes).decode())

flag

ALEXCTF{dv5d4s2vj8nk43s8d8l6m1n5l67ds9v41n52nv37j481h3d28n4b6v3k}