this is my method i want to print the value of session id and device id , this is my code also suggest some documentation where i can learn more about frida
public static String generateHashForDeviceSignature() {
String sessionId = AppUtil.getSessionId();
if (AppUtil.getDeviceId() == null || AppUtil.getDeviceId().equals("")) {
AppUtil.setUniqueDeviceID(AppUtil.getAppContext());
}
String deviceId = AppUtil.getDeviceId();
new SecureRandom().nextBytes(new byte[1024]);
StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(sessionId)) { deviceId = sessionId + "|" + deviceId;
}
try {
MessageDigest instance = MessageDigest.getInstance("SHA-256");
instance.update(deviceId.getBytes());
byte[] digest = instance.digest();
int length = digest.length;
for (int i = 0; i < length; i++) {
sb.append(String.format("%02x", new Object[]{Integer.valueOf(digest[i] &255)}));
}
} catch (Exception unused) {
}
return sb.toString();
}
}
this is my method i want to print the value of session id and device id , this is my code also suggest some documentation where i can learn more about frida.
Java.perform(() => {
var classInstanceIdResult = Java.use('com.androidapp.main.utils.CryptoUtil');
var classInstanceIdAppUtil = Java.use('com.androidapp.main.utils.AppUtil');
var getTokenMethod = classInstanceIdResult.generateHashForDeviceSignature.overload();
var getgetDeviceId = classInstanceIdResult.getDeviceId.overload();
var getgetSessionId = classInstanceIdResult.getSessionId.overload();
// replace the getToken() method with out own implementation
getTokenMethod.implementation = function () {
// call the orignal method
var ret = getTokenMethod.call(this);
// do something with ret
console.log("deviceId: " + ret.deviceId);
console.log("Token: " + ret);
return ret;
};
I can print the final out put of the method but saying undefined on variable console log.