MoeCTF 2022 usb

image.png
直接找 URB的第一个输入协议
image.png
我们需要提取的数据 HID Data
提取过滤器
tshark -r usb.pcapng -Y "usb.src==\"2.2.1\"" -T json >1.json
image.png
usbhid.data 字段
tshark -r usb.pcapng -Y "usb.src==\"2.2.1\"" -T json -e usbhid.data >2.json

image.png
正常当作字典取值

import jsonwith open('./2.json') as f:data = json.load(f)a=[]for i in data:try:a.append(i['_source']['layers']['usbhid.data'][0])except:continueprint(a)

image.png
长度为16位 按情况要改脚本
直接和usb流量永存脚本 结合一下

#键盘流量
normalKeys = {"04":"a", "05":"b", "06":"c", "07":"d", "08":"e", "09":"f", "0a":"g", "0b":"h", "0c":"i", "0d":"j", "0e":"k", "0f":"l", "10":"m", "11":"n", "12":"o", "13":"p", "14":"q", "15":"r", "16":"s", "17":"t", "18":"u", "19":"v", "1a":"w", "1b":"x", "1c":"y", "1d":"z","1e":"1", "1f":"2", "20":"3", "21":"4", "22":"5", "23":"6","24":"7","25":"8","26":"9","27":"0","28":"<RET>","29":"<ESC>","2a":"<DEL>", "2b":"\t","2c":"<SPACE>","2d":"-","2e":"=","2f":"[","30":"]","31":"\\","32":"<NON>","33":";","34":"'","35":"<GA>","36":",","37":".","38":"/","39":"<CAP>","3a":"<F1>","3b":"<F2>", "3c":"<F3>","3d":"<F4>","3e":"<F5>","3f":"<F6>","40":"<F7>","41":"<F8>","42":"<F9>","43":"<F10>","44":"<F11>","45":"<F12>"}
shiftKeys = {"04":"A", "05":"B", "06":"C", "07":"D", "08":"E", "09":"F", "0a":"G", "0b":"H", "0c":"I", "0d":"J", "0e":"K", "0f":"L", "10":"M", "11":"N", "12":"O", "13":"P", "14":"Q", "15":"R", "16":"S", "17":"T", "18":"U", "19":"V", "1a":"W", "1b":"X", "1c":"Y", "1d":"Z","1e":"!", "1f":"@", "20":"#", "21":"$", "22":"%", "23":"^","24":"&","25":"*","26":"(","27":")","28":"<RET>","29":"<ESC>","2a":"<DEL>", "2b":"\t","2c":"<SPACE>","2d":"_","2e":"+","2f":"{","30":"}","31":"|","32":"<NON>","33":"\"","34":":","35":"<GA>","36":"<","37":">","38":"?","39":"<CAP>","3a":"<F1>","3b":"<F2>", "3c":"<F3>","3d":"<F4>","3e":"<F5>","3f":"<F6>","40":"<F7>","41":"<F8>","42":"<F9>","43":"<F10>","44":"<F11>","45":"<F12>"}nums = []
for line in a1:if len(line)!=16: #?×?????????ó±ê???????è±???USB?÷??continuenums.append(line[0:2]+line[4:6]) #????????×???
print(nums)output = []
for n in nums:if n[2:4] == "00" :continueif n[2:4] in normalKeys:if n[0:2]=="02":output.append(shiftKeys[n[2:4]])else :output.append(normalKeys[n[2:4]])else:output += '[unknown]'
print(output)flag=0
for i in range(len(output)):try:a=output.index('<DEL>')del output[a]del output[a-1]except:passfor i in range(len(output)):try:if output[i]=="<CAP>":flag+=1output.pop(i)if flag==2:flag=0if flag!=0:output[i]=output[i].upper()except:pass
print ('output :' + "".join(output))python

最终poc

import json
with open('./2.json') as f:data = json.load(f)
a=[]
for i in data:try:a.append(i['_source']['layers']['usbhid.data'][0])except:continue#键盘流量
normalKeys = {"04":"a", "05":"b", "06":"c", "07":"d", "08":"e", "09":"f", "0a":"g", "0b":"h", "0c":"i", "0d":"j", "0e":"k", "0f":"l", "10":"m", "11":"n", "12":"o", "13":"p", "14":"q", "15":"r", "16":"s", "17":"t", "18":"u", "19":"v", "1a":"w", "1b":"x", "1c":"y", "1d":"z","1e":"1", "1f":"2", "20":"3", "21":"4", "22":"5", "23":"6","24":"7","25":"8","26":"9","27":"0","28":"<RET>","29":"<ESC>","2a":"<DEL>", "2b":"\t","2c":"<SPACE>","2d":"-","2e":"=","2f":"[","30":"]","31":"\\","32":"<NON>","33":";","34":"'","35":"<GA>","36":",","37":".","38":"/","39":"<CAP>","3a":"<F1>","3b":"<F2>", "3c":"<F3>","3d":"<F4>","3e":"<F5>","3f":"<F6>","40":"<F7>","41":"<F8>","42":"<F9>","43":"<F10>","44":"<F11>","45":"<F12>"}
shiftKeys = {"04":"A", "05":"B", "06":"C", "07":"D", "08":"E", "09":"F", "0a":"G", "0b":"H", "0c":"I", "0d":"J", "0e":"K", "0f":"L", "10":"M", "11":"N", "12":"O", "13":"P", "14":"Q", "15":"R", "16":"S", "17":"T", "18":"U", "19":"V", "1a":"W", "1b":"X", "1c":"Y", "1d":"Z","1e":"!", "1f":"@", "20":"#", "21":"$", "22":"%", "23":"^","24":"&","25":"*","26":"(","27":")","28":"<RET>","29":"<ESC>","2a":"<DEL>", "2b":"\t","2c":"<SPACE>","2d":"_","2e":"+","2f":"{","30":"}","31":"|","32":"<NON>","33":"\"","34":":","35":"<GA>","36":"<","37":">","38":"?","39":"<CAP>","3a":"<F1>","3b":"<F2>", "3c":"<F3>","3d":"<F4>","3e":"<F5>","3f":"<F6>","40":"<F7>","41":"<F8>","42":"<F9>","43":"<F10>","44":"<F11>","45":"<F12>"}nums = []
for line in a:if len(line)!=16: #?×?????????ó±ê???????è±???USB?÷??continuenums.append(line[0:2]+line[4:6]) #????????×???
print(nums)output = []
for n in nums:if n[2:4] == "00" :continueif n[2:4] in normalKeys:if n[0:2]=="02":output.append(shiftKeys[n[2:4]])else :output.append(normalKeys[n[2:4]])else:output += '[unknown]'
print(output)flag=0
for i in range(len(output)):try:a=output.index('<DEL>')del output[a]del output[a-1]except:passfor i in range(len(output)):try:if output[i]=="<CAP>":flag+=1output.pop(i)if flag==2:flag=0if flag!=0:output[i]=output[i].upper()except:pass
print ('output :' + "".join(output))

image.png
moectf{Learned_a6ou7_USB_tr@ffic}

其实很多时候我们用usb一把梭工具时
注意一下 <CAP><CAP>包裹的字符是大写的即可

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/845585.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何在window是安装mysql数据库(从零开始)

mysql简介&#xff1a; MySQL是一种开源的关系型数据库管理系统&#xff08;RDBMS&#xff09;&#xff0c;它是目前世界上最流行的数据库之一。MySQL最初由瑞典的MySQL AB公司开发&#xff0c;后来被Sun Microsystems收购&#xff0c;而后Sun Microsystems又被Oracle收购。My…

WPF 依赖属性原理、 附加属性

依赖属性如何节约内存 MSDN中给出了下面几种应用依赖属性的场景&#xff1a; 希望可在样式中设置属性。 希望属性支持数据绑定。 希望可使用动态资源引用设置属性。 希望从元素树中的父元素自动继承属性值。 希望属性可进行动画处理。 希望属性系统在属性系统、环境或用户…

正点原子[第二期]Linux之ARM(MX6U)裸机篇学习笔记-24.3,4 SPI驱动实验-I.MX6U SPI 寄存器

前言&#xff1a; 本文是根据哔哩哔哩网站上“正点原子[第二期]Linux之ARM&#xff08;MX6U&#xff09;裸机篇”视频的学习笔记&#xff0c;在这里会记录下正点原子 I.MX6ULL 开发板的配套视频教程所作的实验和学习笔记内容。本文大量引用了正点原子教学视频和链接中的内容。…

【小白专用 已验证24.5.30】ThinkPHP6 视图

ThinkPHP6 视图 模板引擎支持普通标签和XML标签方式两种标签定义&#xff0c;分别用于不同的目的 标签类型描述普通标签主要用于输出变量、函数过滤和做一些基本的运算操作XML标签也称为标签库标签&#xff0c;主要完成一些逻辑判断、控制和循环输出&#xff0c;并且可扩展 c…

注意力可视化代码

读取网络层输出的特征到txt文件&#xff0c;arr为文件名 def hot(self, feature, arr):# 在第二维&#xff08;通道维&#xff09;上相加summed_tensor torch.sum(feature, dim1, keepdimTrue) # 结果形状为 [1, 1, 64, 64]selected_matrix summed_tensor.squeeze(1) # 移除…

三丰云免费服务器

三丰云网址&#xff1a; https://www.sanfengyun.com 可申请免费云服务器&#xff0c;1核/1G内存/5M宽带/有公网IP/10G SSD硬盘/免备案。 收费云服务器&#xff0c;买2年送1年&#xff0c;有很多优惠

msf攻击windows实例

环境&#xff1a;攻击机kali&#xff08;192.168.129.139&#xff09;&#xff0c;目标机windows10&#xff08;192.168.129.132&#xff09; 方法一&#xff1a;通过web站点&#xff0c;使用无文件的方式攻击利用执行&#xff08;命令执行漏洞&#xff09; 方法二&#xff1…

提示工程(Prompt Engineering)和代码生成

文心一言 提示工程&#xff08;Prompt Engineering&#xff09;和代码生成之间的关系主要体现在如何通过精心设计的提示来指导或优化代码生成的过程。以下是关于提示工程和代码生成的详细解释&#xff1a; 一、提示工程&#xff08;Prompt Engineering&#xff09; 提示工程…

KotlinConf 2024:深入了解Kotlin Multiplatform (KMP)

KotlinConf 2024&#xff1a;深入了解Kotlin Multiplatform (KMP) 在近期的Google I/O大会上&#xff0c;我们推荐了Kotlin Multiplatform (KMP)用于跨移动、网页、服务器和桌面平台共享业务逻辑&#xff0c;并在Google Workspace中采用了KMP。紧接着&#xff0c;KotlinConf 2…

【设计模式深度剖析】【7】【结构型】【享元模式】| 以高脚杯重复使用、GUI中的按钮为例说明,并对比Java类库设计加深理解

&#x1f448;️上一篇:外观模式 | 下一篇:结构型设计模式对比&#x1f449;️ 设计模式-专栏&#x1f448;️ 目录 享元模式定义英文原话直译如何理解&#xff1f;字面理解例子&#xff1a;高脚杯的重复使用例子&#xff1a;GUI中的按钮传统方式使用享元模式 4个角色1. …

锻压设备智能制造工厂物联数字孪生平台,推进制造业数字化转型

锻压设备智能制造工厂物联数字孪生平台&#xff0c;推进制造业数字化转型。随着全球制造业的飞速发展&#xff0c;数字化转型已经成为企业提升竞争力、实现可持续发展的关键。在锻压设备智能制造领域&#xff0c;工业物联数字孪生平台以其强大的数据集成、分析和管理能力&#…

国际物流管理系统的选择:花钱不怕,就怕花冤枉钱

现在市场上的国际物流管理系统还是非常多的&#xff0c;想在这么多类型的系统中选择一套适合自己的系统确实不是个简单的事情。 尤其是现在很多物流商其实都是比较小的国际物流商&#xff0c;很多大型的&#xff0c;过于复杂的系统并不适合这个群体。那这个群体应该怎么选择国…

mfc140u.dll丢失的解决方法有哪些?怎么全面修复mfc140u.dll文件

mfc140u.dll丢失其实相对来说不太常见到&#xff0c;因为这个文件一般是不丢失的&#xff0c;不过既然有人遇到这种问题&#xff0c;那么小编一定满足各位&#xff0c;给大家详细的唠叨一下mfc140u.dll丢失的各种解决方法&#xff0c;教大家以最快最有效率的方法去解决mfc140u.…

AI播客下载:a16z (主题为AI、web3、生物技术等风险投资)

a16z播客是一个综合性的科技和创新领域的媒体平台&#xff0c;通过多种节目形式和丰富的内容&#xff0c;为广大听众提供了一个了解最新科技趋势和创新思维的窗口。a16z播客是由安德里森霍罗威茨&#xff08;Andreessen Horowitz&#xff0c;简称a16z&#xff09;推出的一个科技…

汽车MCU虚拟化--对中断虚拟化的思考(1)

目录 1.中断虚拟化的困惑 2.从R52入手 3.小结 1.中断虚拟化的困惑 在车控类控制器里&#xff0c;中断对于我们来说是非常宝贵的资源&#xff0c;可大幅提高系统实时性。 这些中断基本都属于实际物理硬中断(软中断另说)&#xff0c;例如对一个按键按下的中断响应&#xff0…

基于单片机的恒流开关电源 BUCK电路设计

1 前言 1.1课题研究意义 开关电源顾名思义&#xff0c;开关电源便是使用半导体开关器件&#xff08;如晶体管、场效应管、可控硅闸流管等&#xff09;&#xff0c;经过控制电路&#xff0c;使半导体开关器件不停地“导通”和“关闭”&#xff0c;让半导体开关器件对输入的电压…

AI炒股-批量爬取网易财经的要闻板块

工作任务和目标&#xff1a;批量爬取网易财经的要闻板块 在class"tab_body current"的div标签中&#xff1b; 标题和链接在&#xff1a;<a href"https://www.163.com/dy/article/J2UIO5DD051188EA.html">华为急需找到“松弛感”</a> 第一步&…

短剧源码:打造个性化的在线短剧观看平台

随着短视频和短剧内容的兴起&#xff0c;越来越多的用户开始追求快节奏、高效率的娱乐方式。短剧源码的开发&#xff0c;为满足这一需求提供了技术基础。本文将详细介绍短剧源码的构成&#xff0c;以及如何通过这一源码打造个性化的在线短剧观看平台。 一、首页设计 首页是用…

【C++题解】1448. 随机体能测试

问题&#xff1a;1448. 随机体能测试 类型&#xff1a;循环应用&#xff0c;嵌套循环 题目描述&#xff1a; 学校想随机抽取一部分同学参加体能测试&#xff0c;看看同学们的体能怎么样。 张老师想了一个办法&#xff0c;找出学号中含有 1 的同学&#xff0c;让他们参加体能测…

并发和异步编程:详细概述

01 Concurrency and Asynchronous Programming: a Detailed Overview 并发和异步编程:详细概述 Asynchronous programming is one of those topics many programmers find confusing. You come to the point when you think you’ve got it, only to later realize that the …