tis-patch-ms17-010-smb1flaw
8
patch for smb1 flaw ms17-010 for winxp, win2k3, Win7 and 2008r2 and win8
KB4012598 or KB4012212
3755 downloads

Description
- package : tis-patch-ms17-010-smb1flaw
- version : 8
- architecture : all
- categories :
- maintainer : htouvet-adm
- description : patch for smb1 flaw ms17-010 for winxp, win2k3, Win7 and 2008r2 and win8 KB4012598 or KB4012212
- locale :
- target_os :
- min_wapt_version :
- 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:39:26.669580
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')