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 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

print(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?÷??
         continue
    nums.append(line[0:2]+line[4:6]) #????????×???
print(nums)

output = []
for n in nums:
    if n[2:4] == "00" :
        continue
    if 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:
        pass

for i in range(len(output)):
    try:
        if output[i]=="<CAP>":
            flag+=1
            output.pop(i)
            if flag==2:
                flag=0
        if 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?÷??
         continue
    nums.append(line[0:2]+line[4:6]) #????????×???
print(nums)

output = []
for n in nums:
    if n[2:4] == "00" :
        continue
    if 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:
        pass

for i in range(len(output)):
    try:
        if output[i]=="<CAP>":
            flag+=1
            output.pop(i)
            if flag==2:
                flag=0
        if flag!=0:
            output[i]=output[i].upper()
    except:
        pass
print ('output :' + "".join(output))

image.png
moectf{Learned_a6ou7_USB_tr@ffic}

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

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【记录】打印|用浏览器生成证件照打印PDF,打印在任意尺寸的纸上(简单无损!)

以前我打印证件照的时候&#xff0c;我总是在网上找在线证件照转换或者别的什么。但是我今天突然就琢磨了一下&#xff0c;用 PDF 打印应该也可以直接打印出来&#xff0c;然后就琢磨出来了&#xff0c;这么一条路大家可以参考一下。我觉得比在线转换成一张 a4 纸要方便的多&am…

Git常用命令1

1、设置用户签名 ①基本语法&#xff1a; git config --global user.name 用户名 git config --global user.email 邮箱 ②实际操作 ③查询是否设置成功 cat ~/.gitconfig 注&#xff1a;签名的作用是区分不同操作者身份。用户的签名信息在每一个版本的提交…

2.1 OpenCV随手简记(二)

为后续项目学习做准备&#xff0c;我们需要了解LinuxOpenCV、Mediapipe、ROS、QT等知识。 一、图像显示与保存 1、基本原理 1.1 图像像素存储形式 首先得了解下图像在计算机中存储形式&#xff1a;(为了方便画图&#xff0c;每列像素值都写一样了)。对于只有黑白颜色的灰度…

OSM历史10年(2014-2024)全国数据下载(路网、建筑物、POI、水系、地表覆盖利用······)

点击下方全系列课程学习 点击学习—>ArcGIS全系列实战视频教程——9个单一课程组合系列直播回放 零、前沿 这次向大家介绍一下OSM&#xff08;OpenStreetMap&#xff09;十年历史数据&#xff08;2014—2014&#xff09;的下载方法。当然我们也下载好分享给大家&#xff…

如何上传模型素材创建3D漫游作品?

一、进入3D空间漫游互动工具编辑器 进入720云官网-点击“开始创作”-选择3D空间漫游-进入到作品创建页面。 二、上传模型及素材&#xff0c;创建生成3D空间漫游模型 1.创建3D空间作品&#xff1a;您可以选择新建空白作品或使用720云提供的预设空间模板&#xff0c;本篇主要介绍…

顶级商圈词汇,你听过哪些?

能把复杂的事情说到简单才是真正的高手&#xff0c;堆砌时髦名词的人&#xff0c;大多是被别人影响后的盲从之辈&#xff0c;高认知的人不扯这些虚头巴脑的东西。 顶级商圈词汇&#xff0c;你听过哪些&#xff1f; 生命周期&#xff0c;价值转化&#xff0c;完善逻辑业模式&a…

Elasticsearch 认证模拟题 - 4

一、题目 生成快照&#xff0c;或快照生命周期 1.1 考点 快照生命周期&#xff08;最好通过界面化配置&#xff09;创建仓库创建快照 &#xff08;因为这个需要部署共享文件&#xff0c;所以这个我就在虚拟机上简单操作一下&#xff09; 注&#xff1a; 部署共享文件系统可…

Java Web基础知识(Servlet、Cookie、Session、Filter、Listener)

文章目录 Servlet什么是Servlet&#xff1f;Servlet的生命周期ServletConfig对象ServletContext对象Servlet请求转发和重定向Servlet请求转发&#xff08;forward和include&#xff09;Servlet重定向&#xff08;redirect&#xff09;重定向和转发的区别? 读取文件、下载文件 …

攻防对抗少丢分,爱加密帮您筑起第二防线

应用程序通常处理和存储大量的敏感数据&#xff0c;如用户个人信息、财务信息、商业数据、国家数据等&#xff0c;用户量越大的应用程序&#xff0c;其需要存储和保护的用户数据越多。因此应用层长期是攻击方的核心目标&#xff0c;传统应用安全依靠防火墙(FireWall)、入侵检测…

一周学会Django5 Python Web开发 - Django5内置Admin系统二次开发

锋哥原创的Python Web开发 Django5视频教程&#xff1a; 2024版 Django5 Python web开发 视频教程(无废话版) 玩命更新中~_哔哩哔哩_bilibili2024版 Django5 Python web开发 视频教程(无废话版) 玩命更新中~共计56条视频&#xff0c;包括&#xff1a;2024版 Django5 Python we…

规则引擎Drools,基于mysql实现动态加载部署

文章目录 一、使用1、参考资料2、引包3、创建规则实体类4、实现drools动态规则5、模拟数据库&#xff0c;实现规则的CRUD6、创建控制层7、测试规则的动态添加&#xff08;1&#xff09;添加规则&#xff08;2&#xff09;修改规则&#xff08;3&#xff09;删除规则 8、模拟2个…

01PCB设计概述

PCB设计概述 EDA electronic design automatic 电子设计自动化&#xff08;利用计算机来实现电子设计&#xff09; 分为 &#xff1a; 微电子&#xff08;芯片设计&#xff09;、硬件板卡&#xff08;PCB设计&#xff09; 画原理图、画PCB布线 要会绘制原理图库、和封装图库 元…

短信发送验证码及邮件发送验证码

发送短信验证码 阿里云发送验证码 public Integer sendTelCode(String tel) {String url "https://dfsns.market.alicloudapi.com/data/send_sms";String appcode "a3198282fbdf443d97aa9f3cfbe1232e";int code RandomUtil.randomInt(1000,10000);emai…

Ubuntu系统安装

目录 安装准备 安装步骤 虚拟机配置 系统安装 安装准备 Ubuntu系统镜像&#xff0c;虚拟机环境 虚拟机环境 使用的虚拟机软件为VMware Workstation 系统镜像 阿里镜像站&#xff1a;阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)https://developer.aliyun.com…

掌握 NestJS 10.x:从零开始构建高效可扩展的服务器端应用详解

NestJS 是一个用于构建高效、可扩展的 Node.js 服务端应用的框架&#xff0c;基于 TypeScript 构建&#xff0c;并且受 Angular 的启发&#xff0c;提供了模块化、易测试、易维护的架构。NestJS 10.x 引入了一些新特性和改进&#xff0c;进一步提升了开发体验。本文将详细介绍如…

HarmonyOS鸿蒙学习笔记(27)resources目录说明

resources目录说明 目录结构目录说明base目录rawfile目录resfile目录资源组目录 参考资料 目录结构 在HarmonyOS的项目结构中&#xff0c;有resources目录&#xff0c;用于存放应用/服务所用到的资源文件&#xff0c;如图形、多媒体、字符串、布局文件等。关于资源文件&#x…

计网ppt标黄知识点整理第(1)章节——谢希仁版本、期末复习自用

大众熟知的三大网络&#xff1a;电信网络、有线电视网络、计算机网络。发展最快起到核心的是计算机网络。Internet是全球最大、最重要的计算机网络。互联网&#xff1a;流行最广、事实上的标准译名。互连网&#xff1a;把许多网络通过一些路由器连接在一起。与网络相连的计算机…

AI网络爬虫:无限下拉滚动页面的另类爬取方法

现在很多网页都是无限下拉滚动的。可以拉动到底部&#xff0c;然后保存网页为mhtml格式文件。 接着&#xff0c;在ChatGPT中输入提示词&#xff1a; 你是一个Python编程高手&#xff0c;要完成一个关于爬取网页内容的Python脚本的任务&#xff0c;下面是具体步骤&#xff1a; …

C++——list

目录 前言 一、list 1.1 list的介绍 1.2 list的使用 1.2.1 list的构造 1.2.2 list iterator的使用 1.2.3 list capacity 1.2.4 list element access 1.2.5 list modifiers 1.2.6 list的迭代器失效 二、list的模拟实现 2.1 模拟实现list 三、list与vector的对比 总结 前言 今天…

LNMP部署及应用

目录 1.LNMP概述 Nginx 特点 Nginx 作用 2.分布式部署LNMP操练 Nginx主机&#xff1a;CentOS 7-1 PHP主机: CentOS 7-2 1.LNMP概述 Nginx 是开源、高性能、高可靠的 Web 和反向代理服务器&#xff0c;而且支持热部署&#xff0c;几乎可以做到 7 * 24 小时不间断运行&…