mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
scripts: add 010Editor template for allowlist file
This commit is contained in:
parent
32b3ec9844
commit
88e20d102d
85
scripts/allowlist.bt
Normal file
85
scripts/allowlist.bt
Normal file
@ -0,0 +1,85 @@
|
||||
// Define constants as per the provided structure.
|
||||
#define KSU_MAX_PACKAGE_NAME 256
|
||||
#define KSU_MAX_GROUPS 32
|
||||
#define KSU_SELINUX_DOMAIN 64
|
||||
|
||||
// Define the root_profile structure with padding for 64-bit alignment.
|
||||
struct root_profile {
|
||||
int uid;
|
||||
int gid;
|
||||
|
||||
int groups_count;
|
||||
int groups[KSU_MAX_GROUPS];
|
||||
char padding1[4]; // Padding for 64-bit alignment.
|
||||
|
||||
struct {
|
||||
uint64 effective;
|
||||
uint64 permitted;
|
||||
uint64 inheritable;
|
||||
} capabilities;
|
||||
|
||||
char selinux_domain[KSU_SELINUX_DOMAIN];
|
||||
|
||||
int namespaces;
|
||||
char padding2[4]; // Padding for 64-bit alignment.
|
||||
};
|
||||
|
||||
// Define the non_root_profile structure with padding for 64-bit alignment.
|
||||
struct non_root_profile {
|
||||
byte umount_modules;
|
||||
char padding[7]; // Padding to make the total size a multiple of 8.
|
||||
};
|
||||
|
||||
// Define the rp_config structure with padding for 64-bit alignment.
|
||||
struct rp_config_t {
|
||||
byte use_default;
|
||||
char padding[7]; // Padding to make the total size a multiple of 8.
|
||||
char template_name[KSU_MAX_PACKAGE_NAME];
|
||||
|
||||
struct root_profile profile;
|
||||
};
|
||||
|
||||
// Define the nrp_config structure with padding for 64-bit alignment.
|
||||
struct nrp_config_t {
|
||||
byte use_default;
|
||||
char padding[7]; // Padding to make the total size a multiple of 8.
|
||||
|
||||
struct non_root_profile profile;
|
||||
};
|
||||
|
||||
// Define the main app_profile structure
|
||||
typedef struct {
|
||||
uint32 version;
|
||||
char key[KSU_MAX_PACKAGE_NAME];
|
||||
int32 current_uid;
|
||||
int64 allow_su;
|
||||
|
||||
// Based on allow_su, decide which profile to use
|
||||
if (allow_su != 0) {
|
||||
rp_config_t rp_config;
|
||||
} else {
|
||||
nrp_config_t nrp_config;
|
||||
}
|
||||
|
||||
} app_profile;
|
||||
|
||||
// Define the file header with magic number and version
|
||||
typedef struct {
|
||||
uint32 magic;
|
||||
uint32 version;
|
||||
} file_header;
|
||||
|
||||
// Main entry for parsing the file
|
||||
file_header header;
|
||||
|
||||
if (header.magic != 0x7f4b5355) {
|
||||
Printf("Invalid file magic number.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
FSeek(8); // Skip the header
|
||||
|
||||
// Continually read app_profile instances until end of file
|
||||
while (!FEof()) {
|
||||
app_profile profile;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user