首页 > 其他 > 详细

【CTF】WDCTF-2017 3-1 writeup

时间:2020-09-22 22:53:54      阅读:104      评论:0      收藏:0      [点我收藏+]

技术分享图片

题目来源: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

版权所有,如需转载请注明出处。

版权所有,如需转载请注明出处。

【CTF】WDCTF-2017 3-1 writeup

原文:https://www.cnblogs.com/Flat-White/p/13714987.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!