mein kampf

题目描述

题目考点

"We have intercepted the enemy's communications, but unfortunately, some data was corrupted during transmission. Can you recover the message?" M4 UKW $ Gamma 2 4 $ 5 9 $ 14 3 $ 5 20 fv cd hu ik es op yl wq jm "Ciphertext: zkrtwvvvnrkulxhoywoj" (Words in the flag are separated by underscores)

解题思路


从通信数据格式来看,很明显,这个挑战使用了 Enigma(挑战标题也暗示了同样的内容)。但是,在一些我们不知道机器配置的地方有美元符号。唯一的选择是通过所有可能性进行暴力破解,看看我们以正确的标志格式获得哪种组合的输出。为了自动化这一点,我在 Python 中使用了 py-enigma 包。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from enigma.machine import EnigmaMachine 
reflectors = ['B-Thin', 'C-Thin'] 
rotors = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII'] 
for r1 in rotors: 
    for r2 in rotors: 
        for r3 in rotors: 
            for r in reflectors: 
                machine = EnigmaMachine.from_key_sheet( 
                   rotors=' '.join(['Gamma', r1, r2, r3]), 
                   reflector=r, 
                   ring_settings='D I C T', 
                   plugboard_settings='fv cd hu ik es op yl wq jm'.upper()) 
                machine.set_display('BENE') 
                temp = machine.process_text('zkrtwvvvnrkulxhoywoj') 
                if 'CTF' in temp: 
                    print(temp, r1, r2, r3, r)

The output is CSICTFNOSHITSHERLOCK I IV VII B-Thin.

Flag

1
csictf{no_shit_sherlock}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值