【CTF】WDCTF-2017 3-1 writeup
2024-09-18 09:41:42
题目来源: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
版权所有,如需转载请注明出处。
最新文章
- windows命令行下简单使用javac、java、javap详细演示
- meta标签大全
- .NET设计模式(11):组合模式(Composite Pattern)(转)
- 初识-----基于Socket的UDP和TCP编程及测试代码
- 【转】WPS文档怎么清除格式
- Type-C设计上的防护
- POJ 1696 Space Ant 极角排序(叉积的应用)
- Timus Online Judge:ural:1006. Square Frames
- 使用串口下载vxworks映象的方法
- TIA Portal V13 WinCC中创建多语言项目
- 树链剖分——线段树区间合并bzoj染色
- SpringBoot + SpringCloud学习踩坑实记
- 智能POS打印配置&;常见问题FAQ 12-14 后期持续更新
- ux.form.field.Month 只能选年、月的时间扩展
- Docker Kubernetes 容器更新与回滚
- 大话设计模式之模板模式 C#
- Sql Server 中由数字转换为指定长度的字符串
- HDU 4585 平衡树Treap
- Guideline 2.1 - Information Needed
- nowcoder 202H-卡牌游戏