当前位置: 首页 > news >正文

BUUCTF蜘蛛侠呀

解压后发现是流量包,好多icmp包

发现icmp包尾部有$$STRAT打头16进制的字符串,好多重复得。我们只需要提取尾部这些字符串是当icmp的type=0时上图标识为褐色的字符串,还需要把16进制的字符串转为对应的字符串(bytes 类型)并去重。

使用python脚本

import pyshark
import binasciidef process_pcap():# 使用pyshark的FileCapture打开名为out.pcap的文件,# 并设置显示过滤器,只捕获icmp.type等于0的ICMP数据包packets = pyshark.FileCapture('out.pcap', display_filter="icmp.type==0")res = []# 以写入模式打开名为out.txt的文件,指定编码为'utf - 8'with open('out.txt', 'w', encoding='utf - 8') as f:# 遍历捕获到的每个数据包for each in packets:try:# 将数据包中的十六进制数据(each.icmp.data)先转换为字节串,# 再使用'utf - 8'编码将字节串解码为字符串data = binascii.unhexlify(each.icmp.data).decode('utf - 8')# 如果解码后的字符串不在结果列表res中if data not in res:# 将该字符串写入到out.txt文件中f.write(data)# 将该字符串添加到结果列表res中,实现去重功能res.append(data)# 如果在binascii.unhexlify或decode操作中出现错误,捕获binascii.Error异常并跳过except binascii.Error:pass# 关闭数据包捕获对象packets.close()print('done')if __name__ == '__main__':process_pcap()

把out.txt首行和尾的开始和结束标志去除,去掉每行的头部的,

复制内容到cyberchef

或者使用下面python脚本直接输出processed_out.txt。内容复制到cyberchef

import os
import pyshark
import binascii
from tqdm import tqdmdef process_pcap():packets = pyshark.FileCapture('out.pcap', display_filter="icmp.type==0")res = []total_packets = len(list(packets))packets = pyshark.FileCapture('out.pcap', display_filter="icmp.type==0")with open('out.txt', 'w', encoding='utf - 8') as f:for each in tqdm(packets, total = total_packets):try:data = binascii.unhexlify(each.icmp.data).decode('utf - 8')if data not in res:res.append(data)except binascii.Error:passpackets.close()new_res = res[1: - 1]new_content = []for line in new_res:if line.startswith('$$START$$'):line = line.replace('$$START$$', '', 1)line = line.rstrip('\n')new_content.append(line)output_file = 'processed_out.txt'with open(output_file, 'w', encoding='utf - 8') as f_out:for line in new_content:f_out.write(line + '\n')print('done')if __name__ == '__main__':process_pcap()

或使用这个脚本,有两个好处一是直接生成最终结果,二是由于数据较大处理时间约两分钟,初始化有提示带进度条用户体验好。

import os
import pyshark
import binascii
from tqdm import tqdmdef process_pcap():packets = pyshark.FileCapture('out.pcap', display_filter="icmp.type==0")res = []print('正在初始化数据包读取,请稍候...')total_packets = len(list(packets))packets = pyshark.FileCapture('out.pcap', display_filter="icmp.type==0")progress_bar = tqdm(total = total_packets)for each in packets:try:data = binascii.unhexlify(each.icmp.data).decode('utf - 8')if data not in res:res.append(data)except binascii.Error as e:print(f"处理数据包时出现binascii.Error异常: {e}")progress_bar.update(1)progress_bar.close()packets.close()if not res:print("没有获取到有效的数据,可能是过滤条件问题或者pcap文件内容问题")returnnew_res = res[1: - 1]new_content = []for line in new_res:if line.startswith('$$START$$'):line = line.replace('$$START$$', '', 1)line = line.rstrip('\n')new_content.append(line)output_file = 'processed_out.txt'with open(output_file, 'w', encoding='utf - 8') as f_out:for line in new_content:f_out.write(line + '\n')print('done')if __name__ == '__main__':process_pcap()

cyberchef识别出是zip文件,点击保存图标,另存为zip文件,解压得flag.gif

把这个gif文件拷贝进kali,输入下面命令

identify -format "%T" flag.gif
 

把使用identify得到隐写信息

2050502050502050205020202050202020205050205020502050205050505050202050502020205020505050205020206666

我们去掉尾部6666,把20用0替换,50用1替换

205050205050205020502020205020202020505020502050205020505050505020205050202020502050505020502020

使用python和qt写个程序实现,源码如下:

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton, QTextEditclass TextReplaceTool(QWidget):def __init__(self):super().__init__()self.init_ui()def init_ui(self):# 查找输入框及标签self.find_label = QLabel('查找内容:')self.find_input = QLineEdit()# 替换输入框及标签self.replace_label = QLabel('替换内容:')self.replace_input = QLineEdit()# 查找按钮self.find_button = QPushButton('查找')self.find_button.clicked.connect(self.find_text)# 替换按钮self.replace_button = QPushButton('替换')self.replace_button.clicked.connect(self.replace_text)# 文本编辑区域self.text_edit = QTextEdit()# 布局设置hbox1 = QHBoxLayout()hbox1.addWidget(self.find_label)hbox1.addWidget(self.find_input)hbox2 = QHBoxLayout()hbox2.addWidget(self.replace_label)hbox2.addWidget(self.replace_input)hbox3 = QHBoxLayout()hbox3.addWidget(self.find_button)hbox3.addWidget(self.replace_button)vbox = QVBoxLayout()vbox.addLayout(hbox1)vbox.addLayout(hbox2)vbox.addLayout(hbox3)vbox.addWidget(self.text_edit)self.setLayout(vbox)self.setWindowTitle('文本查找替换工具')self.show()def find_text(self):find_str = self.find_input.text()text = self.text_edit.toPlainText()start_index = text.find(find_str)if start_index!= -1:self.text_edit.moveCursor(QTextEdit.MoveOperation.Start)cursor = self.text_edit.textCursor()cursor.setPosition(start_index)self.text_edit.setTextCursor(cursor)def replace_text(self):find_str = self.find_input.text()replace_str = self.replace_input.text()text = self.text_edit.toPlainText()new_text = text.replace(find_str, replace_str)self.text_edit.setPlainText(new_text)if __name__ == '__main__':app = QApplication(sys.argv)ex = TextReplaceTool()sys.exit(app.exec_())

运行gui如图:两次替换可得结果

011011010100010000110101010111110011000101110100

去cyterchef

先binary(二进制)-bytes(字符串)再MD5编码

得 f0f1003afe4ae8ce4aa8e8487a8ab3b6

flag{f0f1003afe4ae8ce4aa8e8487a8ab3b6}

相关文章:

  • Synchronized是怎么实现的?
  • [SwiftUI 开发] @dynamicCallable 与 callAsFunction:将类型实例作为函数调用
  • 力扣9.28
  • Python按照指定“字体大小以及字体格式”,批量更新Word文档内容(10)
  • 基于Java+SQL Server2008开发的(CS界面)个人财物管理系统
  • Python编码系列—Python备忘录模式:掌握对象状态保存与恢复技术
  • HTTP请求中GET与POST方法的核心区别与用途解析
  • VMware下的ubuntu显示文字太小的自适应显示调整
  • 力扣题解2286
  • 【高分系列卫星简介——高分五号卫星(GF-5)】
  • Jenkins入门:从搭建到部署第一个Springboot项目(踩坑记录)
  • 【NodeJS】npm、yarn、pnpm当前项目设置国内镜像源
  • 【算法】分治:归并排序之LCR 170.交易逆序对的总数(hard)
  • linux脚本工具
  • 【Godot4.3】简单物理模拟之圆粒子碰撞检测
  • 2019年如何成为全栈工程师?
  • Android 初级面试者拾遗(前台界面篇)之 Activity 和 Fragment
  • EOS是什么
  • ES6核心特性
  • Go 语言编译器的 //go: 详解
  • happypack两次报错的问题
  • Netty 框架总结「ChannelHandler 及 EventLoop」
  • Terraform入门 - 3. 变更基础设施
  • Zepto.js源码学习之二
  • 大快搜索数据爬虫技术实例安装教学篇
  • 简析gRPC client 连接管理
  • 前端每日实战:70# 视频演示如何用纯 CSS 创作一只徘徊的果冻怪兽
  • 前言-如何学习区块链
  • 什么软件可以提取视频中的音频制作成手机铃声
  • 使用API自动生成工具优化前端工作流
  • 适配mpvue平台的的微信小程序日历组件mpvue-calendar
  • hi-nginx-1.3.4编译安装
  • LIGO、Virgo第三轮探测告捷,同时探测到一对黑洞合并产生的引力波事件 ...
  • ‌内网穿透技术‌总结
  • ‌前端列表展示1000条大量数据时,后端通常需要进行一定的处理。‌
  • ## 临床数据 两两比较 加显著性boxplot加显著性
  • $emit传递多个参数_PPC和MIPS指令集下二进制代码中函数参数个数的识别方法
  • (1)(1.8) MSP(MultiWii 串行协议)(4.1 版)
  • (2/2) 为了理解 UWP 的启动流程,我从零开始创建了一个 UWP 程序
  • (7)摄像机和云台
  • (C11) 泛型表达式
  • (cos^2 X)的定积分,求积分 ∫sin^2(x) dx
  • (Redis使用系列) Springboot 使用redis实现接口Api限流 十
  • (二)正点原子I.MX6ULL u-boot移植
  • (二十六)Java 数据结构
  • (每日一问)操作系统:常见的 Linux 指令详解
  • (四)Tiki-taka算法(TTA)求解无人机三维路径规划研究(MATLAB)
  • (最完美)小米手机6X的Usb调试模式在哪里打开的流程
  • .bat批处理(十):从路径字符串中截取盘符、文件名、后缀名等信息
  • .FileZilla的使用和主动模式被动模式介绍
  • .NET COER+CONSUL微服务项目在CENTOS环境下的部署实践
  • .NET Core 通过 Ef Core 操作 Mysql
  • .net web项目 调用webService
  • .NET 同步与异步 之 原子操作和自旋锁(Interlocked、SpinLock)(九)
  • .NET 应用启用与禁用自动生成绑定重定向 (bindingRedirect),解决不同版本 dll 的依赖问题