You've already forked ZygiskNext
mirror of
https://github.com/Dr-TSNG/ZygiskNext.git
synced 2025-08-27 23:46:34 +00:00
Add version info to logs
This commit is contained in:
@@ -5,6 +5,10 @@ plugins {
|
|||||||
alias(libs.plugins.agp.lib)
|
alias(libs.plugins.agp.lib)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val verCode: Int by rootProject.extra
|
||||||
|
val verName: String by rootProject.extra
|
||||||
|
val commitHash: String by rootProject.extra
|
||||||
|
|
||||||
fun Project.findInPath(executable: String, property: String): String? {
|
fun Project.findInPath(executable: String, property: String): String? {
|
||||||
val pathEnv = System.getenv("PATH")
|
val pathEnv = System.getenv("PATH")
|
||||||
return pathEnv.split(File.pathSeparator).map { folder ->
|
return pathEnv.split(File.pathSeparator).map { folder ->
|
||||||
@@ -60,10 +64,16 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
externalNativeBuild.cmake {
|
||||||
|
arguments += "-DZKSU_VERSION=$verName-$verCode-$commitHash-debug"
|
||||||
|
}
|
||||||
|
}
|
||||||
release {
|
release {
|
||||||
externalNativeBuild.cmake {
|
externalNativeBuild.cmake {
|
||||||
cFlags += releaseFlags
|
cFlags += releaseFlags
|
||||||
cppFlags += releaseFlags
|
cppFlags += releaseFlags
|
||||||
|
arguments += "-DZKSU_VERSION=$verName-$verCode-$commitHash-release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ project("loader")
|
|||||||
|
|
||||||
find_package(cxx REQUIRED CONFIG)
|
find_package(cxx REQUIRED CONFIG)
|
||||||
|
|
||||||
|
add_definitions(-DZKSU_VERSION=\"${ZKSU_VERSION}\")
|
||||||
|
|
||||||
aux_source_directory(common COMMON_SRC_LIST)
|
aux_source_directory(common COMMON_SRC_LIST)
|
||||||
add_library(common STATIC ${COMMON_SRC_LIST})
|
add_library(common STATIC ${COMMON_SRC_LIST})
|
||||||
target_include_directories(common PRIVATE include)
|
target_include_directories(common PRIVATE include)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ void *self_handle = nullptr;
|
|||||||
|
|
||||||
extern "C" [[gnu::visibility("default")]]
|
extern "C" [[gnu::visibility("default")]]
|
||||||
void entry(void* handle, const char* path) {
|
void entry(void* handle, const char* path) {
|
||||||
LOGI("Zygisk library injected, magic %s", path);
|
LOGI("Zygisk library injected, version %s", ZKSU_VERSION);
|
||||||
self_handle = handle;
|
self_handle = handle;
|
||||||
|
|
||||||
zygiskd::Init(path);
|
zygiskd::Init(path);
|
||||||
@@ -22,6 +22,6 @@ void entry(void* handle, const char* path) {
|
|||||||
logging::setfd(zygiskd::RequestLogcatFd());
|
logging::setfd(zygiskd::RequestLogcatFd());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOGD("Start hooking");
|
LOGI("Start hooking");
|
||||||
hook_functions();
|
hook_functions();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,15 @@ int main(int argc, char **argv) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("Zygisk Next Tracer %s\n", ZKSU_VERSION);
|
||||||
printf("Usage: %s ctl start|stop|exit\n", argv[0]);
|
printf("Usage: %s ctl start|stop|exit\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (argc >= 2 && argv[1] == "version"sv) {
|
||||||
|
printf("Zygisk Next Tracer %s\n", ZKSU_VERSION);
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
LOGE("usage: %s monitor | trace <pid> | ctl <command>", argv[0]);
|
printf("Zygisk Next Tracer %s\n", ZKSU_VERSION);
|
||||||
|
printf("usage: %s monitor | trace <pid> | ctl <start|stop|exit> | version\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,6 +366,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void init_monitor() {
|
void init_monitor() {
|
||||||
|
LOGI("Zygisk Next %s", ZKSU_VERSION);
|
||||||
LOGI("init monitor started");
|
LOGI("init monitor started");
|
||||||
SocketHandler socketHandler{};
|
SocketHandler socketHandler{};
|
||||||
socketHandler.Init();
|
socketHandler.Init();
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ plugins {
|
|||||||
val minKsuVersion: Int by rootProject.extra
|
val minKsuVersion: Int by rootProject.extra
|
||||||
val maxKsuVersion: Int by rootProject.extra
|
val maxKsuVersion: Int by rootProject.extra
|
||||||
val minMagiskVersion: Int by rootProject.extra
|
val minMagiskVersion: Int by rootProject.extra
|
||||||
|
val verCode: Int by rootProject.extra
|
||||||
|
val verName: String by rootProject.extra
|
||||||
|
val commitHash: String by rootProject.extra
|
||||||
|
|
||||||
android.buildFeatures {
|
android.buildFeatures {
|
||||||
androidResources = false
|
androidResources = false
|
||||||
@@ -25,6 +28,7 @@ cargo {
|
|||||||
spec.environment("MIN_KSU_VERSION", minKsuVersion)
|
spec.environment("MIN_KSU_VERSION", minKsuVersion)
|
||||||
spec.environment("MAX_KSU_VERSION", maxKsuVersion)
|
spec.environment("MAX_KSU_VERSION", maxKsuVersion)
|
||||||
spec.environment("MIN_MAGISK_VERSION", minMagiskVersion)
|
spec.environment("MIN_MAGISK_VERSION", minMagiskVersion)
|
||||||
|
spec.environment("ZKSU_VERSION", "$verName-$verCode-$commitHash-$profile")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use crate::lp_select;
|
|||||||
pub const MIN_KSU_VERSION: i32 = unwrap_ctx!(parse_i32(env!("MIN_KSU_VERSION")));
|
pub const MIN_KSU_VERSION: i32 = unwrap_ctx!(parse_i32(env!("MIN_KSU_VERSION")));
|
||||||
pub const MAX_KSU_VERSION: i32 = unwrap_ctx!(parse_i32(env!("MAX_KSU_VERSION")));
|
pub const MAX_KSU_VERSION: i32 = unwrap_ctx!(parse_i32(env!("MAX_KSU_VERSION")));
|
||||||
pub const MIN_MAGISK_VERSION: i32 = unwrap_ctx!(parse_i32(env!("MIN_MAGISK_VERSION")));
|
pub const MIN_MAGISK_VERSION: i32 = unwrap_ctx!(parse_i32(env!("MIN_MAGISK_VERSION")));
|
||||||
|
pub const ZKSU_VERSION: &'static str = env!("ZKSU_VERSION");
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
pub const MAX_LOG_LEVEL: LevelFilter = LevelFilter::Trace;
|
pub const MAX_LOG_LEVEL: LevelFilter = LevelFilter::Trace;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ mod zygiskd;
|
|||||||
mod companion;
|
mod companion;
|
||||||
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use anyhow::Result;
|
use crate::constants::ZKSU_VERSION;
|
||||||
|
|
||||||
fn init_android_logger(tag: &str) {
|
fn init_android_logger(tag: &str) {
|
||||||
android_logger::init_once(
|
android_logger::init_once(
|
||||||
@@ -22,6 +22,9 @@ fn start() {
|
|||||||
let fd: i32 = args[2].parse().unwrap();
|
let fd: i32 = args[2].parse().unwrap();
|
||||||
companion::entry(fd);
|
companion::entry(fd);
|
||||||
return;
|
return;
|
||||||
|
} else if args.len() == 2 && args[1] == "version" {
|
||||||
|
println!("Zygisk Next daemon {}", ZKSU_VERSION);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::switch_mount_namespace(1).expect("switch mnt ns");
|
utils::switch_mount_namespace(1).expect("switch mnt ns");
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() -> Result<()> {
|
pub fn main() -> Result<()> {
|
||||||
log::info!("Start zygisk companion");
|
log::info!("Welcome to Zygisk Next ({}) !", constants::ZKSU_VERSION);
|
||||||
|
|
||||||
let arch = get_arch()?;
|
let arch = get_arch()?;
|
||||||
log::debug!("Daemon architecture: {arch}");
|
log::debug!("Daemon architecture: {arch}");
|
||||||
|
|||||||
Reference in New Issue
Block a user