tis-add-macaddress-computer-ad

4
Add macAddress in attribut computer in AD
483 downloads
Download

  Description 

  • package : tis-add-macaddress-computer-ad
  • version : 4
  • architecture : all
  • categories :
  • maintainer : Simon Fonteneau
  • description : Add macAddress in attribut computer in AD
  • locale :
  • target_os :
  • min_os_version :
  • max_os_version :
  • min_wapt_version : 1.5
  • sources :
  • installed_size :
  • impacted_process :
  • description_fr :
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor :
  • licence :
  • signature_date : 2020-02-27T21:27:05.528039

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
from pyad import pyad
import json

uninstallkey = []


attr = 'macAddress'

def install():
    pass


def update_package():
    from waptpackage import PackageEntry
    import waptguihelper

    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())

    urlserver = inifile_readstring(makepath(install_location('WAPT_is1'),'wapt-get.ini'),'global','wapt_server').replace('https://','')
    credentials_url = waptguihelper.login_password_dialog('Credentials for wapt server',urlserver,'admin','')


    for pc in json.loads(wgets('https://%s:%s@%s/api/v1/hosts?columns=connected_ips,mac_addresses,host_info/computer_ad_dn&limit=10000' % (credentials_url['user'],credentials_url['password'],urlserver)))['result']:
        dn = pc['host_info/computer_ad_dn']
        if not dn:
            continue
        mac = pc['mac_addresses']
        try:
            computer = pyad.from_dn(dn)
        except:
            continue
        if not 'ieee802Device' in computer.get_attribute('objectClass'):
            computer.append_to_attribute('objectClass','ieee802Device')
        print('Add %s to %s in %s' % (mac,attr,dn))
        computer.update_attribute(attr,mac)




if __name__ == '__main__':
    update_package()


										

  Changelog 


No changelog
  manifest.sha256 
[["setup.py","70afee198c67a8a1b2a91af19d813f4ba55f98297ee4c41f130b7d7753cb1d49"],["WAPT/certificate.crt","a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf"],["WAPT/icon.png","de66b9d0cbabcd492b7e6537b006e0bee30c9c8d615ef3723f71dab1ab1a0b29"],["WAPT/control","34ee134bc9959b4a28607830571e7ab5560b940b3d2162bc791d06db524ca700"],["WAPT/wapt.psproj","fdd9db03cb28a75c9b2af4f5154e55cce7feaa098404f37d3fe5c6cdfb483729"]]