
題目來源:WDCTF-2017
題目鏈接:https://adworld.xctf.org.cn/task/answer?type=misc&number=1&grade=1&id=4840&page=4
?writeup
下載得到rar 解壓得到沒有擴展名的檔案

剛拿到檔案時完全沒有思路
參考
https://blog.betamao.me/2017/09/17/2017-%E9%97%AE%E9%BC%8E%E6%9D%AF%E5%88%9D%E8%B5%9B-WP/
file命令
file命令查看檔案型別

添加擴展名.pcapng然后用wireshark打開
wireshark追蹤TCP流
追蹤TCP流 流5時發現rar

顯示和保存資料為原始資料


復制出來在010粘貼然后保存為rar

解壓需要密碼

追蹤TCP流 流6時發現一段base64編碼資料和一個Python腳本

19aaFYsQQKr+hVX6hl2smAUQ5a767TsULEUebWSajEo=

# coding:utf-8
__author__ = 'YFP'
from Crypto import Random
from Crypto.Cipher import AES
import sys
import base64
IV = 'QWERTYUIOPASDFGH'
def decrypt(encrypted):
aes = AES.new(IV, AES.MODE_CBC, IV)
return aes.decrypt(encrypted)
def encrypt(message):
length = 16
count = len(message)
padding = length - (count % length)
message = message + '\0' * padding
aes = AES.new(IV, AES.MODE_CBC, IV)
return aes.encrypt(message)
str = 'this is a test'
example = encrypt(str)
print(decrypt(example))
獲取rar解壓密碼
對其進行base64解密然后使用Python腳本解密
修改Python腳本
# coding:utf-8
__author__ = 'YFP'
from Crypto import Random
from Crypto.Cipher import AES
import sys
import base64
IV = 'QWERTYUIOPASDFGH'
def decrypt(encrypted):
aes = AES.new(IV, AES.MODE_CBC, IV)
return aes.decrypt(encrypted)
def encrypt(message):
length = 16
count = len(message)
padding = length - (count % length)
message = message + '\0' * padding
aes = AES.new(IV, AES.MODE_CBC, IV)
return aes.encrypt(message)
str = 'this is a test'
example = encrypt(str)
print(decrypt(example))
#增加如下兩行
a='19aaFYsQQKr+hVX6hl2smAUQ5a767TsULEUebWSajEo='
print(decrypt(base64.b64decode(a)))
腳本運行時Python3環境報錯
使用Python2環境運行
需要安裝pyCrypto模塊
安裝程序中出現報錯可參考
https://blog.csdn.net/teloy1989/article/details/72862108

得到解壓密碼:No_One_Can_Decrypt_Me
解壓后得到打開flag.txt得到flag

Flag:WDCTF{Seclab_CTF_2017}

結束,
?轉載請注明出處
本文作者:雙份濃縮馥芮白
原文鏈接:https://www.cnblogs.com/Flat-White/p/13714987.html
著作權所有,如需轉載請注明出處,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/107678.html
標籤:其他
