2021-09-15
banana-princess
題目給了一個pdf文檔,卻不能打開,換后綴名txt打開
如果是pdf文件,開頭應該是pdf,但是這個開頭是CQS,所以推測發生了移位
從C到P,從Q到D,從S到F,都是移動了13位,也就是ROT13
寫個代碼解密
import string def rot(c, n):if c.isupper():start = ord('A')elif c.islower():start = ord('a')else:return cm = ord(c) - starti = (m + n) % 26 + startreturn chr(i)f = open('b.txt','r',errors='ignore').read() m = ''for i in f:m += rot(i,13)open('b2.pdf','w').write(m)但是打開文件用的編碼好幾個都不對,默認是gbk不對,改成utf-8不對,改成gb18030還是不行,最后強制忽略錯誤才運行成功,但是打開了確是一片空白
搜了大佬們的解題方法發現他們直接用了工具
cat b.pdf | tr 'A-Za-z' 'N-ZA-Mn-za-m' > new.pdf然后就得到了
flag在的地方被遮住了
在無數次嘗試之后,發現PS才是正確打開方式,管他什么pdf呢
有兩層,不看上面那層就出來了
看到了flag:BITSCTF{save_the_kid}
Decrypt-the-Message
The life that I have Is all that I have And the life that I have Is yours.The love that I have Of the life that I have Is yours and yours and yours.A sleep I shall have A rest I shall have Yet death will be but a pause.For the peace of my years In the long green grass Will be yours and yours and yours.decrypted message: emzcf sebt yuwi ytrr ortl rbon aluo konf ihye cyog rowh prhj feom ihos perp twnb tpak heoc yaui usoa irtd tnlu ntke onds goym hmpq翻譯得到:
我的生活 這就是我的全部 還有我的生活 這是你的。 我擁有的愛 我所擁有的生活 是你的,你的,你的。 我要睡一覺 我要休息一下 然而,死亡只是一個停頓。 為了我晚年的安寧 在長長的綠草中 將是你的,你的,你的。 解密消息: emzcf sebt yuwi ytrr ortl rbon aluo konf ihye cyog rowh prhj feom ihos perp twnb tpak heoc yaui usoa irtd tnlu ntke onds goym hmpq可以明顯看出密文是: emzcf sebt yuwi ytrr ortl rbon aluo konf ihye cyog rowh prhj feom ihos perp twnb tpak heoc yaui usoa irtd tnlu ntke onds goym hmpq
而這題的加密方式叫:Poem Code
大概了解一下解密方式,
有大佬的解密代碼:https://github.com/abpolym/crypto-tools/blob/master/poemcode/poemcode.py
然后輸入python poemcode.py poem msg
poemcode.py是代碼名稱,poem是那個詩歌,msg是要解密的信息
但是代碼需要改一些,因為原代碼是python2
運行得到
有一行:ifyouthinkcryptographyistheanswertoyourproblemthenyoudonotknowwhatyourproblemisabcdefghijklmnopqrstu
就是flag了
總結
以上是生活随笔為你收集整理的2021-09-15的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [BSidesSF2020]haysta
- 下一篇: HBNIS-crypto