You've already forked TrickyStore
mirror of
https://github.com/5ec1cff/TrickyStore.git
synced 2025-09-06 06:37:07 +00:00
fix config observer
This commit is contained in:
@@ -34,12 +34,12 @@ object Config {
|
|||||||
private const val KEYBOX_FILE = "keybox.xml"
|
private const val KEYBOX_FILE = "keybox.xml"
|
||||||
private val root = File(CONFIG_PATH)
|
private val root = File(CONFIG_PATH)
|
||||||
|
|
||||||
object ConfigObserver : FileObserver(root, CLOSE_WRITE or DELETE) {
|
object ConfigObserver : FileObserver(root, CLOSE_WRITE or DELETE or MOVED_FROM or MOVED_TO) {
|
||||||
override fun onEvent(event: Int, path: String?) {
|
override fun onEvent(event: Int, path: String?) {
|
||||||
path ?: return
|
path ?: return
|
||||||
val f = when (event) {
|
val f = when (event) {
|
||||||
CLOSE_WRITE -> File(root, path)
|
CLOSE_WRITE, MOVED_TO -> File(root, path)
|
||||||
DELETE -> null
|
DELETE, MOVED_FROM -> null
|
||||||
else -> return
|
else -> return
|
||||||
}
|
}
|
||||||
when (path) {
|
when (path) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ object KeystoreInterceptor : BinderInterceptor() {
|
|||||||
callingPid: Int,
|
callingPid: Int,
|
||||||
data: Parcel
|
data: Parcel
|
||||||
): Result {
|
): Result {
|
||||||
if (code == targetTransaction) {
|
if (code == targetTransaction && CertHack.canHack() && Config.targetPackages.isNotEmpty()) {
|
||||||
Logger.d("intercept pre $target uid=$callingUid pid=$callingPid dataSz=${data.dataSize()}")
|
Logger.d("intercept pre $target uid=$callingUid pid=$callingPid dataSz=${data.dataSize()}")
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
val ps = getPm()?.getPackagesForUid(callingUid)
|
val ps = getPm()?.getPackagesForUid(callingUid)
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ public final class CertHack {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canHack() {
|
||||||
|
return !keyboxes.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public static void readFromXml(String data) {
|
public static void readFromXml(String data) {
|
||||||
keyboxes.clear();
|
keyboxes.clear();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@@ -91,7 +95,7 @@ public final class CertHack {
|
|||||||
}
|
}
|
||||||
Logger.i("update " + numberOfKeyboxes + " keyboxes");
|
Logger.i("update " + numberOfKeyboxes + " keyboxes");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Logger.e("Error loading xml file: " + t);
|
Logger.e("Error loading xml file (keyboxes cleared): " + t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user