-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.js
43 lines (34 loc) · 1.62 KB
/
debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Java.perform(function () {
// Hook java.security.KeyPairGenerator
var KeyPairGenerator = Java.use("java.security.KeyPairGenerator");
KeyPairGenerator.getInstance.overload('java.lang.String').implementation = function (algorithm) {
console.log("[*] KeyPairGenerator.getInstance called with algorithm: " + algorithm);
return this.getInstance(algorithm);
};
KeyPairGenerator.generateKeyPair.implementation = function () {
console.log("[*] KeyPairGenerator.generateKeyPair called");
return this.generateKeyPair();
};
// Hook java.security.Signature
var Signature = Java.use("java.security.Signature");
Signature.getInstance.overload('java.lang.String').implementation = function (algorithm) {
console.log("[*] Signature.getInstance called with algorithm: " + algorithm);
return this.getInstance(algorithm);
};
Signature.sign.implementation = function () {
console.log("[*] Signature.sign called");
return this.sign();
};
// Hook java.security.PrivateKey
var RSAPrivateKey = Java.use("java.security.interfaces.RSAPrivateKey");
RSAPrivateKey.sign.implementation = function (data) {
console.log("[*] RSAPrivateKey.sign called with data: " + data);
return this.sign(data);
};
// Hook java.security.PublicKey
var RSAPublicKey = Java.use("java.security.interfaces.RSAPublicKey");
RSAPublicKey.verify.implementation = function (data, signature) {
console.log("[*] RSAPublicKey.verify called with data: " + data + ", signature: " + signature);
return this.verify(data, signature);
};
});