从题目中获取文件
使用file命令查看文件类型

修改后缀为.rar后进行解压缩

再次使用file命令查询该文件的类型

再次修改后缀为.pcap或者.pcapng
使用wireshark打开,直接搜索flag字样

在多个数据包里发现了flag.rar、flag.txt等文件
尝试使用http导出文件

有一个flag.rar文件
 
 
但这是一个加密了的rar文件
里面虽然有flag.txt,但是我们没有密码

找到之前搜索flag,找到flag.txt字样的数据包
进行TCP Stream的追踪

仔细分析该TCP流,发现了一串不知名的base64代码

19aaFYsQQKr+hVX6hl2smAUQ5a767TsULEUebWSajEo=继续往下翻
 
 
发现了这段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))最后还有一段:祝你成功(谢谢你啊,笑)

结合所得信息解题
先对开头从TCP流中获取到的base64代码尝试进行解码

很显然,直接进行解码并不能得到任何有效信息
那问题就应该出在python代码上了
对获取得到的python代码,进行修改,使其能正常运行:
# coding:utf-8
from Crypto import Random
from Crypto.Cipher import AES
import sys
import base64
IV = b'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 + b'\0' * padding
  aes = AES.new(IV, AES.MODE_CBC, IV)
  return aes.encrypt(message)
str = b'this is a test'
example = encrypt(str)
print(decrypt(example))
代码审计
以上python程序,是一个简单的加解密程序
原理我们不需要清楚,我们只要使用就可以了
接下来尝试把我们上面拿到的base64代码放进程序里进行解密
所以程序里只留下必要的解密代码即可
# coding:utf-8
from Crypto import Random
from Crypto.Cipher import AES
import sys
import base64
IV = b'QWERTYUIOPASDFGH'
def decrypt(encrypted):
  aes = AES.new(IV, AES.MODE_CBC, IV)
  return aes.decrypt(encrypted)
str = b'19aaFYsQQKr+hVX6hl2smAUQ5a767TsULEUebWSajEo='
flag = base64.b64decode(str)
print(decrypt(flag))
运行结果:

回到开头拿到的flag.rar文件,使用密码对其进行解压

获得flag:
 
 



















