views:

189

answers:

2

I've implemented a simple UDP ping/pong protocol to discover other computers connected to the same WiFI router. This works fine on many WiFI and Ethernet routers, but when I go out on the street to give it a try, many public WiFI networks seem to have either UDP Broadcasts/Multicast disabled, or UDP disabled completely.

What other options do I have to discover the computers connected to the WiFI router? (I'd love to create an Ad-Hoc network between the members of my network but this is not possible)

I was thinking of brute forcing TCP attempts (trying to open connections to all possible IPs on my subnetwork) but this would be very costly and I would have to cycle several times and still not find every machine that's recently connected to the network.

A: 

you could try bonjour, perhaps.

also, on many access points, it is possible to disable client to client communication. it's possible this is what you are running into during your testing.

Jeremy L. Gaddis
I've found that starbuck's "attwifi" have udp broadcasting blocked.
Gubatron
A: 

There is no easy way to discover only "computers". You can however find almost all network devices using ARP requests.

The steps would be:

  1. Connect to the network
  2. Get the network IP address range (for example: "192.168.0.0/24")
  3. Send an ARP request for every possible address in this range ("192.168.0.1" => "192.168.0.254")
  4. Wait for the replies

Usually, network devices respond to ARP requests because ARP is needed for IPv4 to work.

You may find additional resources here.

Note: you'll problably need to have Administrator privileges (root on UNIX) in order to do that. Sending forged ARP requests usually requires elevated privileges.

Another way could be to send broadcast pings (ping -b 192.168.0.255 on UNIX OSes). But Windows computers (and some other devices) usually don't respond to such pings.

ereOn
I forgot to mention that using this way, you can't easily determine if a host is connected wirelessly or not. But since you get the MAC address back, you still can check for the Vendor ID and determine if the interface used is a wireless one. No garanties tought.
ereOn