Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # -*- coding: cp1252 -*-
  2. import win32net, win32file, win32netcon, win32wnet
  3.  
  4. def getPcs():
  5.     (l, t, r) = win32net.NetServerEnum(None, 100, win32netcon.SV_TYPE_AFP, None , 0, win32netcon.MAX_PREFERRED_LENGTH)
  6.     return (i['name'] for i in l)
  7.  
  8. def getResources(host=''):
  9.     (l, t, r) = win32net.NetShareEnum(host, 1, 0, -1)
  10.     for i in l:
  11.         print i
  12.  
  13. def getInfo(host=''):
  14.     dic = win32net.NetServerGetInfo(host, 100)
  15.     print dic
  16.  
  17. def shareInfo(host=''):
  18.    print win32net.NetShareGetInfo(host, 'c$',1)
  19.  
  20. def pcInfo(host=''):
  21.     print win32net.NetWkstaGetInfo(host, 100)
  22.    
  23. def diskEnum(host=''):
  24.     return win32net.NetServerDiskEnum(host, 0)
  25.  
  26.  
  27. def diskFreeInfo(path):
  28.     (a, b, c, d) = win32file.GetDiskFreeSpace(path)
  29.     print 'scetors per cluster:      ', a
  30.     print 'bytes per sector:         ', b
  31.     print 'number of free clusters:  ', c
  32.     print 'total numbers of clusters:', d
  33.     print '--------------------------'
  34.     print 'total espaco livre:       ', a*b*c, ' bytes'
  35.     print 'capacidade total:         ', a*b*d, ' bytes'
  36.  
  37. def copyFile(source, destino):
  38.     win32file.CopyFile(source, destino, 1)