c = 0x068C2E12FADEBBD344E82FA9E1EAC0F0BDE5AECBD7840F18352CF761F872233D n = 0x48D6B5DAB6617F21B39AB2F7B14969A7337247CABB417B900AE1D986DB47D971 e = 0x10001 p = 185783328357334813222812664416930395483 q = 177334994338425644535647498913444186659 d = 21459038613121460434132216103140795081593356519819592462521069311922260546829 m=pow(c,d,n) print(m) hexnum = hex(m) print(HextoAscii(hexnum))
1 2 3 4 5 6 7 8 9 10 11 12 13
#python2.7 from Crypto.Cipher import AES
c = 0x068c2e12fadebbd344e82fa9e1eac0f0bde5aecbd7840f18352cf761f872233d#read RSA.encrypt n = 0x48D6B5DAB6617F21B39AB2F7B14969A7337247CABB417B900AE1D986DB47D971 e = 0x10001 p = 185783328357334813222812664416930395483 q = 177334994338425644535647498913444186659 d = 21459038613121460434132216103140795081593356519819592462521069311922260546829 m=pow(c,d,n) print(m) key = "{:x}".format(m).decode('hex') print(key)
obj=AES.new(key,AES.MODE_ECB) withopen('next.zip','wb') as f: f.write(obj.decrypt(s))
解压缩next.zip得到三个文件
查看encrypt.py,代码如下
1 2 3 4 5 6 7 8 9
from base64 import *
s=open('flag.jpg','rb').read() s='-'.join(map(b16encode,list(s))) s=map(''.join,zip(*(s.split('-')))) withopen('first','wb') as f: f.write(b16decode(s[0])) withopen('second','wb') as f: f.write(b16decode(s[1]))
发现是把flag.jpg拆成两部分,都使用base16 decode了一次
合并出flag.jpg
1 2 3 4 5 6 7 8 9 10
from base64 import * s = [0,1] withopen('first','rb') as f: s[0] = b16encode(f.read()) withopen('second','rb') as f: s[1] = b16encode(f.read()) s=map(''.join,zip(*s)) s=b16decode(''.join(s)) withopen('flag.jpg','wb') as f: f.write(s)