You've already forked PlayIntegrityFork
mirror of
https://github.com/osm0sis/PlayIntegrityFork.git
synced 2025-09-06 06:37:06 +00:00
Add granular advanced spoofing options
This commit is contained in:
@@ -14,6 +14,10 @@
|
|||||||
#define CUSTOM_JSON_FILE_PATH "/data/adb/modules/playintegrityfix/custom.pif.json"
|
#define CUSTOM_JSON_FILE_PATH "/data/adb/modules/playintegrityfix/custom.pif.json"
|
||||||
|
|
||||||
static int verboseLogs = 0;
|
static int verboseLogs = 0;
|
||||||
|
static int spoofBuild = 1;
|
||||||
|
static int spoofProps = 1;
|
||||||
|
static int spoofProvider = 1;
|
||||||
|
static int spoofSignature = 0;
|
||||||
|
|
||||||
static std::map<std::string, std::string> jsonProps;
|
static std::map<std::string, std::string> jsonProps;
|
||||||
|
|
||||||
@@ -164,7 +168,7 @@ public:
|
|||||||
if (dexVector.empty() || json.empty()) return;
|
if (dexVector.empty() || json.empty()) return;
|
||||||
|
|
||||||
readJson();
|
readJson();
|
||||||
doHook();
|
if (spoofProps > 0) doHook();
|
||||||
inject();
|
inject();
|
||||||
|
|
||||||
dexVector.clear();
|
dexVector.clear();
|
||||||
@@ -184,7 +188,7 @@ private:
|
|||||||
void readJson() {
|
void readJson() {
|
||||||
LOGD("JSON contains %d keys!", static_cast<int>(json.size()));
|
LOGD("JSON contains %d keys!", static_cast<int>(json.size()));
|
||||||
|
|
||||||
// Verbose logging if verboseLogs with level number is present
|
// Verbose logging
|
||||||
if (json.contains("verboseLogs")) {
|
if (json.contains("verboseLogs")) {
|
||||||
if (!json["verboseLogs"].is_null() && json["verboseLogs"].is_string() && json["verboseLogs"] != "") {
|
if (!json["verboseLogs"].is_null() && json["verboseLogs"].is_string() && json["verboseLogs"] != "") {
|
||||||
verboseLogs = stoi(json["verboseLogs"].get<std::string>());
|
verboseLogs = stoi(json["verboseLogs"].get<std::string>());
|
||||||
@@ -195,6 +199,44 @@ private:
|
|||||||
json.erase("verboseLogs");
|
json.erase("verboseLogs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Advanced spoofing settings
|
||||||
|
if (json.contains("spoofBuild")) {
|
||||||
|
if (!json["spoofBuild"].is_null() && json["spoofBuild"].is_string() && json["spoofBuild"] != "") {
|
||||||
|
spoofBuild = stoi(json["spoofBuild"].get<std::string>());
|
||||||
|
if (verboseLogs > 0) LOGD("Spoofing Build Fields set to %d!", spoofBuild);
|
||||||
|
} else {
|
||||||
|
LOGD("Error parsing spoofBuild!");
|
||||||
|
}
|
||||||
|
json.erase("spoofBuild");
|
||||||
|
}
|
||||||
|
if (json.contains("spoofProps")) {
|
||||||
|
if (!json["spoofProps"].is_null() && json["spoofProps"].is_string() && json["spoofProps"] != "") {
|
||||||
|
spoofProps = stoi(json["spoofProps"].get<std::string>());
|
||||||
|
if (verboseLogs > 0) LOGD("Spoofing System Properties set to %d!", spoofProps);
|
||||||
|
} else {
|
||||||
|
LOGD("Error parsing spoofProps!");
|
||||||
|
}
|
||||||
|
json.erase("spoofProps");
|
||||||
|
}
|
||||||
|
if (json.contains("spoofProvider")) {
|
||||||
|
if (!json["spoofProvider"].is_null() && json["spoofProvider"].is_string() && json["spoofProvider"] != "") {
|
||||||
|
spoofProvider = stoi(json["spoofProvider"].get<std::string>());
|
||||||
|
if (verboseLogs > 0) LOGD("Spoofing Keystore Provider set to %d!", spoofProvider);
|
||||||
|
} else {
|
||||||
|
LOGD("Error parsing spoofProvider!");
|
||||||
|
}
|
||||||
|
json.erase("spoofProvider");
|
||||||
|
}
|
||||||
|
if (json.contains("spoofSignature")) {
|
||||||
|
if (!json["spoofSignature"].is_null() && json["spoofSignature"].is_string() && json["spoofSignature"] != "") {
|
||||||
|
spoofSignature = stoi(json["spoofSignature"].get<std::string>());
|
||||||
|
if (verboseLogs > 0) LOGD("Spoofing ROM Signature set to %d!", spoofSignature);
|
||||||
|
} else {
|
||||||
|
LOGD("Error parsing spoofSignature!");
|
||||||
|
}
|
||||||
|
json.erase("spoofSignature");
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> eraseKeys;
|
std::vector<std::string> eraseKeys;
|
||||||
for (auto &jsonList: json.items()) {
|
for (auto &jsonList: json.items()) {
|
||||||
if (verboseLogs > 1) LOGD("Parsing %s", jsonList.key().c_str());
|
if (verboseLogs > 1) LOGD("Parsing %s", jsonList.key().c_str());
|
||||||
@@ -244,8 +286,8 @@ private:
|
|||||||
env->CallStaticVoidMethod(entryClass, receiveJson, javaStr);
|
env->CallStaticVoidMethod(entryClass, receiveJson, javaStr);
|
||||||
|
|
||||||
LOGD("JNI: Calling init");
|
LOGD("JNI: Calling init");
|
||||||
auto entryInit = env->GetStaticMethodID(entryClass, "init", "(I)V");
|
auto entryInit = env->GetStaticMethodID(entryClass, "init", "(IIII)V");
|
||||||
env->CallStaticVoidMethod(entryClass, entryInit, verboseLogs);
|
env->CallStaticVoidMethod(entryClass, entryInit, verboseLogs, spoofBuild, spoofProvider, spoofSignature);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,4 +38,4 @@ public class CustomPackageInfoCreator implements Parcelable.Creator<PackageInfo>
|
|||||||
public PackageInfo[] newArray(int size) {
|
public PackageInfo[] newArray(int size) {
|
||||||
return originalCreator.newArray(size);
|
return originalCreator.newArray(size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ public final class CustomProvider extends Provider {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized Service getService(String type, String algorithm) {
|
public synchronized Service getService(String type, String algorithm) {
|
||||||
if (EntryPoint.getVerboseLogs() > 2) EntryPoint.LOG(String.format("Service: Caller type '%s' with algorithm '%s'", type, algorithm));
|
if (EntryPoint.getVerboseLogs() > 2) EntryPoint.LOG(String.format("Service: Caller type '%s' with algorithm '%s'", type, algorithm));
|
||||||
if (type.equals("KeyStore")) EntryPoint.spoofDevice();
|
if (EntryPoint.getSpoofBuildEnabled() > 0) {
|
||||||
|
if (type.equals("KeyStore")) EntryPoint.spoofDevice();
|
||||||
|
}
|
||||||
return super.getService(type, algorithm);
|
return super.getService(type, algorithm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public final class EntryPoint {
|
public final class EntryPoint {
|
||||||
private static Integer verboseLogs = 0;
|
private static Integer verboseLogs = 0;
|
||||||
|
private static Integer spoofBuildEnabled = 1;
|
||||||
|
|
||||||
private static final String signatureData = "MIIFyTCCA7GgAwIBAgIVALyxxl+zDS9SL68SzOr48309eAZyMA0GCSqGSIb3DQEBCwUAMHQxCzAJ\n" +
|
private static final String signatureData = "MIIFyTCCA7GgAwIBAgIVALyxxl+zDS9SL68SzOr48309eAZyMA0GCSqGSIb3DQEBCwUAMHQxCzAJ\n" +
|
||||||
"BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw\n" +
|
"BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw\n" +
|
||||||
@@ -61,12 +62,17 @@ public final class EntryPoint {
|
|||||||
return verboseLogs;
|
return verboseLogs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(int level) {
|
public static Integer getSpoofBuildEnabled() {
|
||||||
verboseLogs = level;
|
return spoofBuildEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(int logLevel, int spoofBuildVal, int spoofProviderVal, int spoofSignatureVal) {
|
||||||
|
verboseLogs = logLevel;
|
||||||
|
spoofBuildEnabled = spoofBuildVal;
|
||||||
if (verboseLogs > 99) logFields();
|
if (verboseLogs > 99) logFields();
|
||||||
spoofProvider();
|
if (spoofProviderVal > 0) spoofProvider();
|
||||||
spoofPackageManager();
|
if (spoofBuildVal > 0) spoofDevice();
|
||||||
spoofDevice();
|
if (spoofSignatureVal > 0) spoofPackageManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void receiveJson(String data) {
|
public static void receiveJson(String data) {
|
||||||
|
|||||||
@@ -129,6 +129,10 @@ echo ' "*.security_patch": "'$SECURITY_PATCH'",';
|
|||||||
echo ' "*api_level": "'$DEVICE_INITIAL_SDK_INT'",';
|
echo ' "*api_level": "'$DEVICE_INITIAL_SDK_INT'",';
|
||||||
if [ "$ADVANCED" ]; then
|
if [ "$ADVANCED" ]; then
|
||||||
echo "$N // Advanced Settings";
|
echo "$N // Advanced Settings";
|
||||||
|
echo ' "spoofBuild": "1",';
|
||||||
|
echo ' "spoofProps": "1",';
|
||||||
|
echo ' "spoofProvider": "1",';
|
||||||
|
echo ' "spoofSignature": "0",';
|
||||||
echo ' "verboseLogs": "0",';
|
echo ' "verboseLogs": "0",';
|
||||||
fi) | sed '$s/,/\n}/' > "$OUT";
|
fi) | sed '$s/,/\n}/' > "$OUT";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user