diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..90c0ba7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.msi filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/.gitignore b/.gitignore index e61bca2..45a2896 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,6 @@ dmypy.json # Pyre type checker .pyre/ +WAPT/certificate.crt +WAPT/manifest.sha256 +WAPT/signature.sha256 \ No newline at end of file diff --git a/WAPT/changelog.txt b/WAPT/changelog.txt new file mode 100644 index 0000000..866bb26 --- /dev/null +++ b/WAPT/changelog.txt @@ -0,0 +1 @@ +https://support.google.com/chrome/a/answer/7679408 \ No newline at end of file diff --git a/WAPT/control b/WAPT/control new file mode 100644 index 0000000..04e65ff --- /dev/null +++ b/WAPT/control @@ -0,0 +1,38 @@ +package : fws-chrome +version : 78.0.3904.108-6 +architecture : all +section : base +priority : optional +name : Google Chrome +categories : Internet +maintainer : Daniel Berteaud +description : Google Chrome is a web browser created by Google and based on the open source project Chromium +depends : +conflicts : +maturity : PROD +locale : all +target_os : windows +min_os_version : 6.1 +max_os_version : +min_wapt_version : 1.7 +sources : https://cloud.google.com/chrome-enterprise/browser/download/ +installed_size : +impacted_process : chrome.exe +description_fr : Google Chrome est un navigateur web créé par Google et basé sur le projet open source Chromium +description_pl : +description_de : +description_es : +audit_schedule : +editor : Google +keywords : browser,navigateur,Google,Chrome,Chromium +licence : Freeware +homepage : https://www.google.com/chrome/ +package_uuid : a154eb6c-cd7d-4e19-9d75-43596d8595a7 +valid_from : +valid_until : +forced_install_on : +signer : Daniel Berteaud +signer_fingerprint: 3c9415559e2dedbc4390e3faa2c28d3b67265baa5b35902d2764d9e41c3b3f0a +signature : tZph2uBpBxXMgtr7lxh6/Qa5U3UEaeK67CS7NAwx0/hmI9hlSmtWTPYrhOUAa6rDjTOwY1hR76ojdLlYLRK4W7yzZG0ej6QxammWEh3qzh47mHADMwXiVxzktvYfrBj/mVRjdX/G5Z0hPHqCyAlMraXZkVa9HnWqY/FNswkOyYmayEW5HTJg+K9JE8yEGnd5VAnzKqrBIXo2aTcwCDcctiNqrTEOhcrNBZfA0gcC/yHwbKkmeP3Z1zLdMOUyIazsxZ5qqfeHRzVHXAG9u1wPFaQjNJt70eMUdXZ4UlmVWTMzBNlcMJnDo65LjL+LkRiunTYVKNSUSKzG8WyS3wygmg== +signature_date : 2019-11-21T11:12:26.124000 +signed_attributes : package,version,architecture,section,priority,name,categories,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,valid_from,valid_until,forced_install_on,signer,signer_fingerprint,signature_date,signed_attributes \ No newline at end of file diff --git a/WAPT/icon.png b/WAPT/icon.png new file mode 100644 index 0000000..a01304a Binary files /dev/null and b/WAPT/icon.png differ diff --git a/WAPT/wapt.psproj b/WAPT/wapt.psproj new file mode 100644 index 0000000..283d844 --- /dev/null +++ b/WAPT/wapt.psproj @@ -0,0 +1,295 @@ +[PyScripter] +Version=3.3.2.0 + +[Project] +ClassName=TProjectRootNode +StoreRelativePaths=TRUE +ShowFileExtensions=FALSE + +[Project\ChildNodes\Node0] +ClassName=TProjectFilesNode + +[Project\ChildNodes\Node0\ChildNodes\Node0] +ClassName=TProjectFolderNode +Name=wapt + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node0] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\common.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node1] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\setuphelpers.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node2] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\wapt-get.ini + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node3] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\wapt-get.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node4] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\waptpackage.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes] +Count=5 + +[Project\ChildNodes\Node0\ChildNodes\Node1] +ClassName=TProjectFileNode +FileName=$[Project-Path]changelog.txt + +[Project\ChildNodes\Node0\ChildNodes\Node2] +ClassName=TProjectFileNode +FileName=$[Project-Path]control + +[Project\ChildNodes\Node0\ChildNodes\Node3] +ClassName=TProjectFileNode +FileName=$[Project-Path]..\setup.py + +[Project\ChildNodes\Node0\ChildNodes] +Count=4 + +[Project\ChildNodes\Node1] +ClassName=TProjectRunConfiguationsNode + +[Project\ChildNodes\Node1\ChildNodes\Node0] +ClassName=TProjectRunConfiguationNode +Name=install + +[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=install "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node1] +ClassName=TProjectRunConfiguationNode +Name=remove + +[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=remove "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node2] +ClassName=TProjectRunConfiguationNode +Name=session-setup + +[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=session-setup "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node3] +ClassName=TProjectRunConfiguationNode +Name=update + +[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=update +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node4] +ClassName=TProjectRunConfiguationNode +Name=upgrade + +[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=-f upgrade +WorkingDir=$[ActiveScript-Dir] +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node5] +ClassName=TProjectRunConfiguationNode +Name=-i build-upload + +[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=-i build-upload "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node6] +ClassName=TProjectRunConfiguationNode +Name=svn update + +[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=sources "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node7] +ClassName=TProjectRunConfiguationNode +Name=uninstall + +[Project\ChildNodes\Node1\ChildNodes\Node7\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=uninstall "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node7\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[Project-Path].. +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node8] +ClassName=TProjectRunConfiguationNode +Name=update-package-sources + +[Project\ChildNodes\Node1\ChildNodes\Node8\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=update-package-sources "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node8\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes\Node9] +ClassName=TProjectRunConfiguationNode +Name=audit + +[Project\ChildNodes\Node1\ChildNodes\Node9\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=audit -f "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node9\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] +ShortCut=0 +MessagesFormat=$[FileName] $[LineNumber] + +[Project\ChildNodes\Node1\ChildNodes] +Count=10 + +[Project\ChildNodes] +Count=2 + +[Project\ExtraPythonPath] +Count=0 + diff --git a/googlechromestandaloneenterprise.msi b/googlechromestandaloneenterprise.msi new file mode 100644 index 0000000..34bb86e --- /dev/null +++ b/googlechromestandaloneenterprise.msi @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1232162e5bf3f80aefcf4aa99cd52c72c5c700f1e6e2bb71eecd3076cd6ced7e +size 59219976 diff --git a/googlechromestandaloneenterprise64.msi b/googlechromestandaloneenterprise64.msi new file mode 100644 index 0000000..8a7c9f6 --- /dev/null +++ b/googlechromestandaloneenterprise64.msi @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d6468522c34b7eb480eff34b4727c879ba82e27b83ede10db64ed6f41465bf6 +size 60141576 diff --git a/master_preferences.j2 b/master_preferences.j2 new file mode 100644 index 0000000..0c6f7fd --- /dev/null +++ b/master_preferences.j2 @@ -0,0 +1,30 @@ +{ + "homepage": "{{ web_home_page }}", + "homepage_is_newtabpage": false, + "browser": { + "show_home_button": true + }, + "bookmark_bar": { + "show_on_all_tabs": true + }, + "sync_promo": { + "show_on_first_run_allowed": false + }, + "distribution": { + "skip_first_run_ui" : true, + "import_bookmarks": false, + "import_history": false, + "import_home_page": false, + "import_search_engine": false, + "suppress_first_run_bubble": true, + "do_not_create_desktop_shortcut": true, + "do_not_create_quick_launch_shortcut": true, + "do_not_launch_chrome": true, + "do_not_register_for_update_launch": true, + "make_chrome_default": false, + "make_chrome_default_for_user": false, + "suppress_first_run_default_browser_prompt": true, + "system_level": true, + "verbose_logging": false + } +} \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..8a29edf --- /dev/null +++ b/setup.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +from setuphelpers import * +from jinja2 import Environment, FileSystemLoader + +uninstallkey = [] + +variables = { + 'web_home_page': 'https://google.fr' +} + +# Declaring specific app values (TO CHANGE) +chrome_app_path=makepath(programfiles32,'Google','Chrome','Application') +chrome_bin_path=makepath(chrome_app_path,'chrome.exe') +bin_name = 'googlechromestandaloneenterprise64.msi' if iswin64() else 'googlechromestandaloneenterprise.msi' + +# Read local variables file if available +if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')): + print('Reading local encrypted variables file') + from cryptography.fernet import Fernet + import yaml + f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()) + variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) + +def install(): + print('Installing %s' % control.asrequirement()) + + # Specific app values + package_version = control['version'].split('-',1)[0] + skip = False + + # Getting the used storage on programfiles before installation (place it on the top) + get_disk_free_space_before = get_disk_free_space(programfiles) + + if isfile(chrome_bin_path): + if Version(get_file_properties(chrome_bin_path)['ProductVersion']) >= Version(package_version): + print('File %s version is : %s ' % (chrome_bin_path,get_file_properties(chrome_bin_path)['ProductVersion'])) + print('Package version is : %s ' % package_version) + uninstallkey_from_file = get_msi_properties(bin_name)['ProductCode'] + if uninstall_key_exists(uninstallkey_from_file): + uninstallkey.append(uninstallkey_from_file) + skip = True + + if (not skip) or (force == True) : + def get_version_chrome(key): + return get_file_properties(chrome_bin_path)['ProductVersion'] + install_msi_if_needed(bin_name + ,min_version=package_version + ,get_version=get_version_chrome) + + # Disabling Google Chrome auto updates + for task in ['GoogleUpdateTaskMachineCore', 'GoogleUpdateTaskMachineUA']: + if task_exists(task): + disable_task(task) + + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Policies\\Google\\Update','UpdateDefault',0,type=REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Policies\\Google\\Update','DisableAutoUpdateChecksCheckboxValue',1,type=REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Policies\\Google\\Update','AutoUpdateCheckPeriodMinutes',0,type=REG_DWORD) + if iswin64(): + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432Node\\Google\\Update','UpdateDefault',0,type=REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432Node\\Google\\Update','DisableAutoUpdateChecksCheckboxValue',1,type=REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432Node\\Google\\Update','AutoUpdateCheckPeriodMinutes',0,type=REG_DWORD) + + # Disabling Google Chrome telemtry + registry_setstring(HKEY_LOCAL_MACHINE,'SOFTWARE\\Policies\\Explorer\\DisallowRun','chrome_telemetry','Software_Reporter_Tool.exe',type=REG_SZ) + + # Adding master preferences file + jinja2 = Environment( + loader=FileSystemLoader(os.getcwd()), + trim_blocks=True + ) + open(makepath(chrome_app_path,'master_preferences'),'w').write( + jinja2.get_template('master_preferences.j2').render( + web_home_page = variables['web_home_page'] + ) + ) + + # Return used storage of the program. (place it on the bottom) + get_disk_free_space_after = get_disk_free_space(programfiles) + free_space_after_diff = get_disk_free_space_before - get_disk_free_space_after + print("Storage used: " + str(free_space_after_diff)) + + +def uninstall(): + print('uninstalling %s' % control.asrequirement()) + + if uninstall_key_exists('Google Chrome'): + if not "msiexec" in ' '.join(list(uninstall_cmd('Google Chrome'))).lower(): + versionsoft = get_file_properties(chrome_bin_path)['ProductVersion'] + run('"%s" --uninstall --system-level --force-uninstall --qn' % makepath(install_location('Google Chrome'),versionsoft,'Installer','setup.exe'),accept_returncodes=[19]) + + +def session_setup(): + print('Session setup for %s' % control.asrequirement()) + print('Disabling Telemetry') + + swreporter_path=makepath(user_local_appdata,'Google','Chrome','User Data','SwReporter') + + if isdir(swreporter_path): + remove_tree(swreporter_path) + + +def update_package(): + print('Update package content from upstream binary sources') + from waptpackage import PackageEntry + import requests + import json + + # Get latest version number from official website + latest_version = json.loads(wgets('http://omahaproxy.appspot.com/all.json?os=win64&channel=stable'))[0]['versions'][0]['version'] + pe = PackageEntry() + control = pe.load_control_from_wapt(os.getcwd()) + current_version = control['version'].split('-',1)[0] + + base_url = 'https://dl.google.com/tag/s/dl/chrome/install/' + if Version(latest_version) > Version(current_version): + print('Latest ' + control.name + ' version is: ' + latest_version) + + for file in ['googlechromestandaloneenterprise64.msi', 'googlechromestandaloneenterprise.msi']: + url_dl = base_url + file + + # Downloading latest binaries + if isfile(file): + remove_file(file) + + print('Downloading ' + file + ' from ' + url_dl) + wget(url_dl, file) + + pe.version = latest_version + '-0' + pe.maturity = 'PREPROD' + pe.save_control_to_wapt(os.getcwd()) + print('Package updated to %s' % latest_version) + + else: + print('This package is already up-to-date') + for file in ['googlechromestandaloneenterprise64.msi', 'googlechromestandaloneenterprise.msi']: + if not isfile(file): + url_dl = base_url + file + print('%s file is missing, downloading it from %s' % (file, url_dl)) + wget(url_dl, file) + +if __name__ == '__main__': + update_package() +