linux – finding pid for a port without busybox in Android

  1. cat /proc/net/tcp

you will get a list of all ports with their processes.

  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode                                                     
   0: 0100007F:13AD 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 3336108 1 0000000000000000 100 0 0 10 0                   
   1: 0100007F:1f90 00000000:0000 0A 00000000:00000000 00:00000000 00000000 10252        0 3579923 1 0000000000000000 100 0 0 10 0                   

this result shows the ‘8080’ port is using by uid 10252. ( 8080 = 1f90 hex value)

  1. cat /data/system/packages.list | grep 10252

will show your the package name of the app.

merlin:/ # cat /data/system/packages.list | grep 10252
com.la391.f6a85e 10252 0 /data/user/0/com.la391.f6a85e default:targetSdkVersion=29 3002,3003 0 1

lsof -i is not available for Android.

Read more here: Source link