-rwxr-xr-x | bin/smbfind | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/smbfind b/bin/smbfind new file mode 100755 index 0000000..7bc9ee6 --- a/dev/null +++ b/bin/smbfind | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # export PATH=$PATH:/dos/extras/bin | ||
4 | # | ||
5 | # A replacement for standard perl findsmb. | ||
6 | # | ||
7 | # First get list of ip addresses | ||
8 | # | ||
9 | IPS=`nmblookup \* |awk '{print $1}'|grep -v "Send"` | ||
10 | echo | ||
11 | echo "IP Address Name Description" | ||
12 | echo "*************************************" | ||
13 | echo | ||
14 | for i in $IPS | ||
15 | do | ||
16 | # For each ip address that responds lookup name | ||
17 | value=`echo $i|awk '{print $1}'` | ||
18 | MACHINE=`nmblookup -T -A $value |grep "<00>"|awk '{h=tolower($1); print h}'|head -n1` | ||
19 | TYPE=`smbclient -N -L $MACHINE -I $value 2>&1 |grep "Domain="|head -n1|sed 's/ /_/g'` | ||
20 | |||
21 | echo "$value $MACHINE $TYPE" | ||
22 | done | ||