0

I have a third party application in my android phone. The application offers a service at 127.0.0.1:30002.

I don't know the name of service.

Is there a way to find out whether that tcp service is up or not using adb or some other means.

Also what is the use of adb reverse. Can i run a server in host pc and forward that server on android using adb reverse.

I am completely new to android, so please be brief.

Thanks in advance.

Daemon
  • 1,575
  • 1
  • 17
  • 37

1 Answers1

1

To find which app using specific port:

1. $ cat /proc/net/tcp - This will give you a list of open ports and the UId (unique application ID) of the port's owner.
2. & cat /data/system/packages.list | grep '<The UID you just found>' - This will give you the app name connected to this UID.
3. ps |grep '<the app name>' Will tell you if the app service is running.

What is adb reverse?

adb reverse tells your phone use a port of your local machine (e.g laptop).
Assume you use the command:

adb reverse tcp:80 tcp:3000

Now when your phone tries to access http://localhost:3000/ your request will be routed to localhost:80 of your laptop.

Nir Duan
  • 6,164
  • 4
  • 24
  • 38
  • when I do adb reverse tcp:30002 tcp:30002 command executes, but adb reverse --list shows error: – Daemon Aug 09 '16 at 08:56