ProxymanApp / Proxyman

Modern. Native. Delightful Web Debugging Proxy for macOS, iOS, and Android ⚡️
https://proxyman.io
5.49k stars 180 forks source link

Android emulator scripts (install_certificate_android_emulator.sh) not working with all configurations #1276

Open jeanetienne opened 2 years ago

jeanetienne commented 2 years ago

Proxyman version? (Ex. Proxyman 1.4.3)

3.6.0

macOS Version? (Ex. mac 10.14)

12.4

Steps to reproduce

  1. Use fish shell as default shell in Terminal.app
  2. Install Proxyman.app in ~/Applications (instead of /Applications)
  3. Go to menu "Certificate" → "Install Certificate on Android" → "Emulators…"
  4. Use the "Override emulator" or "Reset override" scripts

Expected behaviour

The scripts are run.

Actual behaviour

The scripts are not run.

Potential explanations

Screenshots (optional)

n/a

NghiaTranUIT commented 2 years ago

Can you share the error log or something that I can trace back?

I double-check the code:

  1. It works fine for both ~/Applications or /Applications because Proxyman gets the relative path, not hardcode.
  2. To execute the script, Proxyman leverage the AppScript:
do script "bash \(path) all \(ip) \(port) \(certPath)"

By default, it will open the Terminal and load all $PATH.

NghiaTranUIT commented 2 years ago

You might open the Terminal and execute the following code:

bash ~/Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Resources/install_certificate_android_emulator.sh all 192.168.0.1 9090 ~/.proxyman/proxyman-ca.pem
NghiaTranUIT commented 2 years ago

One noted:

Proxyman requires Automation Permission in order to execute the automation script by AppleScript. Please consider granting Proxyman app in System Preference -> Security & Privacy -> Privacy -> Automation -> Allow Proxyman app.

jeanetienne commented 2 years ago

Thanks for your quick and detailed response @NghiaTranUIT !

I have Automation permission enabled for Proxyman (see screenshot below). I also managed to make it work by running the command manually. However when I click on the "Override emulator" or "Reset override" button, it opens a new Terminal window, but nothing happens in it.

What error log would you like to see? Where should I get such log?

Thanks!

Screen Shot

jeanetienne commented 2 years ago

Perhaps this helps? A screen recording of what happens (or doesn't happen 😅).

I also attached the Console.app logs that you can see in the screen recording.

https://user-images.githubusercontent.com/1822562/176571510-cc90a007-78bd-49c7-8a3c-77a37397cf2a.mov

console.txt


Don't stress too much, it's not a pressing issue for me. I can run the scripts manually 👍

NghiaTranUIT commented 2 years ago

Not sure if this beta build can fix the bug: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.6.0_Try_fixing_the_AppleScript.dmg

Basically, I change AppleScript when executing the bash script.


If the beta build doesn't work, please open the Script Editor app -> try to run this code: I'd like to see the output.

if application "Terminal" is running then
    tell application "Terminal"
        do script "bash /Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Resources/install_certificate_android_emulator.sh all 192.168.0.1 9090 ~/.proxyman/proxyman-ca.pem"
        activate
    end tell
else
    tell application "Terminal"
        do script "bash /Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Resources/install_certificate_android_emulator.sh all 192.168.0.1 9090 ~/.proxyman/proxyman-ca.pem" in window 1
        activate
    end tell
end if
jeanetienne commented 2 years ago

Hey, sorry for the lengthy response time!

Here's a screen grab of when I execute the above script (adapted to my local values), in my terminal (using fish):

https://user-images.githubusercontent.com/1822562/182787572-c566fd0c-5117-405c-944e-b32f86fdc775.mov

Interestingly, if I change my shell to revert back to the default login shell (I usually use fish shell), then it looks like this.

Screen Shot 2022-08-04 at 17 17 30

https://user-images.githubusercontent.com/1822562/182788136-56121a7b-f59c-42cc-95ae-995b8682e778.mov

NghiaTranUIT commented 6 months ago

Thanks. Selecting Default Login Shell will fix 👍

Related ticket from Fish repo: https://github.com/fish-shell/fish-shell/issues/10048