Advertisement
Guest User

Untitled

a guest
Feb 1st, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. # -*- coding: utf-8 -*
  2.  
  3. # uninstall key retrieved from msi properties with 'ProductCode' key. See below
  4.  
  5. #ActiveX https://fpdownload.adobe.com/get/flashplayer/distyfp/current/win/install_flash_player_28_active_x.msi
  6. #NPAPI https://fpdownload.adobe.com/get/flashplayer/distyfp/current/win/install_flash_player_28_plugin.msi
  7. #PPAPI https://fpdownload.adobe.com/get/flashplayer/distyfp/current/win/install_flash_player_28_ppapi.msi
  8.  
  9. #Uninstaller
  10. #https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe
  11.  
  12. from setuphelpers import *
  13. import platform
  14.  
  15. # uninstall key retrieved from msi properties with 'ProductCode' key. See below
  16. uninstallkey=[]
  17.  
  18. def windows_version():
  19. """see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx"""
  20. try:
  21. return Version(platform.win32_ver()[1],3)
  22. except:
  23. return Version(platform.win32_ver()[1])
  24.  
  25. def install():
  26.  
  27.  
  28. for uninstall in installed_softwares('Adobe Flash Player'):
  29. if not 'MsiExec.exe' in uninstall['uninstall_string'] :
  30. if uninstall_key_exists(uninstall['key']):
  31. run_notfatal('"uninstall_flash_player.exe" -uninstall')
  32.  
  33. print("Installing flash for firefox")
  34. major_version = control.version.split('.',1)[0]
  35. install_msi_if_needed('install_flash_player_%s_plugin.msi'%major_version,killbefore=['firefox.exe','chrome.exe'])
  36.  
  37. print("Installing flash for internet explorer if < win10")
  38. if windows_version()<Version('6.2.0'):
  39. install_msi_if_needed('install_flash_player_%s_active_x.msi'%major_version,killbefore=['iexplore.exe'])
  40.  
  41. # DISABLED - AUTO INSTALLED WITH CHROME
  42. # print("Installing flash for Chrome")
  43. # if windows_version()<Version('6.2.0'):
  44. # install_msi_if_needed('install_flash_player_%s_ppapi.msi'%major_version,killbefore=['chrome.exe'])
  45.  
  46. print("Disable autoupdate")
  47. if iswin64():
  48. filecopyto("mms.cfg",makepath(os.environ['SYSTEMROOT'],"SysWOW64","Macromed","Flash"))
  49. else:
  50. filecopyto("mms.cfg",makepath(os.environ['SYSTEMROOT'],"System32","Macromed","Flash"))
  51.  
  52. for task in ('Adobe Flash Player Updater',"Adobe Flash Player PPAPI Notifier"):
  53. if task_exists(task):
  54. delete_task(task)
  55.  
  56. if service_installed('AdobeFlashPlayerUpdateSvc'):
  57. if service_is_running('AdobeFlashPlayerUpdateSvc'):
  58. service_stop('AdobeFlashPlayerUpdateSvc')
  59. run('sc delete AdobeFlashPlayerUpdateSvc')
  60.  
  61.  
  62. def update_sources():
  63. """Update to current version from macromedia"""
  64. os.chdir(os.path.dirname(__file__))
  65. # find latest version
  66. import requests,BeautifulSoup
  67. page = requests.get('https://get.adobe.com/fr/flashplayer',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}).text
  68. bs = BeautifulSoup.BeautifulSoup(page)
  69. latest_version = bs.find(id="autoSelectedVersion").find(id="AUTO_ID_columnleft_p_version").text.replace('Version','').strip()
  70. print('Latest version: %s' % latest_version)
  71.  
  72. major_version = latest_version.split('.',1)[0]
  73.  
  74. allmsi = glob.glob('*.msi')
  75. for msi in allmsi:
  76. vers = get_msi_properties(msi)['ProductVersion']
  77. if vers != latest_version :
  78. remove_file(msi)
  79.  
  80. if not isfile('install_flash_player_%s_active_x.msi' % major_version ) :
  81. wget('https://download.macromedia.com/get/flashplayer/pdc/%s/install_flash_player_%s_active_x.msi' % (latest_version,major_version),os.getcwd())
  82. if not isfile('install_flash_player_%s_plugin.msi' % major_version ) :
  83. wget('https://download.macromedia.com/get/flashplayer/pdc/%s/install_flash_player_%s_plugin.msi' % (latest_version,major_version),os.getcwd())
  84.  
  85. #if not isfile('install_flash_player_%s_ppapi.msi' % major_version ) :
  86. # wget('https://download.macromedia.com/get/flashplayer/pdc/%s/install_flash_player_%s_ppapi.msi' % (latest_version,major_version),os.getcwd())
  87.  
  88. wget('https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe' ,os.getcwd())
  89.  
  90. # change version of package
  91. from waptpackage import PackageEntry
  92. pe = PackageEntry()
  93. pe.load_control_from_wapt(os.getcwd())
  94. pe.version = get_msi_properties('install_flash_player_%s_active_x.msi' % major_version)['ProductVersion']+'-0'
  95. pe.save_control_to_wapt(os.getcwd())
  96.  
  97. if __name__ == '__main__':
  98. update_sources()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement