You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Support dumping sepolicy rules
This commit is contained in:
@@ -23,6 +23,7 @@ Options:
|
||||
--apply FILE apply rules from FILE, read and parsed
|
||||
line by line as policy statements
|
||||
(multiple --apply are allowed)
|
||||
--print-rules print all rules in the loaded sepolicy
|
||||
|
||||
If neither --load, --load-split, nor --compile-split is specified,
|
||||
it will load from current live policies (/sys/fs/selinux/policy)
|
||||
@@ -38,6 +39,7 @@ int main(int argc, char *argv[]) {
|
||||
sepolicy *sepol = nullptr;
|
||||
bool magisk = false;
|
||||
bool live = false;
|
||||
bool print = false;
|
||||
|
||||
if (argc < 2) usage(argv[0]);
|
||||
int i = 1;
|
||||
@@ -49,6 +51,8 @@ int main(int argc, char *argv[]) {
|
||||
live = true;
|
||||
else if (option == "magisk"sv)
|
||||
magisk = true;
|
||||
else if (option == "print-rules"sv)
|
||||
print = true;
|
||||
else if (option == "load"sv) {
|
||||
if (argv[i + 1] == nullptr)
|
||||
usage(argv[0]);
|
||||
@@ -96,6 +100,11 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (print) {
|
||||
sepol->print_rules();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (magisk)
|
||||
sepol->magisk_rules();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user