Test v14.1

This commit is contained in:
chiteroman 2023-12-03 14:32:47 +01:00
parent fa15834c71
commit c1f1c77811
No known key found for this signature in database
GPG Key ID: 19171A27D600CC72
6 changed files with 45 additions and 29 deletions

View File

@ -12,7 +12,7 @@
#define JSON_FILE_PATH "/data/adb/pif.json"
#define DEFAULT_FIRST_API_LEVEL "23"
#define JSON_TEMP_FILE "/data/adb/modules/playintegrityfix/temp"
static std::string FIRST_API_LEVEL, SECURITY_PATCH;
@ -29,19 +29,16 @@ static void modify_callback(void *cookie, const char *name, const char *value, u
std::string_view prop(name);
if (prop.ends_with("api_level")) {
if (FIRST_API_LEVEL.empty()) {
LOGD("[%s]: %s -> %s", name, value, DEFAULT_FIRST_API_LEVEL);
return callbacks[cookie](cookie, name, DEFAULT_FIRST_API_LEVEL, serial);
} else {
LOGD("[%s]: %s -> %s", name, value, FIRST_API_LEVEL.c_str());
return callbacks[cookie](cookie, name, FIRST_API_LEVEL.c_str(), serial);
if (!FIRST_API_LEVEL.empty()) {
value = FIRST_API_LEVEL.c_str();
LOGD("[%s]: %s", name, value);
}
}
if (prop.ends_with("security_patch")) {
if (!SECURITY_PATCH.empty()) {
LOGD("[%s]: %s -> %s", name, value, SECURITY_PATCH.c_str());
return callbacks[cookie](cookie, name, SECURITY_PATCH.c_str(), serial);
value = SECURITY_PATCH.c_str();
LOGD("[%s]: %s", name, value);
}
}
@ -238,7 +235,8 @@ static void companion(int fd) {
fclose(dex);
}
FILE *json = fopen(JSON_FILE_PATH, "r");
if (std::filesystem::exists(JSON_FILE_PATH)) {
FILE *json = fopen(JSON_FILE_PATH, "rb");
if (json) {
fseek(json, 0, SEEK_END);
@ -250,6 +248,20 @@ static void companion(int fd) {
fclose(json);
}
} else if (std::filesystem::exists(JSON_TEMP_FILE)) {
FILE *json = fopen(JSON_TEMP_FILE, "rb");
if (json) {
fseek(json, 0, SEEK_END);
jsonSize = ftell(json);
fseek(json, 0, SEEK_SET);
jsonVector.resize(jsonSize);
fread(jsonVector.data(), 1, jsonSize, json);
fclose(json);
}
}
write(fd, &dexSize, sizeof(long));
write(fd, &jsonSize, sizeof(long));

View File

@ -3,12 +3,6 @@ if [ "$API" -lt 26 ]; then
abort "!!! You can't use this module on Android < 8.0"
fi
# Copy default pif.json if it doesn't exist.
if [ ! -e /data/adb/pif.json ]; then
cp -af $MODPATH/pif.json /data/adb/pif.json
ui_print "Moved default pif.json file!"
fi
# SafetyNet-Fix module is obsolete and it's incompatible with PIF.
if [ -d /data/adb/modules/safetynet-fix ]; then
touch /data/adb/modules/safetynet-fix/remove

View File

@ -1,3 +1,6 @@
# Remove temp file
rm -f /data/adb/modules/playintegrityfix/temp
# Conditional sensitive properties
resetprop_if_diff() {

View File

@ -3,12 +3,6 @@ if [ "$API" -lt 26 ]; then
abort "!!! You can't use this module on Android < 8.0"
fi
# Copy default pif.json if it doesn't exist.
if [ ! -e /data/adb/pif.json ]; then
cp -af $MODPATH/pif.json /data/adb/pif.json
ui_print "- Moved default pif.json file!"
fi
# SafetyNet-Fix module is obsolete and it's incompatible with PIF.
if [ -d /data/adb/modules/safetynet-fix ]; then
touch /data/adb/modules/safetynet-fix/remove

View File

@ -1,3 +1,6 @@
# Remove temp file
rm -f /data/adb/modules/playintegrityfix/temp
# Conditional sensitive properties
RESETPROP="${0%/*}/resetprop"

10
pif.json Normal file
View File

@ -0,0 +1,10 @@
{
"PRODUCT": "WW_Phone",
"DEVICE": "ASUS_Z012D",
"MANUFACTURER": "asus",
"BRAND": "asus",
"MODEL": "ASUS_Z012D",
"FINGERPRINT": "asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2015.1701.8-20170222:user/release-keys",
"SECURITY_PATCH": "2017-01-01",
"FIRST_API_LEVEL": "23"
}