I'm going to address and describe methods that I use to get information from devices connected to the wifi network, no doubt ping
is an alternative, but if the device has any firewall or anti-virus that blocks ICMP
you will never get a return, so does any type of scan that tries to scan your network. In addition to being slow you have a great chance of having some equipment browsing your network in which the scan can not catch.
The safest way to bring correct information is to go straight to the source (ie your router), you can enable queries via SNMP in your router / access point, I believe it is very rare that a network equipment does not have this option nowadays, this way you can consult any information distributed by the equipment, such as bandwidth consumption, CPU utilization, memory used and it is very likely that some OID
(is the identifier, a number that collects information for a given need) returns a list of MAC addresses of the devices connected to it.
Here is a real example of usage:
snmpwalk -v2c -c senhaSNMPAQUI 192.168.1.214 enterprises.171.11.37.4.4.5.2.1.2.1
SNMPv2-SMI::enterprises.171.11.37.4.4.5.2.1.2.1.1 = Hex-STRING: 2X V6 98 XX XX XX
SNMPv2-SMI::enterprises.171.11.37.4.4.5.2.1.2.1.2 = Hex-STRING: A1 52 66 XX XX XX
SNMPv2-SMI::enterprises.171.11.37.4.4.5.2.1.2.1.3 = Hex-STRING: 51 SF 6D XX XX XX
Of course I've gotten the information in this example using a unix client called snmpwalk
, the parameters will always be versão
SNMP to comunity
(type a password to access), IP
ad address of your router and OID
that brings the information you need, each device has specific OIDs and most of the time you will need to get this information in the documentation provided by the manufacturer, to my Dlink here the OID
that brings the equipment information connected to it is enterprises.171.11.37.4.4.5.2.1.2.1
, OK you can do the same using java libs to do snmp query, I believe you will find several, one of them and example is SNMP4J . Hi, I have a problem with my computer.
One way is to send IP
to the network and get the return of the broadcast
table
arp -a
? (192.168.1.11) at A1 52 66 XX XX XX on eth0 expires in 931 seconds [ethernet]
? (192.168.1.52) at 2X V6 98 XX XX XX on eth0 expires in 1169 seconds [ethernet]
? (192.168.1.17) at 51 SF 6D XX XX XX on eth0 expires in 650 seconds [ethernet]
Is my machine out of China and does it have SNMP or does it have OID's SNMP to bring the information I need right now?
Enable your remote access (ssh, telnet) method on your router, plug in the device, and find some command inside it that takes the information you need
Another real example:
telnet 192.168.2.1
Trying 192.168.2.1...
Connected to 192.168.2.1.
Escape character is '^]'.
login: usuariodorouter
Password: ******
WAP-> get clientinfo
Client1--time:1424
Client1--ssid: primary SSID
Client1--mac:CW:45:67:XX:XX:XX
Client1--auth:OPEN
Client1--rssi:11
Client1--mode:11n
Client1--psmode:0
Client1--rx_bytes:234239
Client1--tx_bytes:285309
In this example a telnet connection was made to the router and I ran the command arp
, again you will need to consult some doc from the manufacturer to know which command returns what you need, in java there are also telnet client libs which make this connection and iteration for sending commands, all you have to do is collect the data ...