Created
January 1, 2020 14:11
-
-
Save harshitm98/a17bd7a4c66ab745ef9d14fee3d4b012 to your computer and use it in GitHub Desktop.
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 frida, sys | |
def append_zero(hex): | |
if len(hex) == 1: | |
return '0'+hex | |
return hex | |
def on_message(message, data): | |
if message['type'] == 'send': | |
byte_array = message['payload'] | |
flag = "" | |
for byte in byte_array: | |
if byte < 0: | |
flag += append_zero(str(hex(byte & 0xff))[2:]) | |
else: | |
flag += append_zero(str(hex(byte))[2:]) | |
print("[*] {}".format(flag)) | |
else: | |
print(message) | |
jscode = """ | |
Java.perform(function(){ | |
var Challenge1 = Java.use('org.nowsecure.cybertruck.keygenerators.Challenge1'); | |
Challenge1.generateDynamicKey.overload('[B').implementation = function(b){ | |
var result = this.generateDynamicKey(b); | |
console.log("[->] Flag1 Captured..."); | |
send(result); | |
return result | |
}; | |
}); | |
""" | |
process = frida.get_usb_device().attach('org.nowsecure.cybertruck') | |
script = process.create_script(jscode) | |
script.on('message', on_message) | |
script.load() | |
sys.stdin.read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment