This commit is contained in:
parent
84ae0f6994
commit
1d36961a7c
16 changed files with 734 additions and 48 deletions
|
|
@ -224,17 +224,28 @@ func PushAndStart(c *adb.Client, localBin string, extraArgs ...string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// FindLocalBin returns the first existing proxy binary under the repo.
|
||||
// FindLocalBin returns the on-device MITM binary.
|
||||
// Search order: next to this drm.exe (release zip layout), then under the repo.
|
||||
func FindLocalBin(root string) string {
|
||||
if root == "" {
|
||||
root = repo.Root()
|
||||
}
|
||||
for _, p := range []string{
|
||||
candidates := []string{}
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
dir := filepath.Dir(exe)
|
||||
candidates = append(candidates,
|
||||
filepath.Join(dir, "proxy-android-arm64"),
|
||||
filepath.Join(dir, "bin", "proxy-android-arm64"),
|
||||
)
|
||||
}
|
||||
candidates = append(candidates,
|
||||
filepath.Join(root, "bin", "proxy-android-arm64"),
|
||||
filepath.Join(root, "apps", "proxy", "proxy-android-arm64"),
|
||||
filepath.Join(root, "apps", "proxy", "rteproxy-android-arm64"),
|
||||
filepath.Join(root, "bin", "rteproxy-android-arm64"),
|
||||
} {
|
||||
filepath.Join(root, "proxy-android-arm64"),
|
||||
)
|
||||
for _, p := range candidates {
|
||||
if st, err := os.Stat(p); err == nil && !st.IsDir() {
|
||||
return p
|
||||
}
|
||||
|
|
@ -501,14 +512,9 @@ func StartTransparent(c *adb.Client, localBin, pkg, port, remoteDir string, rein
|
|||
}
|
||||
_, _ = c.Shell("chmod", "755", RemoteBin)
|
||||
|
||||
scriptLocal := filepath.Join(repo.Root(), "apps", "proxy", "device", "tproxy_iptables.sh")
|
||||
if _, err := os.Stat(scriptLocal); err != nil {
|
||||
return fmt.Errorf("missing %s", scriptLocal)
|
||||
if err := ensureTProxyScript(c); err != nil {
|
||||
return fmt.Errorf("tproxy script: %w", err)
|
||||
}
|
||||
if err := c.Push(scriptLocal, RemoteTProxyScript); err != nil {
|
||||
return err
|
||||
}
|
||||
_, _ = c.Shell("chmod", "755", RemoteTProxyScript)
|
||||
_, _ = c.Shell("mkdir", "-p", remoteDir)
|
||||
_, _ = c.Shell("rm", "-f", remoteDir+"/cap.json", remoteDir+"/traffic.jsonl", remoteDir+"/appproxy.log")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue