Skip to content

Instantly share code, notes, and snippets.

@hackingbutlegal
Created February 12, 2013 04:22
Show Gist options
  • Save hackingbutlegal/4760227 to your computer and use it in GitHub Desktop.
Save hackingbutlegal/4760227 to your computer and use it in GitHub Desktop.
Windows: Get some information
import win32net
#print users
users = win32net.NetUserEnum('localhost', 0)
print "USERS"
print "=========="
for user in users[0]:
print user['name']
print ""
#print groups
groups = win32net.NetGroupEnum('localhost', 0)
print "GROUPS"
print "=========="
for group in groups[0]:
print group['name']
print ""
#print shares
shares = win32net.NetShareEnum('localhost', 0)
print "SHARES"
print "=========="
for share in shares[0]:
print share['netname']
print ""
#print servers
servers = win32net.NetServerEnum(None, 100)
print "SERVERS"
print "=========="
for server in servers[0]:
print server['name']
print ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment