Created
October 10, 2018 23:41
-
-
Save pdelteil/c033e0fa8cf2c80ad6b52ce867b30384 to your computer and use it in GitHub Desktop.
Program to solve HTB challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
#print "file: " + sys.argv[1] | |
myKeys = open(sys.argv[1]) | |
#keymappings ref (pag 53) https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf | |
newmap = { | |
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: "$", 34: "5", 35: "6", 36: "7", 37: "8", 38: "9", 39: "0", | |
40: "Enter", 41: "esc", 42: "del", 43: "tab", 44: "space", | |
45: "-", 46: "=", 47: "{", 48: "}",49: "|", 52: "'", 55: ".", 56: "/", 57: "CapsLock", | |
79: "RightArrow", 80: "LetfArrow"} | |
i = 1 | |
for line in myKeys: | |
bytesArray = bytearray.fromhex(line.strip()) | |
# print "Line Number: " + str(i) | |
for byte in bytesArray: | |
if byte != 0: | |
# print "byte " + str(byte) | |
keyVal = int(byte) | |
#print "keyVal " + str(keyVal) | |
if keyVal in newmap: | |
print newmap[keyVal] | |
else: | |
print "No map found for this value: " + str(keyVal) | |
#print format(byte, '02X') | |
i+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment