tis-patch-ms17-010-smb1flaw 8

  • package : tis-patch-ms17-010-smb1flaw
  • version : 8
  • architecture : all
  • locale :
  • description : patch for smb1 flaw ms17-010 for winxp, win2k3, Win7 and 2008r2 and win8 KB4012598 or KB4012212
  • maintainer : htouvet-adm
  • date : 2018-02-27 19:06:44
  • min_wapt_version :
  • min_os_version :
  • max_os_version : 6.2
  • impacted_process :

setup.py

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform
from smb_ms17_010 import check

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


def pending_reboot_reasons():
    result = []
    reboot_required = registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update','RebootRequired',0)
    if reboot_required:
        result.append('Windows Update: %s' % reboot_required)
    reboot_pending = registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing','RebootPending',0)
    if reboot_pending:
        result.append('CBS Updates: %s' % reboot_pending)
    renames_pending = registry_readstring(HKEY_LOCAL_MACHINE,r'SYSTEM\CurrentControlSet\Control\Session Manager','PendingFileRenameOperations',None)
    if renames_pending:
        result.append('File renames: %s' % renames_pending)
    return result


def install():
    restart_needed_by = []
    try:
        flaw = check('127.0.0.1')
        print('Check localhost : %s' % flaw)
    except Exception as e:
        print('Error checking flaw: %s' % repr(e))
        flaw = []

    if windows_version() < Version('6.0'):
        # http://www.catalog.update.microsoft.com/search.aspx?q=4012598
        if not is_kb_installed('KB4012598'):
            if platform.win32_ver()[0]=='XP':
                product = registry_readstring(HKEY_LOCAL_MACHINE,r'SYSTEM\CurrentControlSet\Control\ProductOptions\ProductSuite',None)
                if product == 'EmbeddedNT':
                    print('installing patch for MS17-010 for Windows XP Embedded')
                    install_exe_if_needed("WindowsXP-KB4012598-x86-Embedded-Custom-ENU.exe",'/quiet /norestart',key='',min_version='1')
                else:
                    print('installing patch for MS17-010 for winxp')
                    install_exe_if_needed("windowsxp-kb4012598-x86-custom-fra_eb47689656c58ab374521babb9bdca07304d87f5.exe",'/quiet /norestart',key='',min_version='1')
            elif platform.win32_ver()[0]=='2003Server':
                print('installing patch for MS17-010 for win2k3')
                if iswin64():
                    install_exe_if_needed('WindowsServer2003-KB4012598-x64-custom-ENU.exe','/quiet /norestart',key='',min_version='1')
                else:
                    install_exe_if_needed("windowsserver2003-kb4012598-x86-custom-fra_9cf9ac070a1b21bca6757de5d127427c090d581d.exe",'/quiet /norestart',key='',min_version='1')
        else:
            print('KB4012598 already installed')
    elif windows_version() < Version('6.1'):
        # vista
        if not is_kb_installed('kb4012598'):
            if iswin64():
                run('wusa.exe "windows6.0-kb4012598-x64_6a186ba2b2b98b2144b50f88baf33a5fa53b5d76.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
            else:
                run('wusa.exe "windows6.0-kb4012598-x86_13e9b3d77ba5599764c296075a796c16a85c745c.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
        else:
            print('kb4012598 already installed')
    elif windows_version() < Version('6.2'):
        if not is_kb_installed('kb4012212'):
            if iswin64():
                run('wusa.exe "windows6.1-kb4012212-x64_2decefaa02e2058dcd965702509a992d8c4e92b3.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
            else:
                run('wusa.exe "windows6.1-kb4012212-x86_6bb04d3971bb58ae4bac44219e7169812914df3f.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
        else:
            print('kb4012598 already installed')
    elif windows_version() < Version('6.3'):
        if not is_kb_installed('kb4012598'):
            if iswin64():
                run('wusa.exe "windows8-rt-kb4012598-x64_f05841d2e94197c2dca4457f1b895e8f632b7f8e.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
            else:
                run('wusa.exe "windows8-rt-kb4012598-x64_f05841d2e94197c2dca4457f1b895e8f632b7f8e.msu" /quiet /norestart',accept_returncodes=[0,3010,2359302,-2145124329],timeout=3600)
        else:
            print('kb4012598 already installed')
    else:
        print ("this package is for winxp, win2k3 and 7 only")

    if flaw:
        error('Please check... :\n %s' % '\n'.join(repr(e) for e in flaw))

    restart_needed_by.extend(pending_reboot_reasons())
    if restart_needed_by:
        with disable_file_system_redirection():
            run_notfatal('msg * /time:360 Merci de redemarrer votre ordinateur pour terminer les mises a jour. Tranquil IT Systems.')
        error('Redemarrage necessaire pour : %s ' % restart_needed_by)
    else:
        print('No reboot required')


    

Changelog

No changelog
    

manifest.sha256

smb_ms17_010.py 994163811a551001faee1d5fe97705286df3f83b77d7a79cc73e47fde903bf38
WindowsServer2003-KB4012598-x64-custom-ENU.exe fa2f1ac56bb81d236e797afea75ce4f4ecf374ed1182e7e2337350f387fd5eac
test_smb1.py f47538ebd4fd59b3b2daa6be26d33e3b157ff99a0433cbadfb4e9d485c16f8d1
windows6.0-kb4012598-x86_13e9b3d77ba5599764c296075a796c16a85c745c.msu fc7f28a72c117c2a8ece5916532048c8bf3379c86386348c24319eac2c6b23c8
WAPT/wapt.psproj 795d36d10109ca85357285f79090fac2be856e5830ea31fa913cc55cb825807b
windows6.0-kb4012598-x64_6a186ba2b2b98b2144b50f88baf33a5fa53b5d76.msu a91a0af728225ff2a630b9aba4e639473aa8abe7caa23be10ae48a7887bde9c8
WAPT/certificate.crt 79e5388683c0b6cb03f4f81e4e58e3a11463b2b6cf169dd9c453098027dcfaa4
windows8-rt-kb4012598-x86_a0f1c953a24dd042acc540c59b339f55fb18f594.msu 6589008f680328707aaae689a396ee0fbcd180f797228e36cb7019e65ee735ca
windows6.1-kb4012212-x64_2decefaa02e2058dcd965702509a992d8c4e92b3.msu e98d6c7f09c8abc59eda198880074675a707415dbddb694a4a4a6a98df63a7c8
windows6.1-kb4012212-x86_6bb04d3971bb58ae4bac44219e7169812914df3f.msu 383d1cd1d2e99a4d21504905bf9ee253908fc46ab84dd56759b0b30665cc7c46
windows8-rt-kb4012598-x64_f05841d2e94197c2dca4457f1b895e8f632b7f8e.msu b21ab6c6ebb70e8d74a00d05e83f38939d7e958c3bc5d92463febe440ccd82d1
windowsserver2003-kb4012598-x86-custom-fra_9cf9ac070a1b21bca6757de5d127427c090d581d.exe 1f113bbcb4ec87efb80b105de1591e42dd9ff41f2f81fe04bab3e878cd5c069e
setup.py 8071de806069eb57dcb9762054742fdfb9cb4c3b5236afbed5a8f3526e7bb149
WindowsXP-KB4012598-x86-Embedded-Custom-ENU.exe 8eef0b2ec29e458a87b0a4042c23117ad42d9a203d3c99de65bdfb14d00ddbe1
windowsxp-kb4012598-x86-custom-fra_eb47689656c58ab374521babb9bdca07304d87f5.exe 3b5aa3201ca409a073dabff9c5fdd8a635851eb37befaef28829c4f374367412
WAPT/control 7367f3e061dee5edbd381f7c66995dd53deb30ff9dfacf04fb4cf2fe543fe3f2