Compare commits
3 Commits
8405b06e9a
...
e358abc840
| Author | SHA1 | Date | |
|---|---|---|---|
| e358abc840 | |||
| 054d36b04d | |||
| 424ff95d2b |
@@ -2,18 +2,10 @@ console.log("Script loaded successfully");
|
|||||||
// hook_okhttp_client()
|
// hook_okhttp_client()
|
||||||
if (Java.available) {
|
if (Java.available) {
|
||||||
hook_json()
|
hook_json()
|
||||||
Java.perform(function () {
|
let class_name = "okhttp3.OkHttpClient"
|
||||||
try {
|
if (check_class(class_name)){
|
||||||
var OkHttpClient = Java.use("okhttp3.OkHttpClient");
|
hook_okhttp_client()
|
||||||
console.log(OkHttpClient.toString())
|
}
|
||||||
if (OkHttpClient != null){
|
|
||||||
hook_okhttp_client();
|
|
||||||
log_info("OkHttp detected in the app");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
log_info("OkHttp not detected in the app");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Java.perform(function () {
|
Java.perform(function () {
|
||||||
log_info("start hook java.net.URL");
|
log_info("start hook java.net.URL");
|
||||||
var URL = Java.use('java.net.URL');
|
var URL = Java.use('java.net.URL');
|
||||||
@@ -49,10 +41,6 @@ function hook_okhttp_client() {
|
|||||||
log_info("start hook_okhttp_client.")
|
log_info("start hook_okhttp_client.")
|
||||||
try {
|
try {
|
||||||
var OkHttpClient = Java.use("okhttp3.OkHttpClient");
|
var OkHttpClient = Java.use("okhttp3.OkHttpClient");
|
||||||
// log_info("OkHttpClient: " + OkHttpClient.toString());
|
|
||||||
var class_name = OkHttpClient.$className;
|
|
||||||
console.log(class_name+ "-------")
|
|
||||||
printMethods(OkHttpClient.toString());
|
|
||||||
OkHttpClient.newCall.overload('okhttp3.Request').implementation = function (request) {
|
OkHttpClient.newCall.overload('okhttp3.Request').implementation = function (request) {
|
||||||
var requestUrl = request.url();
|
var requestUrl = request.url();
|
||||||
if (requestUrl) {
|
if (requestUrl) {
|
||||||
@@ -60,12 +48,11 @@ function hook_okhttp_client() {
|
|||||||
} else {
|
} else {
|
||||||
console.log("OkHttp Request URL is not available");
|
console.log("OkHttp Request URL is not available");
|
||||||
}
|
}
|
||||||
// console.log("OkHttp Request Headers: " + request.headers().toString());
|
console.log("OkHttp Request Headers: " + request.headers().toString());
|
||||||
|
|
||||||
// if (request.method() == "POST") {
|
|
||||||
// console.log("OkHttp Request Body: " + request.body().contentType().toString());
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
if (request.method() == "POST") {
|
||||||
|
console.log("OkHttp Request Body: " + request.body().contentType().toString());
|
||||||
|
}
|
||||||
var call = this.newCall(request);
|
var call = this.newCall(request);
|
||||||
var response = call.execute();
|
var response = call.execute();
|
||||||
console.log("OkHttp Response: " + response.body().string());
|
console.log("OkHttp Response: " + response.body().string());
|
||||||
@@ -179,4 +166,23 @@ function log_info(messages) {
|
|||||||
const timestamp = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}:${milliseconds}`;
|
const timestamp = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}:${milliseconds}`;
|
||||||
|
|
||||||
console.log(`${timestamp} - ${messages}`);
|
console.log(`${timestamp} - ${messages}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_class(class_name) {
|
||||||
|
var classFound = false; // 默认为未找到
|
||||||
|
Java.enumerateLoadedClasses({
|
||||||
|
onMatch: function(currentClassName) {
|
||||||
|
if (currentClassName === class_name) {
|
||||||
|
classFound = true; // 如果找到了类,则设置为true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onComplete: function() {
|
||||||
|
if (classFound) {
|
||||||
|
log_info(class_name + " has been loaded!");
|
||||||
|
} else {
|
||||||
|
log_info(class_name + " has not been loaded yet.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return classFound;
|
||||||
}
|
}
|
||||||
5
main.py
5
main.py
@@ -5,8 +5,11 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
FIRST_WRITE = True # 全局变量,用于跟踪是否是首次写入
|
||||||
|
|
||||||
def on_message(message, data):
|
def on_message(message, data):
|
||||||
print(message)
|
modules.files_utils.write_log(message)
|
||||||
|
# print(message)
|
||||||
# if message['type'] == 'send':
|
# if message['type'] == 'send':
|
||||||
# print(message['payload'])
|
# print(message['payload'])
|
||||||
|
|
||||||
|
|||||||
@@ -13,3 +13,11 @@ def read_javascript(script_path):
|
|||||||
with open(script_path, "r") as file:
|
with open(script_path, "r") as file:
|
||||||
script_code = file.read()
|
script_code = file.read()
|
||||||
return script_code
|
return script_code
|
||||||
|
def write_log(messages):
|
||||||
|
global FIRST_WRITE
|
||||||
|
print(f"FIRST_WRITE: {FIRST_WRITE}")
|
||||||
|
with open("frida_log.log", "a") as log_file:
|
||||||
|
if FIRST_WRITE: # 如果是首次写入
|
||||||
|
log_file.write("\n\n\n") # 空出三行
|
||||||
|
FIRST_WRITE = False # 更新状态,表明已经写过了
|
||||||
|
log_file.write(str(messages) + "\n")
|
||||||
Reference in New Issue
Block a user