Created
November 11, 2022 02:15
-
-
Save SeeFlowerX/a4dc476ed289acb7cecb3ddd72df31ac 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
function log(message: string): void { | |
console.log(message); | |
} | |
function hook_demo(){ | |
hook_java(); | |
} | |
function hook_java() { | |
Java.perform(function() { | |
hook_Md5Utils(); | |
}) | |
} | |
function hook_Md5Utils() { | |
function hook_md5String() { | |
let target_method = "md5String"; | |
cls[target_method].implementation = function () { | |
let [text] = arguments; | |
let md5_hex = this[target_method].apply(this, arguments); | |
log(`[${TAG}.${target_method}] ${text} ${md5_hex}`); | |
return md5_hex; | |
} | |
} | |
function hook_md5File() { | |
let target_method = "md5File"; | |
cls[target_method].implementation = function () { | |
let [file] = arguments; | |
let md5_hex = this[target_method].apply(this, arguments); | |
log(`[${TAG}.${target_method}] ${file} ${md5_hex}`); | |
return md5_hex; | |
} | |
} | |
let target_class = "com.sfx.demo.Md5Utils"; | |
let TAG = target_class.split(".").pop(); | |
let cls = Java.use(target_class); | |
hook_md5String(); | |
hook_md5File(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment