Skip to content

Instantly share code, notes, and snippets.

@joshdabosh
Created February 2, 2020 19:11
Show Gist options
  • Save joshdabosh/649129616fb684c4c74b11fa4b92ca40 to your computer and use it in GitHub Desktop.
Save joshdabosh/649129616fb684c4c74b11fa4b92ca40 to your computer and use it in GitHub Desktop.
extract wireshark keyboard stuff
# taken from a writeup
from __future__ import print_function
import json
with open("dissections.json") as f:
data = json.load(f)
m = {
0:"",2:"PostFail",4:"a",5:"b",6:"c",7:"d",8:"e",9:"f",10:"g",11:"h",12:"i",13:"j",14:"k",15:"l",16:"m",17:"n",18:"o",19:"p",20:"q",21:"r",22:"s",23:"t",24:"u",25:"v",26:"w",27:"x",28:"y",29:"z",30:"1",31:"2",32:"3",33:"4",34:"5",35:"6",36:"7",37:"8",38:"9",39:"0",40:"\n",41:"esc",42:"del",43:"\t",44:" ",45:"-",47:"[",48:"]",56:"/",57:"CapsLock",79:"RightArrow",80:"LetfArrow"
}
M= {
0:"",2:"PostFail",4:"A",5:"B",6:"C",7:"D",8:"E",9:"F",10:"G",11:"H",12:"I",13:"J",14:"K",15:"L",16:"M",17:"N",18:"O",19:"P",20:"Q",21:"R",22:"S",23:"T",24:"U",25:"V",26:"W",27:"X",28:"Y",29:"Z",30:"!",31:"@",32:"#",33:"$",34:"%",35:"^",36:"&",37:"*",38:"(",39:")",40:"\n",41:"esc",42:"del",43:"\t",44:" ",45:"_",47:"{",48:"}",56:"?",57:"CapsLock",79:"RightArrow",80:"LetfArrow"
}
g = 0
for i in data:
if "usb.capdata" in i["_source"]["layers"]:
a = map(lambda x:int(x,16),i["_source"]["layers"]["usb.capdata"].split(":"))
if len(a)==8:
if a[0]: print(g,M[a[2]],end="\n")
else: print(g,m[a[2]],end="\n")
g+=1
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment