| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import { spawn, execSync } from "child_process"
- import { setTimeout } from "timers/promises"
- const p = spawn("adb", ["shell"])
- let output = ""
- let error = ""
- p.stdout.on("data", data => {
- output += data.toString()
- })
- p.stderr.on("data", data => {
- error += data.toString()
- })
- async function exec(command) {
- output = ""
- error = ""
- p.stdin.write(command + "\n")
- await setTimeout(500)
- if (error) {
- throw new Error(error)
- }
- return output + ""
- }
- // exec su command
- p.stdin.write("su\n")
- let exists = false
- // try {
- // await exec("ls /system/framework/RcsHackTool.dex")
- // exists = true
- // console.log("RcsHackTool.dex found")
- // } catch (e) {
- // console.log("RcsHackTool.dex not found")
- // }
- // if (!exists) {
- console.log("Pushing RcsHackTool.dex")
- execSync("adb push ../RcsHackTool.dex /sdcard/")
- console.log("Pushed RcsHackTool.dex")
- console.log("mounting /system as rw")
- await exec("mount -o rw,remount /")
- console.log("mounted /system as rw")
- console.log("Copying RcsHackTool.dex to system")
- await exec("cp /sdcard/RcsHackTool.dex /system/framework/")
- console.log("Copied RcsHackTool.dex to system")
- // }
- p.kill()
|