Here is the process that i think it's should be implemented.
First : there is no wins !
1/ try to find domains -> get_domain_list ()
seems to work
return : {'IP': '192.168.1.101', 'DOMAIN': 'ENTREPRISE'}
2/trying to find hosts in domains : get_host_list
this function use IP and smbclient -N -L //ip
I think that it would be better to find hosts using 'DOMAIN': 'ENTREPRISE' with nmblookup -R 'DOMAIN'
nmblookup -R 'ENTREPRISE'
querying ENTREPRISE on 192.168.1.255
192.168.1.102 ENTREPRISE<00>
192.168.1.105 ENTREPRISE<00>
192.168.1.101 ENTREPRISE<00>
192.168.1.100 ENTREPRISE<00>
192.168.1.103 ENTREPRISE<00>
Here i have all my IP in my workgroup.
3/ We have to obtain Name instead of IP
i propose to do a :
nmblookup -A IP for each IP and extract the line where we have <20>
nmblookup -A 192.168.1.100 | grep "<20>"
--> SECRETAIRE <20> - B <ACTIVE>
SECRETAIRE is the NAME of IP=192.168.1.100
so we obtain a list of NAME
4/ Ask NAME to know if there is/are printer(s)
get_printer_list ({'IP': '192.168.1.100', 'NAME': 'SECRETAIRE'})
return
{'EPSON5700': ''}
Here is the process that i think it's should be implemented.
First : there is no wins !
1/ try to find domains -> get_domain_list ()
seems to work
return : {'IP': '192.168.1.101', 'DOMAIN': 'ENTREPRISE'}
2/trying to find hosts in domains : get_host_list
this function use IP and smbclient -N -L //ip
I think that it would be better to find hosts using 'DOMAIN': 'ENTREPRISE' with nmblookup -R 'DOMAIN'
nmblookup -R 'ENTREPRISE'
querying ENTREPRISE on 192.168.1.255
192.168.1.102 ENTREPRISE<00>
192.168.1.105 ENTREPRISE<00>
192.168.1.101 ENTREPRISE<00>
192.168.1.100 ENTREPRISE<00>
192.168.1.103 ENTREPRISE<00>
Here i have all my IP in my workgroup.
3/ We have to obtain Name instead of IP
i propose to do a :
nmblookup -A IP for each IP and extract the line where we have <20>
nmblookup -A 192.168.1.100 | grep "<20>"
--> SECRETAIRE <20> - B <ACTIVE>
SECRETAIRE is the NAME of IP=192.168.1.100
so we obtain a list of NAME
4/ Ask NAME to know if there is/are printer(s)
get_printer_list ({'IP': '192.168.1.100', 'NAME': 'SECRETAIRE'})
return
{'EPSON5700': ''}
so it's seems ok