My friend has a PC that uses Windows, and I want to know the name of that computer. All I know now is that his IP address is 10.0.0.2, how can I get his computer's name from my Linux box?
Asked
Active
Viewed 9,954 times
2 Answers
6
How about:
nmblookup -A 10.0.0.2
and then a grep ?
DaLynX
- 251
- 1
- 5
-
Anyone knows where I can find proper interpretation of that output (what each column is for)? – ychaouche Nov 30 '22 at 09:55
-
Oh, [nm](https://superuser.com/a/710355/44391) – ychaouche Nov 30 '22 at 10:23
0
Building on the answer provided by @DaLynX, you could have :
function net.ip.netbios.lookup {
nmblookup -A "$1" |
awk 'NR>1 && $1 !~ /MAC/ && $1 && $1 !~ /__MSBROWSE__/ {print $1}' |
sort -u
}
Which takes you from this
$ nmblookup 192.168.211.86
Looking up status of 192.168.211.86
ITSNOWY <00> - B <ACTIVE>
WORKGROUP <00> - <GROUP> B <ACTIVE>
ITSNOWY <20> - B <ACTIVE>
WORKGROUP <1e> - <GROUP> B <ACTIVE>
WORKGROUP <1d> - B <ACTIVE>
..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>
MAC Address = 08-2E-5F-07-88-19
$
To this
$ net.ip.netbios.lookup 192.168.211.86
ITSNOWY
WORKGROUP
$
ychaouche
- 945
- 8
- 25