Sign in to follow this  
Followers 0
Kyan

Get android devices hostname in a lan network

10 posts in this topic

Hi again :)
 
How can I get android devices names connected to a network? using _TCPIpToName() it throws the error 11004
 

WSANO_DATA 11004

 

Valid name, no data record of requested type.

The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for. The usual example for this is a host name-to-address translation attempt (using gethostbyname orWSAAsyncGetHostByName) which uses the DNS (Domain Name Server). An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.


dns gives me this

F6uT3BN.png

My router can retrieve the phone name, so is not impossible, but don't know how he does it :|

This java command InetAddress.getByName(IpAddres).getHostName() returns IpAddres, no big help


Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include<inet.au3>

TCPStartup ( )

consolewrite(_TCPIpToName("192.168.1.229"))

returns

android-ff0afb47bf14a340.attlocal.net+>18:20:32 AutoIt3.exe ended.rc:0

 

 

edit: i understand now, and was super not reading well at all

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

uhm, which android device you have? With a wiko rainbow _TCPIpToName hangs and returns an error (it causes my gui to stop responding)

TCPStartup()
Sleep(20)
$ls = _TCPIpToName("192.168.1.4",1)
ConsoleWrite(@error&@TAB&@extended&@LF)
_ArrayDisplay($ls)
TCPShutdown()
Exit

Return: 4 11004

(no array)


Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If you run a loop with all IP addresses on your network, is that the only one that fails?  and what does it set @error to?  I read slower than I respond....

 

I throw some 4's but I dont think it is android specifc, I cant break it with a fire, note 4, or ellipsis.

kindle-509081898.attlocal.net

android-ff0afb47bf14a340.attlocal.net

unknownd8492f789465.attlocal.net

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Works fast for windows computers (25-38ms for each), when it reaches that android device ip it hangs there, till it gives up

I'm only passing throw though connected devices, I grab the connect ip addresses through snmp and list their local ip/mac addr/name

EDIT: My windows phone also causes the same error, but my router can also retrieve the name, damn TP-Link ninjas.

Don't know if one of those will do something new

http://en.wikipedia.org/wiki/Network_Information_Service

http://en.wikipedia.org/wiki/Name_Service_Switch

Edited by Kyan

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

What about getting the mac of the conected devices on the network and the compare in http://standards-oui.ieee.org/oui.txt? It would be really anoying searching all vendors but it would work great  :rolleyes:

I just found a code that makes that xD, its been taken from the forum, but i didnt remember where  >_<

script.au3

Edited by Jos
Page was unresponsive

Codding its just my life!  :thumbsup: 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Vendor names doesn't help much to distinguish what device is it.

For example:

Android phone: Wiko Rainbow

Vendor: Tinno Mobile Technology Corp

                                                                        :huh2:

I made a function to retrieve for from router's Config page his dhcp table, but if I could do it with some magical dll command that would be better  :mad2:

EDIT: It has to be done using DHCP requests, I hate RFC docs https://tools.ietf.org/html/rfc2132#section-3.14

Edited by Kyan

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites

What about getting the mac of the conected devices on the network and the compare in http://standards-oui.ieee.org/oui.txt? It would be really anoying searching all vendors but it would work great  :rolleyes:

I just found a code that makes that xD, its been taken from the forum, but i didnt remember where  >_<

Please do NOT post the source of this size script with Binary info as the page becomes unresponsive.

Moved the script into a file and attached it.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Ping right before doing the nmap

192.168.1.4: bytes=32 tempo=72ms TTL=64
192.168.1.4: bytes=32 tempo=6ms TTL=64
192.168.1.4: bytes=32 tempo=4ms TTL=64
192.168.1.4: bytes=32 tempo=4ms TTL=64
>nmap -sV -O -v 192.168.1.4
Starting Nmap 6.47 ( http://nmap.org ) at 2015-04-11 21:18 Hora de Verão de GMT

NSE: Loaded 29 scripts for scanning.

Initiating ARP Ping Scan at 21:18

Scanning 192.168.1.4 [1 port]

Completed ARP Ping Scan at 21:18, 0.38s elapsed (1 total hosts)

Initiating Parallel DNS resolution of 1 host. at 21:18

Completed Parallel DNS resolution of 1 host. at 21:18, 2.60s elapsed

Initiating SYN Stealth Scan at 21:18

Scanning 192.168.1.4 [1000 ports]

SYN Stealth Scan Timing: About 55.67% done; ETC: 21:19 (0:00:33 remaining)

SYN Stealth Scan Timing: About 64.23% done; ETC: 21:20 (0:00:43 remaining)

SYN Stealth Scan Timing: About 77.70% done; ETC: 21:21 (0:00:35 remaining)

Completed SYN Stealth Scan at 21:22, 209.37s elapsed (1000 total ports)

Initiating Service scan at 21:22

Initiating OS detection (try #1) against 192.168.1.4

NSE: Script scanning 192.168.1.4.

Nmap scan report for 192.168.1.4

Host is up (0.036s latency).

All 1000 scanned ports on 192.168.1.4 are filtered (531) or closed (469)

MAC Address: XX:XX:XX:XX:XX:XX (Tinno Mobile Technology)

Too many fingerprints match this host to give specific OS details

Network Distance: 1 hop



Read data files from: C:\Program Files (x86)\Nmap

OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .

Nmap done: 1 IP address (1 host up) scanned in 223.70 seconds

           Raw packets sent: 2222 (100.032KB) | Rcvd: 477 (19.068KB)

Seems I'm out of luck, need to find how DHCP request packets are made  :sweating:

EDIT: I'm not sure about the octects with "?" (IPs need to be converted to 4bytes long)

01 01 06MyMAC 00 12343212 0000 0000 THEIR_IP THEIR_IP MY__IP 192.168.1.1 16bytes?? 64bytes? 128bytes? 35 01 05 FF
 
#Option codes (decimal)
05 Name Server
04 Domain Name Server
12 Host Name
15 Domain name
255 END
 
#DHCP Extensions
53=0x35 DHCP Message Type
 
Info taken from
Edited by Kyan

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0