Original A: 5448452042455354204354462043415445474f52592049532043525950544f47524150485921 Original B: 4e4f205448452042455354204f4e452049532042494e415259204558504c4f49544154494f4e
A XOR A: 7574666c61677b7477305f74696d335f703464737d7574666c61677b7477305f74696d335f70 B XOR B: 7574666c61677b7477305f74696d335f703464737d7574666c61677b7477305f74696d335f70
from Crypto.Util.number import * from Crypto.Util.strxor import strxor from string import printable
keytable = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" ci = "49380d773440222d1b421b3060380c3f403c3844791b202651306721135b6229294a3c3222357e766b2f15561b35305e3c3b670e49382c295c6c170553577d3a2b791470406318315d753f03637f2b614a4f2e1c4f21027e227a4122757b446037786a7b0e37635024246d60136f7802543e4d36265c3e035a725c6322700d626b345d1d6464283a016f35714d434124281b607d315f66212d671428026a4f4f79657e34153f3467097e4e135f187a21767f02125b375563517a3742597b6c394e78742c4a725069606576777c314429264f6e330d7530453f22537f5e3034560d22146831456b1b72725f30676d0d5c71617d48753e26667e2f7a334c731c22630a242c7140457a42324629064441036c7e646208630e745531436b7c51743a36674c4f352a5575407b767a5c747176016c0676386e403a2b42356a727a04662b4446375f36265f3f124b724c6e346544706277641025063420016629225b43432428036f29341a2338627c47650b264c477c653a67043e6766152a485c7f33617264780656537e5468143f305f4537722352303c3d4379043d69797e6f3922527b24536e310d653d4c33696c635474637d0326516f745e610d773340306621105a7361654e3e392970687c2e335f3015677d4b3a724a4659767c2f5b7c16055a126820306c14315d6b59224a27311f747f336f4d5974321a22507b22705a226c6d446a37375761423a2b5c29247163046d7e47032244377508300751727126326f117f7a38670c2b23203d4f27046a5c5e1532601126292f577776606f0c6d0126474b2a73737a41316362146e581d7c1228717664091c" s = b"WeAreDe1taTeam"
ci = bytes.fromhex(ci) c = strxor(ci,(s*((len(ci)//len(s))+1))[:len(ci)])
defbruce_printable(s): TMP = set() for each in printable: tmp = chr(ord(each)^s) if tmp in keytable: TMP.add(tmp) return TMP
for k_len inrange(1,38): candidates = [] for j inrange(k_len): block = [c[k_len*i+j] for i inrange(len(c)//k_len)] candidate=set() init = True for eachbyte in block: tmp_candidate=bruce_printable(eachbyte) if init: candidate = tmp_candidate init = False else: candidate &= tmp_candidate if candidate: candidates.append(candidate) print(len(candidates)) if k_len == len(candidates): print("[+]",k_len)