Skip to content

Instantly share code, notes, and snippets.

@eqdamini
Last active June 26, 2024 01:32
Show Gist options
  • Save eqdamini/d3accb76dc5e82f9c30d398a9fc5626d to your computer and use it in GitHub Desktop.
Save eqdamini/d3accb76dc5e82f9c30d398a9fc5626d to your computer and use it in GitHub Desktop.
Android Pull History Using Termux

Prerequisites

You will need to complete these steps 1 time before starting the tutorial

1. Install Termux

Termux can be installed through the F-droid website

If you scroll down, you can directly download then install the APK

2. Enable developer mode in your settings

Follow this tutorial for more info

  • Go to Settings --> About phone
  • Scroll down to Build number
  • Tap build number 7 times, type in your PIN if necessary

Obtaining Pull History

Start from here once you've completed the prerequisites

1. Open up Termux

2. Install Android tools

  • Enter this command: pkg install android-tools
  • If during the installation, it prompts you to type [Y/n], type Y

3. Enable wireless debugging in Settings

  • Navigate to Settings --> System --> Developer Options --> Wireless debugging
  • Toggle on wireless debugging

4. Split screen between Termux and Settings

  • Starting from the wireless debugging settings, press the Overview button on your phone (the square shaped button on the right side of the home bar that you use to see recently opened apps)
  • Long press on the Settings icon
  • Press Split Screen
  • Click on Termux from your recently accessed apps You can adjust the size of each split screen. It'll probably be easier if you make the Settings portion slightly bigger

5. Pair device

  • In Settings, click on "Pair device with pairing code" (reference above image)
  • You will see a pairing code followed by an IP address and port number
  • In Termux, enter the following command: adb pair [ip-address]:[port-number] (fill in with your ip address and port number, don't include the [] brackets)
  • If you've entered the IP address and port number correctly, it will prompt you to type in the pairing code

6. Connect device

  • In Settings, exit out of device pairing. There will be an "IP address & Port" field
  • In Termux, enter the following command: adb connect [ip-address]:[port-number]

You can copy the [ip-address]:[port-number] portion by long pressing "IP address & Port" in Settings. Alternatively, write it manually. Make sure it completely matches.

7. Start logging

8. Open your pull history

9. Go back to Termux

  • You will be able to copy your pull history url from the log
  • Tip: pressing the CTRL button and then typing c will halt the command

Troubleshooting

  • Make sure your commands are completely correct. IP addresses & port numbers should exactly match the values in Settings. The urls for logging should also be completely correct
  • Sometimes Termux is screwy. Many errors can be fixed by simply uninstalling and reinstalling. This is an error I see every now and then that is fixed by reinstalling:
  • Reach out in the discord server if you need any more help

References

https://www.youtube.com/watch?v=HlKKwOlvMUU

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