Android network discovery

I want to detect all devices (host name, MAC address and provider name) connected to my Wi-Fi network through an Android phone. There are no shared services on devices.

Tried the following methods:

  1. Checking all IP addresses on a subnet takes too much time ( inetAddress.isReachable() ).
  2. Sending an nbstat request for a name request NETBIOs works on some devices. Some of them give PortNotOpenException (port 137 is not open). On some other devices, NETBIOs do not have the NETBIOs name NETBIOs .
  3. Tried to use jcifs for Android. Was able to get hostnames using

     nbtAddress.getByName(ip) 

looped over all IP addresses in the subnet. This method gives all host names, regardless of whether they are active or not.

What is the best way to find all ACTIVE devices on the network? Some apps like FING seem to do this.

Change: I tried to analyze how the Android FING app does it.

  1. A small access point with 2 devices is connected. Started detection in FING and intercepted packets on wireshark. A series of the following requests is sent (All broadcasts):

Packets on wireshark

  1. Discovery in FING has begun on a large Wi-Fi network (65 thousand devices). Netbios name service request and response packets are requested. (Unicast and sometimes to broadcast address)

In the meantime, I am trying to print the arp entries of my Android phone in the IDE.

The number of records continues to grow during the discovery process in the FING application.

5 entries before opening

Increases to 1025 records as it opens.

Reduces to 150 records after detection is complete.

What exactly is going on? There were no ICMP requests. Can I send ARPRequests in an Android app? Please help.

+9
android discovery netbios
source share
1 answer

Check out: https://github.com/stealthcopter/AndroidNetworkTools . This is a great tool to work with.

0
source share

All Articles