android - 根据端口号查询进程 find android process by specific port

访问量: 1000

参考:

android下的 lsof -i:5353 无法使用。google也难以查询,所以我记录一下。

1  进入到adb shell

2. cat /proc/net/tcp

merlin:/ # cat /proc/net/tcp
  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                   
   2: 6400A8C0:A90E 6800A8C0:1F90 04 00000001:00000000 00:00000000 00000005     0        0 0 1 0000000000000000 326 4 29 1 5                         
   3: 6400A8C0:A91E 6800A8C0:1F90 04 00000001:00000000 00:00000000 00000005     0        0 0 1 0000000000000000 326 4 29 1 5                         
   4: 6400A8C0:84F2 66DFC2DC:01BB 09 00000001:00000001 00:00000000 00000005     0        0 0 1 0000000000000000 665 4 24 1 5                         
   5: 6400A8C0:A91A 6800A8C0:1F90 04 00000001:00000000 00:00000000 00000005     0        0 0 1 0000000000000000 326 4 29 1 5                         
   6: 6400A8C0:A8F2 6800A8C0:1F90 04 00000001:00000000 00:00000000 00000005     0        0 0 1 0000000000000000 326 4 29 1 2                         
   7: 6400A8C0:A90A 6800A8C0:1F90 04 00000001:00000000 00:00000000 00000005     0        0 0 1 0000000000000000 326 4 29 1 2                         
   8: 6400A8C0:B146 ACC16127:2EEC 04 00000001:00000000 00:00000000 00000004     0        0 0 1 0000000000000000 339 4 20 1 5     

在上面可以看到 uid 不为0的列只有第二行才是。

local_address中。 0100007F:1F90   后面部分就是16进制的端口号,对应的10进制就是8080

对应的 uid 就是10252

3 查看 /data/system/packages.list

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

所以,这个package就找到了

订阅/RSS Feed

Subscribe