Détails du package smp-install-wapt-with-psexec_22_all_NO_FOR_INSTALL_RUN_ONLY.wapt
retour Revenir à la liste des packages

smp-install-wapt-with-psexec

ATTENTION CE DÉPÔT n'est plus compatible 1.3 vous devez migrer en 1.5.1.21 !

Fichier control :

package           : smp-install-wapt-with-psexec
version           : 22
architecture      : all
section           : base
priority          : optional
maintainer        : Simon Fonteneau
description       : F9 in pyscripter for run install with psexec
depends           : 
conflicts         : 
maturity          : NO_FOR_INSTALL_RUN_ONLY
locale            : 
target_os         : 
min_os_version    : 
max_os_version    : 
min_wapt_version  : 
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : 
description_pl    : 
description_de    : 
description_es    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : d199a40d-1784-432d-94f4-d5a654af8177
signer            : wapt.lesfourmisduweb.org
signer_fingerprint: 8da83ebdac1a25e820b186510d049f47407b11835b0664fdc5bacd3595b1671d
signature         : t9G3LofXxxH3xijOZAB0lVVEEz0j676EQRmJh8yJeyGQBXJAvSMp1QWHBB1OEGolNMVyJ5qAkzlxLh1PlVFgPbLgQMP+8sNrXyrA16EcSInVHhKhkcuBRFw+52Y8o+YEVmX8L8yTLRxTQkZrGND2Lj/pukX2U5gqoff9Mn4uo9ufybBaK8gNy/JOprFR8qHkxFi7nt9yWR9bbWZXjP36tTQdfTcfrt5sddHkV9ldZ8Jas2tpFyFK/rKnjWZOZNCSdXanHslmmNeI7oVptyahRCFeJBQ2vKNYYmZl4Alipe+XXz+lrnIJ45q6QyL6Eqml0t+HKdlg8reMiFSIOYMMlg==
signature_date    : 20190119-125122
signed_attributes : package,version,architecture,section,priority,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,audit_schedule,editor,keywords,licence,homepage,package_uuid,signer,signer_fingerprint,signature_date,signed_attributes






Fichier setup.py :

# -*- coding: utf-8 -*-
from setuphelpers import *
import ipaddress
import waptguihelper
import json

uninstallkey = []

timeout = '2'
listplage = [u'192.168.149.0/24',u'192.168.154.0/24']
ipexcluded = ['192.168.149.11','192.168.149.12','192.168.149.254']

def install():
    pass

def install_wapt():
    urlserver = inifile_readstring(makepath(install_location('WAPT_is1'),'wapt-get.ini'),'global','wapt_server').replace('https://','').replace('http://','')
    credential = waptguihelper.login_password_dialog('Credentials for wapt server','https://%s' % urlserver,'admin','')
    htmlpage = json.loads(wgets(ur'https://%s:%s@%s/api/v2/waptagent_version' % (credential['user'],credential['password'],urlserver) ))['result']

    while True:
        listhost = data = json.loads(wgets(ur'https://%s:%s@%s/api/v1/hosts?columns=connected_ips&limit=10000' % (credential['user'],credential['password'],urlserver)))
        for host in listhost['result']:
            for ip in host['connected_ips']:
                if not ip in ipexcluded:
                    ipexcluded.append(ip)

        userpassword =  waptguihelper.login_password_dialog('Credentials for psexec','Credentials for psexec','MYDOMAIN\Administrateur','')
        argument = '--hash=%s --minversion=%s --wait=15 --waptsetupurl=%s' % (htmlpage['waptagent_sha256'],htmlpage['waptagent_version'],'http://%s/wapt/waptagent.exe' % urlserver)
        for ipplage in listplage :
            net4 = ipaddress.ip_network(ipplage)
            for ip in net4.hosts():
                if not str(ip) in ipexcluded :
                    print('---------------------------------------------------------')
                    print("Installation de wapt sur l'ip %s " % ip )
                    try:
                        print(run(r'PsExec.exe \\%s -accepteula -n 3 -u %s -p %s -c waptdeploy-psexec.exe %s ' % (ip,userpassword['user'],userpassword['password'],argument)))
                    except Exception as e :
                        if ur'Timeout accessing' in ensure_unicode(e):
                            print ('Timeout for ip : %s' % ip)
                        elif ur'Could not start PSEXESVC' in ensure_unicode(e):
                            print ('Could not start PSEXESVC : %s' % ip)
                        elif ur'Error copying waptdeploy.exe to remote system' in ensure_unicode(e):
                            print ('Error copying waptdeploy.exe to remote system : %s' % ip)
                        else :
                           print(ur'Unknow erreur : %s' % ensure_unicode(e))


if __name__ == '__main__':
    install_wapt()