关于ctf:CTF压缩包解密CRC碰撞

79次阅读

共计 463 个字符,预计需要花费 2 分钟才能阅读完成。

当压缩包中看到文件大小很小,如 4,代表有 4 个字符(例如:qbcd),能够通过 CRC 碰撞,获取到文件中的字符串内容

python2 脚本:

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import datetime
import binascii
 

def crack(crc_in):
    crcs = set([crc_in])
    
    r = 'abcdefghijklmnopqrstuvwxyz_'  #压缩字符串
    for a in r:
        for b in r:
            for c in r:
                for d in r:
                    txt = a+b+c+d
                    crc = binascii.crc32(txt)
                    if (crc & 0xFFFFFFFF) in crcs:
                        return txt

if __name__ == "__main__": 
    s=[0x6083A1C8, 0xCE70D424,0xC3F17511,0x526FD582,0x30E25038,0xAA3E6AEA]
    password=''
    for x in s:
        passw = crack(x)
        password+=str(passw)
        print password

正文完
 0