下載附件,解壓後有一個加密文件和rsa.py代碼如下:
flag = open('flag.txt','r').read() N = 221 e = 5 enc = b'' for i in flag: enc += bytes([pow(ord(i),e,N)]) encrypt = open('encrypt','wb') encrypt.write(enc) encrypt.close()
知道加密腳本我們反向編寫腳本獲取flag:
flag="" N = 221 e = 5 with open('encrypt','rb') as fp: encrypt=fp.read() encrypt=bytes.decode(encrypt) for i in encrypt: for x in range(0,255): if pow(x,e,N)==ord(i): flag+=chr(x) break print(flag)