parent
ed4d0867e8
commit
6865652125
@ -66,7 +66,7 @@ open class FlashZip(
|
||||
|
||||
console.add("- Installing ${mUri.displayName}")
|
||||
|
||||
return Shell.su("sh $installDir/update-binary dummy 1 \"$zipFile\"")
|
||||
return Shell.su("sh $installDir/update-binary dummy 1 \'$zipFile\'")
|
||||
.to(console, logs).exec().isSuccess
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class HideProcessRvItem(
|
||||
set(value) = set(value, process.isHidden, { process.isHidden = it }, BR.hidden) {
|
||||
val arg = if (it) "add" else "rm"
|
||||
val (name, pkg) = process
|
||||
Shell.su("magiskhide $arg $pkg $name").submit()
|
||||
Shell.su("magiskhide $arg $pkg \'$name\'").submit()
|
||||
}
|
||||
|
||||
fun toggle() {
|
||||
|
@ -108,6 +108,8 @@ static bool validate(const char *s) {
|
||||
(c >= '0' && c <= '9') || c == '_' || c == ':') {
|
||||
continue;
|
||||
}
|
||||
if (SDK_INT >= 29 && c == '$')
|
||||
continue;
|
||||
if (c == '.') {
|
||||
dot = true;
|
||||
continue;
|
||||
@ -333,7 +335,7 @@ void auto_start_magiskhide(bool late_props) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_hide_target(int uid, string_view process) {
|
||||
bool is_hide_target(int uid, string_view process, int max_len) {
|
||||
mutex_guard lock(hide_state_lock);
|
||||
|
||||
if (uid % 100000 >= 90000) {
|
||||
@ -343,6 +345,8 @@ bool is_hide_target(int uid, string_view process) {
|
||||
return false;
|
||||
|
||||
for (auto &s : it->second) {
|
||||
if (s.length() > max_len && process.length() > max_len && str_starts(s, process))
|
||||
return true;
|
||||
if (str_starts(process, s))
|
||||
return true;
|
||||
}
|
||||
@ -352,6 +356,8 @@ bool is_hide_target(int uid, string_view process) {
|
||||
return false;
|
||||
|
||||
for (auto &s : it->second) {
|
||||
if (s.length() > max_len && process.length() > max_len && str_starts(s, process))
|
||||
return true;
|
||||
if (s == process)
|
||||
return true;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void crawl_procfs(const std::function<bool (int)> &fn);
|
||||
void crawl_procfs(DIR *dir, const std::function<bool (int)> &fn);
|
||||
bool hide_enabled();
|
||||
void update_uid_map();
|
||||
bool is_hide_target(int uid, std::string_view process);
|
||||
bool is_hide_target(int uid, std::string_view process, int max_len = 1024);
|
||||
|
||||
// Hide policies
|
||||
void hide_daemon(int pid);
|
||||
|
@ -212,7 +212,7 @@ static bool check_pid(int pid) {
|
||||
cmdline == "usap32"sv || cmdline == "usap64"sv)
|
||||
return false;
|
||||
|
||||
if (!is_hide_target(uid, cmdline))
|
||||
if (!is_hide_target(uid, cmdline, 95))
|
||||
goto not_target;
|
||||
|
||||
// Ensure ns is separated
|
||||
|
@ -71,7 +71,7 @@ static inline bool str_contains(std::string_view s, std::string_view ss) {
|
||||
return s.find(ss) != std::string::npos;
|
||||
}
|
||||
static inline bool str_starts(std::string_view s, std::string_view ss) {
|
||||
return s.rfind(ss, 0) == 0;
|
||||
return s.size() >= ss.size() && s.compare(0, ss.size(), ss) == 0;
|
||||
}
|
||||
static inline bool str_ends(std::string_view s, std::string_view ss) {
|
||||
return s.size() >= ss.size() && s.compare(s.size() - ss.size(), std::string::npos, ss) == 0;
|
||||
|
Loading…
Reference in New Issue
Block a user