$ export base=http://www.sourcefiles.org/Programming/Libraries/Communications/ # -- $base/pysmb-0.4.4.tar.gz.shtml (README file) says "An experimental SMB/CIFS library written in Python" $ wget $base/pysmb-0.4.4.tar.gz $ tar zxf pysmb-0.4.4.tar.gz $ cd pysymb # Ambrose has some directories of movies available # on a machine I can get to on my mac as "smb://sasbrose" # It'll accept any username, and doesn't need a password. $ ./smblistshare dasbrose Connecting to dasbrose using 10.1.4.185 Password for mahoney@dasbrose: Type Share Name Comments ======= =============== ======== IPC IPC$ Disk My eBooks Disk For Jordon Disk C$ Disk ADMIN$ Disk My Videos Disk READ ME! Disk latin Disk Files Disk My Movies Disk My Music Disk E$ Disk More TV # ... which shows that something here is working. # the nmbquery tool wasn't as successful; # I'm not sure that we have a "master browser" # which advertises available hosts running on our network. $ ./nmbquery -M - Querying - on 10.1.4.176 __MSBROWSE__ $ host 10.1.4.176 176.4.1.10.in-addr.arpa domain name pointer mdhcp176.marlboro.edu. $ ./nmbquery 10.1.4.176 Querying 10.1.4.176 on Name query failed to find 10.1.4.176 $ ping 10.1.4.176 PING 10.1.4.176 (10.1.4.176) 56(84) bytes of data. 64 bytes from 10.1.4.176: icmp_seq=1 ttl=128 time=6.22 ms ... # So that host is up. Either I'm not using nmbquery correctly, # or the host is giving it what it wants. # NetBIOS (smb) names and IP names are kinda orthogonal; # I see come descriptions of tools that'll convert $ nbtstat ... 6 names in resposnse : testbox3 ... $ nmblookup # This one is installed on cs # So, a bit more testing : $ nmblookup -a dasbrose # what's the IP of NetBios "dasbrose"? querying dasbrose on 10.1.255.255 10.1.4.185 dasbrose<00> $ nmblookup dasbrose # Is there a node answering to "dasbrose" querying dasbrose on 10.1.255.255 10.1.4.185 dasbrose<00> # Yup. # installed samba on cs : $ apt-get install samba # ... starting samba daemons # (see /etc/samba/smb.conf and /etc/init.d/samba) $ ls /usr/bin/smb* smbtree browse smb network smbclient ftp-like access to smb hosts/files ... # So let's sewe what's visible on our network ... $ smbtree password: # I lleft this blank # Got a long, long list, including WORKGROUP \\ZINCO \\WOODROW \\PRINTERS \\PRINTERS\ADMIN$ \\PRINTERS\liblab MSHOME \\TONTO\TV COTTAGE 5 \\DASBROSE Ambrose's Stuff COLLEGE \\DOUG # So there is some way to get this information. # I also see that there's an ubuntu package named "python2.4-samba", # which I've now installed on cs $ python > import samba > dir(samba) > help(samba) File /usr/lib/python2.4/site-packages/samba/__init__.py see /usr/share/doc/python2.4-samba/examples/ # I can't find an API for this thing anywhere, # and the examples aren't helpful. # Basically the documentation sucks. $ ls /usr/lib/python2.4/site-packages/samba/ __init__.py : "Try using help() to examine their documentation" lsa.so printerdata.py samr.so smb.so spoolss.so srvsvc.so tdb.so tdbpack.so winbind.so winreg.so # Nothing is getting imported into the namespace. # The system thinks the package is installed, but # (a) I don't see the .py files and can't tell what's here, # (b) the examples don't work : $ python >> from samba import spoolss Traceback (most recent call last): File "", line 1, in ? ImportError: samba/spoolss.so: undefined symbol: cli_nt_session_open # My guess is that these are files that were compiled on # some other architecture, and won't run here. Worthless. # So I removed it $ apt-get remove python2.4-samba # It might be possible to build it; that's more work than I'm taking on now. ---------- $ ./nmbquery -S -T WORKGROUP pq.marlboro.edu 10.1.2.12 WORKGROUP Looking up status of WORKGROUP Received 6 names PRINTERS - PRINTERS - PRINTERS - WORKGROUP - WORKGROUP - WORKGROUP - ./nmbquery -S -A 10.1.2.12 Looking up status of 10.1.2.12 Received 6 names PRINTERS - PRINTERS - PRINTERS - WORKGROUP - WORKGROUP - WORKGROUP - $ ./nmbquery DASBROSE Querying DASBROSE on 10.1.4.185 DASBROSE