[jcifs] Scanning networks using the master browser via jcifs
Anish Acharya
anish.acharya at casero.com
Tue Aug 13 08:56:39 EST 2002
We need to implement something that does the following through jCIFS,
but unfortunately jCIFS doesn't seem to handle multiple responses for a
request (only one host is returned when looking for a master browser,
and one host is returned when looking for members of a domain).
In a paragraph :
We need to determine what WORKGROUPS are on the network,
determine what hosts are part of the WORKGROUP, and then
determine what shares are on each of those machines
In pseudocode
Get All MASTER BROWSERS
For each Master Browser
Determine MB's domain
Get List of members of the Domain
For each member
Determine the names of the available shares
End-For
End-For
An implementation that could be cludged with shell, awk and co..
Get all master browsers on the system
$ nmblookup -M "-"
querying __MSBROWSE__ on 10.255.255.255
10.1.1.86 __MSBROWSE__<01>
10.1.1.59 __MSBROWSE__<01>
10.1.1.88 __MSBROWSE__<01>
10.1.1.67 __MSBROWSE__<01>
10.1.1.87 __MSBROWSE__<01>
10.1.1.3 __MSBROWSE__<01>
Choose each of the MB :
$ nmblookup -M "-" -S -U 10.1.1.3
querying __MSBROWSE__ on 10.1.1.3
10.1.1.3 __MSBROWSE__<01>
Looking up status of 10.1.1.3
MAIN-SRV <00> - M <ACTIVE>
MAIN-SRV <20> - M <ACTIVE>
CASERO <00> - <GROUP> M <ACTIVE>
CASERO <1c> - <GROUP> M <ACTIVE>
CASERO <1b> - M <ACTIVE>
CASERO <1e> - <GROUP> M <ACTIVE>
MAIN-SRV <03> - M <ACTIVE>
MAIN-SRV <6a> - M <ACTIVE>
INet~Services <1c> - <GROUP> M <ACTIVE>
IS~MAIN-SRV <00> - M <ACTIVE>
CASERO <1d> - M <ACTIVE>
..__MSBROWSE__. <01> - <GROUP> M <ACTIVE>
MAIN-SRV <87> - M <ACTIVE>
Get the DOMAIN or WORKGROUP (<1b> or <1d>)
$ nmblookup CASERO
querying CASERO on 10.255.255.255
10.1.1.3 CASERO<00>
10.1.1.55 CASERO<00>
10.1.1.104 CASERO<00>
Choose each of the hosts.
$ smbclient -L 10.1.1.55
added interface ip=10.1.1.99 bcast=10.255.255.255 nmask=255.0.0.0
Password:
Doing spnego session setup (blob length=104)
OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Sharename Type Comment
--------- ---- -------
IPC$ IPC Remote IPC
SharedDocs Disk
SQL BACKUP Disk
-----
The information contained in this message is proprietary of Casero Inc.,
protected from disclosure, and may be privileged. The information is
intended to be conveyed only to the designated recipient(s) of the
message. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, use, distribution or
copying of this communication is strictly prohibited and may be
unlawful. If you have received this communication in error, please
notify us immediately by replying to the message and deleting it from
your computer. Thank you.
More information about the jcifs
mailing list