Tranquil IT recrute Tranquil IT recrute

tis-mremoteng

Version : 1.76.11.40527-9

Download
  • package : tis-mremoteng
  • editor :
  • version : 1.76.11.40527-9
  • licence :
  • architecture : all
  • locale :
  • description :
  • description_fr : Administration machines distantes avec VNC, RDP, Putty SSH...
  • min_os_version : 6.1
  • max_os_version :
  • min_wapt_version :
  • installed_size :
  • impacted_process :
  • signature_date : 20181025-181024
  • maintainer : TIS <technique@tranquil-it-systems.fr>

setup.py

#!/usr/bin/python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
#    This file is part of WAPT
#    Copyright (C) 2013  Tranquil IT Systems http://www.tranquil.it
#    WAPT aims to help Windows systems administrators to deploy
#    setup and update applications on users PC.
#
#    WAPT is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    WAPT is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with WAPT.  If not, see <http://www.gnu.org/licenses/>.
#
# -----------------------------------------------------------------------
from setuphelpers import *
import wmi
import time

uninstallkey = []

def is_kb_installed(hotfixid):
    installed_update = installed_windows_updates()
    if [kb for kb in installed_update if kb['HotFixID' ].upper() == hotfixid.upper()]:
        return True
    return False


class EnsureWUAServRunning(object):
    """Context object to run wauserv in manual mode"""
    # https://msdn.microsoft.com/en-us/library/aa394418(v=vs.85).aspx#properties
    def __enter__(self):
        print ("Ensure wuauserv Auto Update option is disabled")
        self.old_au_options = registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update','AUOptions',0)
        c = wmi.WMI()
        for service in c.Win32_Service (Name='wuauserv'):
            self.wuaserv_start_mode = service.StartMode
            self.wuaserv_started = service.Started
            service.ChangeStartMode(StartMode="manual")
            service.StartService()

        start = time.time()
        for service in c.Win32_Service (Name='wuauserv'):
            while not service.Started and time.time() - start < 10:
                time.sleep(1)
            if not service.Started:
                raise Exception('Unable to start wuauserv')

        return self

    def __exit__(self,type, value, tb):
        print ("re-enabling wuauserv previous state: %s" % self.old_au_options)
        registry_set(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update','AUOptions',self.old_au_options)
        c = wmi.WMI()
        for service in c.Win32_Service (Name='wuauserv'):
            if not self.wuaserv_started:
                service.StopService()
            service.ChangeStartMode(StartMode=self.wuaserv_start_mode)

        start = time.time()
        for service in c.Win32_Service (Name='wuauserv'):
            while service.Started and time.time() - start < 10:
                time.sleep(1)

def waiting_for_reboot():
    # Query WUAU from the registry
    if reg_key_exists(HKEY_LOCAL_MACHINE,r"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") or \
        reg_key_exists(HKEY_LOCAL_MACHINE,r"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") or \
        reg_key_exists(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Updates\UpdateExeVolatile'):
        return True
    return False

def install():
    version_soft = control.version.split('-',1)[0]
    with EnsureWUAServRunning():
        # KB2574819
        if windows_version() >= Version('6.1') and windows_version() < Version('6.2'):
            if not is_kb_installed('KB2574819'):
                print('Install KB2574819')
                run('wusa.exe "Windows6.1-KB2574819-v2-x64.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
            if not is_kb_installed('KB2592687'):
                print('Install KB2592687')
                run('wusa.exe "Windows6.1-KB2592687-x64.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
        install_msi_if_needed(r'mRemoteNG-Installer-%s.msi' % version_soft,killbefore='mRemoteNG.exe')
        if waiting_for_reboot():
            print('Reboot needed..')

def audit():
    if waiting_for_reboot():
        print('Reboot needed')
        return 'ERROR'
    else:
        return 'OK'

def update_package():
    import BeautifulSoup,requests,re
    from waptpackage import PackageEntry
    verify=True
    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())
    current_version = pe['version'].split('-',1)[0]

    mremote_base_url = "https://github.com/mRemoteNG/mRemoteNG/releases/latest"
    software_name = "mRemoteNG"

    page = requests.get(mremote_base_url,headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'},verify=verify).text
    bs = BeautifulSoup.BeautifulSoup(page)

    bs_raw_string = str(bs.find('a',{'class':'css-truncate'}).text)
    print bs_raw_string
    software_version = re.findall('v(.*)',str(bs_raw_string))[0]

    print "Current %s WAPT package version is : %s" % (software_name,current_version)
    print "Latest %s version available is : %s" % (software_name,software_version)

    if Version(current_version) < Version(software_version):
        print("%s package is not up-to-date, updating" % software_name)
        print("Cleanup current MSI files")

        filename = bs.find('a',href=re.compile(".msi")).find("strong").text
        dest_filename = "mRemoteNG-Installer-%s.msi" % software_version

        for exe in glob.glob('*.msi'):
            if exe != dest_filename:
                remove_file(exe)

        print("Downloading latest version")
        download_url = 'https://github.com/mRemoteNG/mRemoteNG/releases/download/v%s/%s' % (software_version,filename)
        wget(download_url,dest_filename)

        pe.version = software_version + '-0'
        pe.save_control_to_wapt(os.getcwd())
    else:
        print("No update needed, package already up to date")

if __name__ == "__main__":
    update_package()

			

Changelog

12/06/2018
    Ajout installation KB2574819 pour Windows 7 64 bits
    64 bits uniquement
    Windows 7 et supérieur uniquement.

12/06/2018
    Ajout installation KB2592687

			

manifest.sha256

[["WAPT/icon.png", "f80d0f15c5bda3dc73f1ba1b0ea9445d0bdf4bd38ce524e17841f60a662d6017"], ["WAPT/certificate.crt", "13fb474c5c23c135a77aba592eb8821b9ecbcc463f5b7312312b87b20eac6779"], ["WAPT/wapt.psproj", "df3e2fa87fea9c7bdfcc22039b9ef7303f092898882d9f3f4233f5d92f90b3c7"], ["Windows6.1-KB2574819-v2-x64.msu", "7bbb0fb107cb22d6e000d0fe8c9883c7850423ea74d2f75907ebc5ac2151d2c0"], ["mRemoteNG-Installer-1.76.11.40527.msi", "ac0e3d6fab0d93e8bc51f656d476b8dda3a5451d796d6a8659feb49f9e0d3c2b"], ["setup.py", "fb74b525cfdadb5cdbdb656fae894d2ed092c9bcf4201e8e33a549a38ad7ff27"], ["Windows6.1-KB2592687-x64.msu", "3da700df334cad66df80f471bdc156ec3eeb6c637ee347fc2dc4de63d6854cd1"], ["WAPT/control", "27de85170678cb203e55ebcd222605b762b404669bf9e321a9f11454cb83560d"], ["WAPT/changelog.txt", "7918c2f2f0f1692576ed00582bfcd3ba729571ab5ccc78e376643f8fdc820e87"]]