Looking for Visible Devices

In a post a few days ago (Your Device is Showing) I mentioned the concerns that a few users had about their devices being visible to other people on their respective phone networks through Resco Explorer. Using a network packet monitoring tool I was able to write some code that performed netbios queries and was able to obtain the same names that Resco Explorer had received.  Requesting the name of a device is straight forward.  Just send a request to the device to be queried into UDP port 137 and extract the name from the response.  The byte stream to send is as follows.

NameRequest = new byte[]{
0x80, 0x94, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x43, 0x4b, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x00, 0x00, 0x21,
0x00, 0x01 };

In the response byte stream you can extract the name from the 57th byte of the response to the 75th byte.  The name will be padded with spaces if it is less than 16 characters.  I did run into a problem in implementing this.  Many Windows CE builds don’t contain an implementation for timeout functionality on ports when listening and there doesn’t seem to be way to abort listening for a response without introducing a resource leak.  This is something worth revisiting once I have more information.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s