44#include < sys/capability.h>
55#include " process64_inject.h"
66#include " adb64_helper.h"
7+ #include " init64_helper.h"
78#include " su_install_helper.h"
89#define ROOT_KEY 0x7F6766F8
910
@@ -97,7 +98,7 @@ void test_run_normal_cmd(const char * shell) {
9798void test_run_root_cmd (const char * cmd) {
9899 printf (" test_run_root_cmd(%s)\n " , cmd);
99100 char result[0x1000 ] = { 0 };
100- ssize_t ret = inject_adbd64_run_cmd_wrapper (ROOT_KEY, cmd, result, sizeof (result));
101+ ssize_t ret = inject_init64_run_cmd_wrapper (ROOT_KEY, cmd, result, sizeof (result));
101102 printf (" test_run_root_cmd ret val:%zd\n " , ret);
102103 printf (" test_run_root_cmd result:%s\n " , result);
103104}
@@ -117,7 +118,7 @@ void test_su_env_inject(const char* target_pid_cmdline)
117118
118119 // 1.安装su工具套件
119120 std::string su_hidden_path;
120- int install_su_tools_ret = install_su_tools (ROOT_KEY, myself_path, su_hidden_path, " su " );
121+ int install_su_tools_ret = install_su_tools (ROOT_KEY, myself_path, su_hidden_path, " adb_su " );
121122 printf (" install_su_tools ret val:%d\n " , install_su_tools_ret);
122123 if (install_su_tools_ret != 0 ) {
123124 return ;
@@ -126,17 +127,11 @@ void test_su_env_inject(const char* target_pid_cmdline)
126127 // 2.杀光所有历史进程
127128 std::vector<pid_t > vOut;
128129 int find_all_cmdline_process_ret = find_all_cmdline_process (ROOT_KEY, target_pid_cmdline, vOut);
129- printf (" find_all_cmdline_process ret val:%d, cnt:%d \n " , find_all_cmdline_process_ret, vOut.size ());
130+ printf (" find_all_cmdline_process ret val:%d, cnt:%zu \n " , find_all_cmdline_process_ret, vOut.size ());
130131 if (find_all_cmdline_process_ret != 0 ) {
131132 return ;
132133 }
133- std::string kill_cmd;
134- for (pid_t t : vOut) {
135- kill_cmd += " kill -9 " ;
136- kill_cmd += std::to_string (t);
137- kill_cmd += " ;" ;
138- }
139- int kill_ret = run_normal_cmd (ROOT_KEY, kill_cmd.c_str ());
134+ int kill_ret = kill_process_ex (ROOT_KEY, vOut);
140135 printf (" kill_ret ret val:%d\n " , kill_ret);
141136 if (kill_ret != 0 ) {
142137 return ;
@@ -163,7 +158,7 @@ void test_clean_su_env() {
163158
164159 int uninstall_su_tools_ret = uninstall_su_tools (ROOT_KEY, myself_path, " su" );
165160 printf (" test_clean_su_env ret val:%d\n " , uninstall_su_tools_ret);
166- }
161+ }
167162
168163int main (int argc, char *argv[])
169164{
@@ -187,7 +182,7 @@ int main(int argc, char *argv[])
187182
188183 ++argv;
189184 --argc;
190-
185+
191186 if (strcmp (argv[0 ], " show" ) == 0 ) { // 1.显示自身权限信息
192187 show_capability_info ();
193188 }
0 commit comments