-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
android_handlers.js
78 lines (63 loc) · 2.44 KB
/
android_handlers.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*************************************************************************************
* Name: Intercept Encrypted API
* OS: Android
* Author: @noobpk
* Source: https://github.com/noobpk/frida-intercept-encrypted-api
**************************************************************************************/
'use strict';
var colors = {
"resetColor": "\x1b[0m",
"green": "\x1b[32m",
"yellow": "\x1b[33m",
"red": "\x1b[31m"
}
Java.perform(function () {
/*Request Class & Method*/
var request_class = Java.use('');
var request_method = '';
/*Response Class & Method*/
var response_class = Java.use('');
var response_method = '';
request_class.request_method.overload('java.lang.String').implementation = function (arg0) {
console.log(colors.green, "[Original Request Body]\n", colors.resetColor, JSON.stringify(arg0), '\n');
var js = {};
send({ from: '/http', payload: JSON.stringify(js), api_path: 'request' })
var rcv_data = "FAILURE";
var op = recv('input', function (value) {
console.log(colors.green, "Data type: " + typeof value.payload);
if (typeof value.payload == 'object') {
rcv_data = JSON.stringify(value.payload);
} else {
rcv_data = value.payload;
}
}).wait();
if (rcv_data === "FAILURE") {
var result = this.request_method(request);
}
else {
var result = this.request_method(rcv_data);
}
return result;
}
response_class.response_method.overload('java.lang.String').implementation = function (arg0) {
console.log(colors.green, "[Original Response Body]\n", colors.resetColor, JSON.stringify(arg0), '\n');
var js = {};
send({ from: '/http', payload: JSON.stringify(js), api_path: 'response' })
var rcv_data = "FAILURE";
var op = recv('input', function (value) {
console.log(colors.green, "Data type: " + typeof value.payload);
if (typeof value.payload == 'object') {
rcv_data = JSON.stringify(value.payload);
} else {
rcv_data = value.payload;
}
}).wait();
if (rcv_data === "FAILURE") {
var result = this.response_method(response);
}
else {
var result = this.response_method(rcv_data);
}
return result;
}
});