Sniffing an Android app to find API URL
In windows 10 machine just follow the below steps:
Go to Settings > Network & Internet > Mobile hotspot and enable Share my internet connection with other devices.
Connect your Mobile Device to that shared hotspot.
Now for getting internet access in your mobile click on Change adapter options.
Go to properties by right click on the the Network Adapter from which the internet is being shared to your windows machine.
Tick the Internet Connection Sharing options in the Sharing tab by selecting the appropriate connection (Local Area Connection used by mobile device) and click ok.
Now you will be able to see all the network traffic of the mobile device in Wireshark if you select the Local Area Connection used by mobile. For filtering the result by http traffic you can enter http in the filter field and for https
web traffic you can enter tls.handshake.type eq 1
you can do this with help of WireShark. I am listing steps here
- Install WireShark on your computer
- now we have to create Android virtual device(AVD) so we will download Android SDK from official site. Android SDK come with emulator for testing
- after setting up Android SDK, create a Android virtual Device(AVD) on which we will install app
- start that virtual device. you can use command line to start (
emulator @<AVD name>
) - after creating virtual device install app using adb command
adb install app_file_name.apk
- now we can start capturing the packets so I will suggest to close other application on your computer which are using network so our captured packets would be more relevant.
- now start wireshark with root access
select interface which you want to capture and click start to start capturing.
now start using that app so packets will transfer to and fro and wireshark will capture it.
if you have used app covering all sort of activity then you can stop wireshark to capture packets.
now start main business to analyse packets carefully but not all packets are usefull for our job. so lets filter packets which are relevant for you. lets your IP address is 192.168.0.32 then filter all the packets whose IP is this. so filter expression will be
ip.addr==192.168.0.32
apply this filter. still we an apply another filter to list up only relevant packets only so possibly that app is accessing API with HTTP protocol so apply HTTP filter. expression would behttp
. you can apply both are filter at onceip.addr==192.168.0.32 and http
press enter to apply.see the info carefully for listed packets you will see lot of important details, API keys, cookies etc
A very fast method.
Go to PlayStore, search for Packet Capture
Download, install and run.
It's easy simple and fast. It will give you details about the APIs, URLs and response with their headers.
This application follows the concept of Packet Sniffing. Thus, this might not work with much secured applications like WhatsApp, Facebook, Twitter.
UPDATE 1:
The Packet Capture is no more available in playstore, try OS Monitor
UPDATE 2:
The Packet Capture is available again.