frida rpc调用维护ios手机脚本

2021-10-15 15:21:46 浏览数 (1)

1.kill_frida_rpc_server.sh

代码语言:javascript复制
#!/bin/bash
echo "关闭服务"

echo "`date " %Y-%m-%d %H:%M:%S"` 正在杀进程..."
ps -ef | grep 你的fridarpc服务.py | grep -v grep | awk '{print $2}' | xargs kill -9
echo "`date " %Y-%m-%d %H:%M:%S"` 进程已杀死!"


echo "`date " %Y-%m-%d %H:%M:%S"` 重启..."
frida -U --no-pause -f com.taobao.taobao4iphone

2.restart_frida_rpc_server.sh

代码语言:javascript复制
#!/bin/bash
echo "开始"

echo "`date " %Y-%m-%d %H:%M:%S"` 关闭frida..."
ps -ef | grep frida | grep -v grep | awk '{print $2}' | xargs kill -9
echo "`date " %Y-%m-%d %H:%M:%S"` 进程已杀死!"

echo "`date " %Y-%m-%d %H:%M:%S"` 正在杀进程..."
ps -ef | grep 你的fridarpc服务.py | grep -v grep | awk '{print $2}' | xargs kill -9
echo "`date " %Y-%m-%d %H:%M:%S"` 进程已杀死!"

echo "`date " %Y-%m-%d %H:%M:%S"` 正在重启服务..."
nohup python3 你的fridarpc服务.py >/dev/null  2>&1 &
echo "`date " %Y-%m-%d %H:%M:%S"` 服务重启完毕!"

3.Python半小时定时重启app并重启rpc服务

代码语言:javascript复制
# _*_ coding: utf-8 _*_
# @Time:2021/10/13 1:50 下午
# @Author:YwY(慕白)

import os
import time
from multiprocessing import Process
def func_1():
    os.system("bash kill_frida_rpc_server.sh")
def func_2():
    time.sleep(5)
    os.system("bash restart_frida_rpc_server.sh")


if __name__ == '__main__':
    import schedule

    def run():
        t_1= Process(target=func_1)
        t_2 = Process(target=func_2)
        t_2.start()
        t_1.start()
        t_2.join()


    schedule.every().hour.at(':30').do(run)
    while True:
        schedule.run_pending()

如果是安卓机器推荐使用adb 进行app重启

0 人点赞