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"
|
||||
|
||||
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;
|
||||
|
||||
@@ -164,7 +168,7 @@ public:
|
||||
if (dexVector.empty() || json.empty()) return;
|
||||
|
||||
readJson();
|
||||
doHook();
|
||||
if (spoofProps > 0) doHook();
|
||||
inject();
|
||||
|
||||
dexVector.clear();
|
||||
@@ -184,7 +188,7 @@ private:
|
||||
void readJson() {
|
||||
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["verboseLogs"].is_null() && json["verboseLogs"].is_string() && json["verboseLogs"] != "") {
|
||||
verboseLogs = stoi(json["verboseLogs"].get<std::string>());
|
||||
@@ -195,6 +199,44 @@ private:
|
||||
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;
|
||||
for (auto &jsonList: json.items()) {
|
||||
if (verboseLogs > 1) LOGD("Parsing %s", jsonList.key().c_str());
|
||||
@@ -244,8 +286,8 @@ private:
|
||||
env->CallStaticVoidMethod(entryClass, receiveJson, javaStr);
|
||||
|
||||
LOGD("JNI: Calling init");
|
||||
auto entryInit = env->GetStaticMethodID(entryClass, "init", "(I)V");
|
||||
env->CallStaticVoidMethod(entryClass, entryInit, verboseLogs);
|
||||
auto entryInit = env->GetStaticMethodID(entryClass, "init", "(IIII)V");
|
||||
env->CallStaticVoidMethod(entryClass, entryInit, verboseLogs, spoofBuild, spoofProvider, spoofSignature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -38,4 +38,4 @@ public class CustomPackageInfoCreator implements Parcelable.Creator<PackageInfo>
|
||||
public PackageInfo[] newArray(int size) {
|
||||
return originalCreator.newArray(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ public final class CustomProvider extends Provider {
|
||||
@Override
|
||||
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 (type.equals("KeyStore")) EntryPoint.spoofDevice();
|
||||
if (EntryPoint.getSpoofBuildEnabled() > 0) {
|
||||
if (type.equals("KeyStore")) EntryPoint.spoofDevice();
|
||||
}
|
||||
return super.getService(type, algorithm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Map;
|
||||
|
||||
public final class EntryPoint {
|
||||
private static Integer verboseLogs = 0;
|
||||
private static Integer spoofBuildEnabled = 1;
|
||||
|
||||
private static final String signatureData = "MIIFyTCCA7GgAwIBAgIVALyxxl+zDS9SL68SzOr48309eAZyMA0GCSqGSIb3DQEBCwUAMHQxCzAJ\n" +
|
||||
"BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw\n" +
|
||||
@@ -61,12 +62,17 @@ public final class EntryPoint {
|
||||
return verboseLogs;
|
||||
}
|
||||
|
||||
public static void init(int level) {
|
||||
verboseLogs = level;
|
||||
public static Integer getSpoofBuildEnabled() {
|
||||
return spoofBuildEnabled;
|
||||
}
|
||||
|
||||
public static void init(int logLevel, int spoofBuildVal, int spoofProviderVal, int spoofSignatureVal) {
|
||||
verboseLogs = logLevel;
|
||||
spoofBuildEnabled = spoofBuildVal;
|
||||
if (verboseLogs > 99) logFields();
|
||||
spoofProvider();
|
||||
spoofPackageManager();
|
||||
spoofDevice();
|
||||
if (spoofProviderVal > 0) spoofProvider();
|
||||
if (spoofBuildVal > 0) spoofDevice();
|
||||
if (spoofSignatureVal > 0) spoofPackageManager();
|
||||
}
|
||||
|
||||
public static void receiveJson(String data) {
|
||||
|
||||
Reference in New Issue
Block a user