Skip to content

Fix: place -s before adb subcommand and improve logging #50

Merged
mhils merged 2 commits intomitmproxy:mainfrom
Davis-3450:fix/adb-arg-order-minimal
Sep 12, 2025
Merged

Fix: place -s before adb subcommand and improve logging #50
mhils merged 2 commits intomitmproxy:mainfrom
Davis-3450:fix/adb-arg-order-minimal

Conversation

@Davis-3450
Copy link
Contributor

In this PR I have addressed the following issue:

  • ADB -s was in the wrong order (a bug introduced by me).

it now follows their syntax adb

Side notes:

  • String based commands can be fragile but as of now everything seems to be working and that's how the project was setup, a migration from strings to list would be beneficial.

  • I tested this with windows and worked fine, however testing in other platforms would be good.

  • Heres my little "test" script: gist

Risk: low sope

  • Changes are localized to command construction and logging

@quantum-x
Copy link

Hi @Davis-3450
Sorry for the delay. Working for me as well (although my environment is windows based, so wasn't able to confirm other environments!).

Good to merge for me.

Copy link
Member

@mhils mhils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mhils mhils merged commit 31f5a84 into mitmproxy:main Sep 12, 2025
@Davis-3450
Copy link
Contributor Author

Great!

@k0rd
Copy link

k0rd commented Sep 27, 2025

shell=False breaks on (my) linux as it causes subprocess.run() to interpret the whole string as a command, not the command + args. refactoring the cmd to be a list would probably be better for all....

@Davis-3450
Copy link
Contributor Author

shell=False breaks on (my) linux as it causes subprocess.run() to interpret the whole string as a command, not the command + args. refactoring the cmd to be a list would probably be better for all....

Have you tried setting it to True? and did it work? will try this too.

I also agree that a list is better, safer and more maintainable but would imply a big refactor.

Notice that shell=True in subprocess is often considered a bad practice so I changed it to False, it worked fine with windows environments, but I didn't test on Unix/Linux/MacOS, my bad for that.

I’ll take a look at this, If you can help me test it, I’d really appreciate it <3

@Davis-3450
Copy link
Contributor Author

@k0rd

@k0rd
Copy link

k0rd commented Sep 27, 2025

yes it works fine with True. I have only been able to test on my computer though,
6.12.38+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.12.38-1kali1 (2025-08-12) x86_64 GNU/Linux
Python 3.13.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants