Skip to content

Commit

Permalink
Fix bug in Call information
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev4Mod authored Oct 21, 2024
1 parent b69904e commit 6b7a321
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ private void callInfo() throws Exception {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
var wamCall = param.thisObject;
var ip = XposedHelpers.getObjectField(wamCall, "callSelfIpStr").toString();
var platform = XposedHelpers.getObjectField(wamCall, "callPeerPlatform").toString();
var ip = (String)XposedHelpers.getObjectField(wamCall, "callPeerIpStr");
var platform = (String)XposedHelpers.getObjectField(wamCall, "callPeerPlatform");
CompletableFuture.runAsync(() -> {
try {
showCallInformation(ip, platform);
Expand All @@ -202,16 +202,18 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}

private void showCallInformation(String ip, String platform) throws Exception {
var db = new StringBuilder();
if (ip != null) {
var client = new OkHttpClient();
var url = "http://ip-api.com/json/" + ip;
var request = new okhttp3.Request.Builder().url(url).build();
var content = client.newCall(request).execute().body().string();
var json = new JSONObject(content);
var country = json.getString("country");
var city = json.getString("city");
var db = new StringBuilder();
db.append("Country: ").append(country).append("\n");
db.append("City: ").append(city).append("\n");
}
db.append("Platform: ").append(platform).append("\n");
db.append("IP: ").append(ip).append("\n");
Utils.showNotification("Call Information", db.toString());
Expand Down

0 comments on commit 6b7a321

Please sign in to comment.