From 6fc04266d41652d2f8a8846446c241e0f2a62955 Mon Sep 17 00:00:00 2001 From: Alan Mason <@2Shirt> Date: Fri, 17 Nov 2017 01:02:24 -0700 Subject: [PATCH] 2017-11: Retroactive Updates ## MAJOR refactoring done ## * All .cmd Command scripts * Brandind / Settings variables now set via .bin/Scripts/settings/main.py * Window titles now set using KIT_FULL_NAME * All .py Python scripts * All ClientDir paths should now use KIT_SHORT_NAME * Long lines wrapped to better follow PEP8 * String formatting now more consistant * Updated run_program() and popen_program() calls to use lists * (e.g. cmd = ['', '', '']; run_program(cmd)) ** Should improve clarity IMO * Update window titles AFTER init_global_vars() so KIT_FULL_NAME can be used * Branding / Settings * Support tech now configurable * (e.g. "Please let {tech} know and they'll look into it") * Timezone now configurable * Upload info can now be disabled/enabled in .bin/Scripts/settings/main.py * CHKDSK * Combined read-only and fix scripts and added menu * DISM * Combined ScanHealth and RestoreHealth scripts and added menu * functions/common.py * BREAKING: run_program() and popen_program() no longer accept 'args' variable * Misc * Removed Win7 NVMe launcher * Never used and Win7 is deprecated * Removed "DeviceRemover" and "Display Driver Uninstaller" launchers * Both cut too deep and were not useful * Removed Nirsoft utilities and Sysinternals Suite launchers * Too many tools unused. * Added .url links to the websites in case the tools are needed * Replaced WinDirStat with TreeSizeFree * Replaced Q-Dir launcher with XYplorer launcher * Q-Dir was running into issues on Windows 10 * Removed C.IntRep, ESET, and MBAM launchers from "OSR & VR" * Removed JRT * Deprecated and discontinued by MBAM * Removed unsupported QuickBooks launchers (2014 and older) * Removed unsupported Office launchers (2010 and 2013\365) * Removed "Revo Uninstaller" launcher * Removed infrequently used tools from "Diagnostics" * Auslogics DiskDefrag * BatteryInfoView * BIOSCodes * GpuTest * HeavyLoad * Bugfixes * major_exception() try-blocks should catch CTL+c again * Allows for manual script bailing --- .bin/HWiNFO/general.ini | 664 ++++ .bin/SDI/sdi.cfg | 23 + .bin/Scripts/Launch.cmd | 91 +- .bin/Scripts/Launcher_Template.cmd | 17 +- .bin/Scripts/_Update Kit.cmd | 19 +- .bin/Scripts/activate.py | 20 +- .bin/Scripts/{ => borrowed}/acpi.py | 2 + .bin/Scripts/borrowed/knownpaths-LICENSE.txt | 21 + .bin/Scripts/borrowed/knownpaths.py | 164 + .bin/Scripts/cbs_fix.py | 38 + .bin/Scripts/check_disk.py | 32 +- .bin/Scripts/check_disk_fix.py | 45 - .bin/Scripts/dism.py | 32 +- .bin/Scripts/functions.py | 2811 ----------------- .bin/Scripts/functions/activation.py | 71 + .bin/Scripts/functions/browsers.py | 447 +++ .bin/Scripts/functions/build.py | 157 + .bin/Scripts/functions/cleanup.py | 91 + .bin/Scripts/functions/common.py | 731 +++++ .bin/Scripts/functions/data.py | 586 ++++ .bin/Scripts/functions/diags.py | 114 + .bin/Scripts/functions/info.py | 465 +++ .../Scripts/{ => functions}/partition_uids.py | 2 +- .bin/Scripts/functions/product_keys.py | 111 + .bin/Scripts/functions/repairs.py | 126 + .bin/Scripts/functions/setup.py | 277 ++ .bin/Scripts/gen_office.bash | 84 - .bin/Scripts/init_client_dir.cmd | 34 +- .bin/Scripts/install_sw_bundle.py | 25 +- .bin/Scripts/safemode_enter.py | 21 +- .bin/Scripts/safemode_exit.py | 19 +- .bin/Scripts/settings/main.py | 68 + .bin/Scripts/sfc_scan.py | 15 +- .bin/Scripts/system_checklist.py | 80 +- .bin/Scripts/system_diagnostics.py | 99 +- .bin/Scripts/transferred_keys.py | 24 +- .bin/Scripts/update_kit.py | 85 +- .bin/Scripts/user_checklist.py | 66 +- .bin/Scripts/user_data_transfer.py | 38 +- .bin/XYplorerFree/Data/XYplorer.ini | Bin 0 -> 80190 bytes .gitignore | 19 +- Activate Windows.cmd | 17 +- Copy WizardKit.cmd | 22 +- Data Recovery/PhotoRec (CLI).cmd | 17 +- Data Recovery/PhotoRec.cmd | 17 +- Data Recovery/TestDisk.cmd | 17 +- Data Transfers/FastCopy (as ADMIN).cmd | 17 +- Data Transfers/FastCopy.cmd | 17 +- Data Transfers/KVRT.cmd | 17 +- Data Transfers/Q-Dir (as ADMIN).cmd | 111 - Data Transfers/Q-Dir.cmd | 111 - Data Transfers/Transferred Keys.cmd | 17 +- Data Transfers/User Data Transfer.cmd | 17 +- .../XYplorer (as ADMIN).cmd | 23 +- .../XYplorer.cmd | 31 +- Diagnostics/Extras/AIDA64.cmd | 17 +- Diagnostics/Extras/Auslogics DiskDefrag.cmd | 111 - .../Autoruns (with VirusTotal Scan).cmd | 19 +- Diagnostics/Extras/BIOSCodes.cmd | 111 - Diagnostics/Extras/BleachBit.cmd | 17 +- Diagnostics/Extras/BlueScreenView.cmd | 17 +- Diagnostics/Extras/ERUNT.cmd | 17 +- Diagnostics/Extras/GpuTest.cmd | 111 - Diagnostics/Extras/HWiNFO (Sensors).cmd | 19 +- Diagnostics/Extras/HeavyLoad.cmd | 111 - Diagnostics/Extras/HitmanPro (FullBreach).cmd | 112 - Diagnostics/Extras/HitmanPro.cmd | 17 +- Diagnostics/HWiNFO.cmd | 19 +- Diagnostics/ProduKey.cmd | 17 +- Drivers/{ => Extras}/AMD.url | 0 Drivers/Extras/Acer.cmd | 29 +- Drivers/Extras/Device Remover.url | 5 + Drivers/Extras/DeviceRemover.cmd | 111 - Drivers/Extras/Display Driver Uninstaller.cmd | 111 - .../Extras/Display Driver Uninstaller.url | 2 +- .../Intel Driver & Support Assistant.url | 5 + Drivers/Extras/Lenovo.cmd | 29 +- Drivers/{ => Extras}/NVIDIA.url | 0 Drivers/Extras/Samsung Tools & Software.url | 5 + Drivers/Extras/Toshiba.cmd | 29 +- Drivers/Intel Driver Update Utility.cmd | 111 - Drivers/Intel RST (Current Release).cmd | 21 +- Drivers/Intel RST (Previous Releases).cmd | 17 +- Drivers/Intel SSD Toolbox.cmd | 17 +- Drivers/Samsing Magician.cmd | 17 +- Drivers/Samsung NVMe Driver.cmd | 111 - Drivers/Snappy Driver Installer.cmd | 17 +- Enter SafeMode.cmd | 17 +- Exit SafeMode.cmd | 17 +- .../Office/2010/Outlook 2010 (SP2) (x32).cmd | 110 - .../Office/2010/Outlook 2010 (SP2) (x64).cmd | 110 - .../2010/Professional Plus 2010 (SP2).cmd | 110 - .../Office/2010/Publisher 2010 (SP2).cmd | 110 - .../Office/2010/Single Image 2010 (SP2).cmd | 110 - .../2013/Home and Business 2013 (x32).cmd | 17 +- .../2013/Home and Business 2013 (x64).cmd | 17 +- .../2013/Home and Student 2013 (x32).cmd | 17 +- .../2013/Home and Student 2013 (x64).cmd | 17 +- .../Office/2013/Office 365 2013 (x32).cmd | 110 - .../Office/2013/Office 365 2013 (x64).cmd | 110 - .../2016/Home and Business 2016 (x32).cmd | 17 +- .../2016/Home and Business 2016 (x64).cmd | 17 +- .../2016/Home and Student 2016 (x32).cmd | 17 +- .../2016/Home and Student 2016 (x64).cmd | 17 +- .../Office/2016/Office 365 2016 (x32).cmd | 17 +- .../Office/2016/Office 365 2016 (x64).cmd | 17 +- .../2010/QuickBooksPremier2010_R17.cmd | 110 - .../QuickBooks/2010/QuickBooksPro2010_R17.cmd | 110 - .../2011/QuickBooksPremier2011_R14.cmd | 110 - .../QuickBooks/2011/QuickBooksPro2011_R14.cmd | 110 - .../2012/QuickBooksPremier2012_R16.cmd | 110 - .../QuickBooks/2012/QuickBooksPro2012_R16.cmd | 110 - .../2013/QuickBooksPremier2013_R18.cmd | 110 - .../QuickBooks/2013/QuickBooksPro2013_R18.cmd | 110 - .../2014/QuickBooksPremier2014_R15.cmd | 110 - .../QuickBooks/2014/QuickBooksPro2014_R15.cmd | 110 - ...2015_R13.cmd => QuickBooksPremier2015.cmd} | 16 +- ...mier2015_R13.cmd => QuickBooksPro2015.cmd} | 16 +- ...o2016_R9.cmd => QuickBooksPremier2016.cmd} | 16 +- ...emier2016_R9.cmd => QuickBooksPro2016.cmd} | 16 +- ...o2017_R4.cmd => QuickBooksPremier2017.cmd} | 16 +- ...emier2017_R4.cmd => QuickBooksPro2017.cmd} | 16 +- Installers/SW Bundle.cmd | 17 +- Misc/ConEmu (as ADMIN).cmd | 17 +- Misc/ConEmu.cmd | 17 +- Misc/Everything.cmd | 19 +- Misc/MailPasswordView (as ADMIN).cmd | 111 - Misc/MailPasswordView.cmd | 111 - Misc/NK2Edit.cmd | 111 - Misc/Nirsoft Utilities - Outlook.url | 6 + Misc/Nirsoft Utilities - Passwords.url | 6 + Misc/Notepad++.cmd | 17 +- Misc/OutlookAddressBookView (as ADMIN).cmd | 111 - Misc/OutlookAddressBookView.cmd | 111 - Misc/OutlookAttachView (as ADMIN).cmd | 111 - Misc/OutlookAttachView.cmd | 111 - Misc/Sysinternals Suite (Live).url | 5 + Misc/SysinternalsSuite.cmd | 111 - .../TreeSizeFree.cmd | 39 +- Misc/WinDirStat.cmd | 125 - Misc/XMPlay.cmd | 17 +- Repairs/AdwCleaner.cmd | 17 +- Repairs/Autoruns.cmd | 19 +- Repairs/CHKDSK (Fix).cmd | 111 - Repairs/CHKDSK.cmd | 17 +- Repairs/DISM.cmd | 17 +- Repairs/Extras/ESET.cmd | 111 - Repairs/JRT.cmd | 111 - Repairs/KVRT.cmd | 17 +- Repairs/MBAM.cmd | 119 - Repairs/RKill.cmd | 17 +- Repairs/SFC Scan.cmd | 17 +- Repairs/{Extras => }/TDSSKiller.cmd | 17 +- System Checklist.cmd | 17 +- System Diagnostics.cmd | 17 +- Uninstallers/IObit Uninstaller.cmd | 17 +- Uninstallers/Revo Uninstaller.cmd | 111 - User Checklist.cmd | 17 +- 158 files changed, 5713 insertions(+), 8036 deletions(-) create mode 100644 .bin/HWiNFO/general.ini create mode 100644 .bin/SDI/sdi.cfg rename .bin/Scripts/{ => borrowed}/acpi.py (97%) create mode 100644 .bin/Scripts/borrowed/knownpaths-LICENSE.txt create mode 100644 .bin/Scripts/borrowed/knownpaths.py create mode 100644 .bin/Scripts/cbs_fix.py delete mode 100644 .bin/Scripts/check_disk_fix.py delete mode 100644 .bin/Scripts/functions.py create mode 100644 .bin/Scripts/functions/activation.py create mode 100644 .bin/Scripts/functions/browsers.py create mode 100644 .bin/Scripts/functions/build.py create mode 100644 .bin/Scripts/functions/cleanup.py create mode 100644 .bin/Scripts/functions/common.py create mode 100644 .bin/Scripts/functions/data.py create mode 100644 .bin/Scripts/functions/diags.py create mode 100644 .bin/Scripts/functions/info.py rename .bin/Scripts/{ => functions}/partition_uids.py (99%) create mode 100644 .bin/Scripts/functions/product_keys.py create mode 100644 .bin/Scripts/functions/repairs.py create mode 100644 .bin/Scripts/functions/setup.py delete mode 100644 .bin/Scripts/gen_office.bash create mode 100644 .bin/Scripts/settings/main.py create mode 100644 .bin/XYplorerFree/Data/XYplorer.ini delete mode 100644 Data Transfers/Q-Dir (as ADMIN).cmd delete mode 100644 Data Transfers/Q-Dir.cmd rename Diagnostics/Extras/BatteryInfoView.cmd => Data Transfers/XYplorer (as ADMIN).cmd (82%) rename Diagnostics/Extras/HWiNFO (Summary).cmd => Data Transfers/XYplorer.cmd (82%) delete mode 100644 Diagnostics/Extras/Auslogics DiskDefrag.cmd delete mode 100644 Diagnostics/Extras/BIOSCodes.cmd delete mode 100644 Diagnostics/Extras/GpuTest.cmd delete mode 100644 Diagnostics/Extras/HeavyLoad.cmd delete mode 100644 Diagnostics/Extras/HitmanPro (FullBreach).cmd rename Drivers/{ => Extras}/AMD.url (100%) create mode 100644 Drivers/Extras/Device Remover.url delete mode 100644 Drivers/Extras/DeviceRemover.cmd delete mode 100644 Drivers/Extras/Display Driver Uninstaller.cmd rename Misc/Windows 10 Update Assistant.url => Drivers/Extras/Display Driver Uninstaller.url (50%) create mode 100644 Drivers/Extras/Intel Driver & Support Assistant.url rename Drivers/{ => Extras}/NVIDIA.url (100%) create mode 100644 Drivers/Extras/Samsung Tools & Software.url delete mode 100644 Drivers/Intel Driver Update Utility.cmd delete mode 100644 Drivers/Samsung NVMe Driver.cmd delete mode 100644 Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd delete mode 100644 Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd delete mode 100644 Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd delete mode 100644 Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd delete mode 100644 Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd delete mode 100644 Installers/Extras/Office/2013/Office 365 2013 (x32).cmd delete mode 100644 Installers/Extras/Office/2013/Office 365 2013 (x64).cmd delete mode 100644 Installers/Extras/QuickBooks/2010/QuickBooksPremier2010_R17.cmd delete mode 100644 Installers/Extras/QuickBooks/2010/QuickBooksPro2010_R17.cmd delete mode 100644 Installers/Extras/QuickBooks/2011/QuickBooksPremier2011_R14.cmd delete mode 100644 Installers/Extras/QuickBooks/2011/QuickBooksPro2011_R14.cmd delete mode 100644 Installers/Extras/QuickBooks/2012/QuickBooksPremier2012_R16.cmd delete mode 100644 Installers/Extras/QuickBooks/2012/QuickBooksPro2012_R16.cmd delete mode 100644 Installers/Extras/QuickBooks/2013/QuickBooksPremier2013_R18.cmd delete mode 100644 Installers/Extras/QuickBooks/2013/QuickBooksPro2013_R18.cmd delete mode 100644 Installers/Extras/QuickBooks/2014/QuickBooksPremier2014_R15.cmd delete mode 100644 Installers/Extras/QuickBooks/2014/QuickBooksPro2014_R15.cmd rename Installers/Extras/QuickBooks/2015/{QuickBooksPro2015_R13.cmd => QuickBooksPremier2015.cmd} (84%) rename Installers/Extras/QuickBooks/2015/{QuickBooksPremier2015_R13.cmd => QuickBooksPro2015.cmd} (84%) rename Installers/Extras/QuickBooks/2016/{QuickBooksPro2016_R9.cmd => QuickBooksPremier2016.cmd} (84%) rename Installers/Extras/QuickBooks/2016/{QuickBooksPremier2016_R9.cmd => QuickBooksPro2016.cmd} (84%) rename Installers/Extras/QuickBooks/2017/{QuickBooksPro2017_R4.cmd => QuickBooksPremier2017.cmd} (84%) rename Installers/Extras/QuickBooks/2017/{QuickBooksPremier2017_R4.cmd => QuickBooksPro2017.cmd} (84%) delete mode 100644 Misc/MailPasswordView (as ADMIN).cmd delete mode 100644 Misc/MailPasswordView.cmd delete mode 100644 Misc/NK2Edit.cmd create mode 100644 Misc/Nirsoft Utilities - Outlook.url create mode 100644 Misc/Nirsoft Utilities - Passwords.url delete mode 100644 Misc/OutlookAddressBookView (as ADMIN).cmd delete mode 100644 Misc/OutlookAddressBookView.cmd delete mode 100644 Misc/OutlookAttachView (as ADMIN).cmd delete mode 100644 Misc/OutlookAttachView.cmd create mode 100644 Misc/Sysinternals Suite (Live).url delete mode 100644 Misc/SysinternalsSuite.cmd rename Repairs/Extras/Complete Internet Repair.cmd => Misc/TreeSizeFree.cmd (83%) delete mode 100644 Misc/WinDirStat.cmd delete mode 100644 Repairs/CHKDSK (Fix).cmd delete mode 100644 Repairs/Extras/ESET.cmd delete mode 100644 Repairs/JRT.cmd delete mode 100644 Repairs/MBAM.cmd rename Repairs/{Extras => }/TDSSKiller.cmd (86%) delete mode 100644 Uninstallers/Revo Uninstaller.cmd diff --git a/.bin/HWiNFO/general.ini b/.bin/HWiNFO/general.ini new file mode 100644 index 00000000..a77fb596 --- /dev/null +++ b/.bin/HWiNFO/general.ini @@ -0,0 +1,664 @@ +[Benchmark_CPU] +Intel Pentium-100=707 +Intel Pentium-120/Notebook=835 +Intel Pentium-166/QDI=1380 +Cyrix 6x86MX-PR300=1411 +AMD-K6-166/QDI=1482 +Intel Pentium MMX-200=1484 +Cyrix MII-PR333=1518 +Intel Mobile Pentium MMX-233=1642 +Intel Pentium Pro-166 Dual CPU=1679 +AMD-K6-200/DTK=1777 +AMD-K6-200/QDI=1778 +Intel Pentium Pro-200=1944 +AMD-K6-233/DTK=2067 +Intel P2-233/Siemens=2350 +VIA Cyrix III 533/133=2362 +Intel Celeron-266/BXmaster=2586 +Intel P2-266/Siemens=2603 +AMD-K6-2-300/PCChips M577=2655 +Intel Celeron 300=2883 +Intel Celeron-300/PCChips=2922 +AMD-K6-2-350/FIC=3092 +AMD-K6-III-400=3524 +AMD-K6-III-400/FIC VA-503A=3557 +Intel Celeron-366/BXmaster=3718 +Intel P2-400/Siemens=3886 +Intel Celeron-400/BXmaster=3890 +AMD-K6-2-450/FIC=3964 +AMD-K6-III-448/FIC VA-503A=3975 +AMD-K6-III-450=3978 +Intel Mobile P2-400/Scenic=4047 +Intel Celeron-413/BXmaster=4175 +Intel Celeron-433=4219 +Intel P3-450/CC820=4363 +Intel P3-450/Siemens=4372 +Intel Celeron-450=4555 +Intel Celeron-300A@467=4686 +Intel Celeron-466/BXmaster=4789 +Intel P3-500/GA-6BXDS=5021 +Intel Pentium III Xeon-550=5299 +Intel Celeron-525/BXmaster=5314 +Intel P3-550/Siemens=5543 +Intel Celeron-550/BXmaster=5579 +Intel Celeron-575/BXmaster=5845 +Intel Celeron-616/BXmaster=5999 +Intel P3-617/GA-BX2000=6241 +AMD Athlon-600/AMD-750=6303 +AMD Duron-600/KT133=6436 +Intel P3-650/BX=6497 +AMD Athlon-650/KX133=6749 +AMD Duron-650/KT133=6971 +Intel P3-700/BX=7013 +AMD Athlon-700/KX133=7185 +AMD Duron-700/KT133=7507 +Intel Celeron-815/BXmaster=7985 +AMD Athlon-750/KT133=8085 +AMD Athlon-800/AMD-750=8286 +AMD Duron-800/KT133=8580 +Intel P3-650@870/BX=8675 +AMD Duron-850/KT133=9120 +Intel P3-650@917/BX=9175 +AMD Duron-900/KT133=9654 +AMD Duron-928 (9x103)=9952 +Intel Celeron-566@1010=10115 +VIA Antaur-1000=6108 +VIA C3-1333=7601 +AMD Duron-950/KT133=10190 +AMD Athlon-1000/KT133=10734 +AMD Athlon-1200/KT133=12949 +AMD Athlon XP 1500+/KT133=14297 +AMD Athlon XP 2000+/KT133A=17691 +AMD Athlon XP 2200+/KT133A=19490 +AMD Athlon XP-M 2500+/KM400=19590 +AMD Athlon XP-M 3000+/SiS748=23391 +Intel P3-1000/i815=10381 +Intel P4-1600=6636 +Intel P4-1800=7445 +Intel P4-2000=8272 +Intel P4-2500=11051 +Intel Pentium-M ULV-1000=10515 +Intel Pentium-M-1300=13590 +Intel Pentium-M-1600=16856 +Intel Pentium-M 735=16958 +Intel Pentium-M 755=20008 +Intel Pentium-M 770=21163 +Intel P4-2800(noHT)/i875P=12399 +Intel P4-3066(noHT)/i845PE=13479 +Intel P4-3000E(noHT)/i915P=22136 +Intel P4-3000 530 (HT)=34013 +Intel P4-3200E(noHT)/i875P=23446 +Intel P4-3600E(noHT)/i925X=26424 +Intel Xeon-3800(HT)=55028 +AMD Athlon64 3200+=23814 +AMD Athlon64 3800+=28731 +AMD Athlon64 FX-53=28727 +AMD Opteron 248=25920 +AMD Turion64 ML-34+=18520 +AMD Turion64 X2 TL-60=47697 +AMD Athlon 64 X2 4400+=52867 +Intel Core Duo T2600 (1core)=20293 +Intel Core Duo T2600 (2core)=40849 +Intel Core 2 Duo E6700=51765 +Intel Core 2 Duo T7400=53238 +Transmeta Crusoe TM5800-1000=6382 +2xIntel Xeon 5150/5000P=131832 +4xIntel Xeon MP 7040=180052 +Intel Core 2 Extreme QX6700=129908 +AMD Phenom 9500=103687 +Intel Atom 230=15438 +Intel Core i5-520M=94834 +Intel Core i7-860=180329 +Intel Core i7-820QM=123279 +Intel Core i7-980X=347501 +Intel Core i5-2520M=111448 +Intel Core i7-3820=265424 + +[Benchmark_FPU] +Intel Pentium-100=1109 +VIA Cyrix III 533/133=1327 +Intel Pentium 120/Notebook=1350 +Intel Pentium Pro-166 Dual CPU=1663 +Intel Pentium Pro-200=1934 +Cyrix 6x86MX-PR300=2304 +Intel P2-233/Siemens=2323 +AMD-K6-166/QDI=2533 +Cyrix MII-PR333=2585 +Intel Celeron-266/BXmaster=2630 +Intel Mobile Pentium MMX-233=2647 +Intel P2-266/Siemens=2662 +Intel Celeron-300=2862 +AMD-K6-200/DTK=2999 +AMD-K6-200/QDI=3041 +AMD-K6-233/DTK=3492 +Intel Celeron-366/BXmaster=3650 +Intel P2-400/Siemens=3968 +Intel Celeron-400/BXmaster=3972 +Intel Mobile P2-400/Scenic=3973 +Intel Celeron-413/BXmaster=4097 +Intel Celeron-433=4304 +Intel P3-450/CC820=4444 +Intel P3-450/Siemens=4452 +Intel Celeron-450=4472 +Intel Celeron-300A@467=4599 +AMD-K6-2-300/PCChips M577=4605 +Intel Celeron-466/BXmaster=4628 +Intel P3-500/GA-6BXDS=4958 +Intel Celeron-525/BXmaster=5215 +AMD-K6-2-350/FIC=5368 +Intel Pentium III Xeon-550=5417 +Intel P3-550/Siemens=5440 +Intel Celeron-550/BXmaster=5477 +Intel Celeron-575/BXmaster=5738 +Intel Celeron-616/BXmaster=5897 +Intel P3-617/GA-BX2000=6114 +AMD-K6-III-400/FIC VA-503A=6166 +AMD-K6-III-400=6169 +Intel P3-650/BX=6446 +AMD-K6-2-450/FIC=6876 +AMD-K6-III-448/FIC VA-503A=6893 +AMD-K6-III-450=6895 +Intel P3-700/BX=6942 +Intel Celeron-815/BXmaster=7799 +Intel P3-650@870/BX=8614 +Intel P3-650@917/BX=9080 +VIA C3-1333=3160 +AMD Duron-600/KT133=9132 +AMD Athlon-600/AMD-750=9231 +AMD Athlon-650/KX133=9888 +Intel Celeron-566@1010=9977 +AMD Athlon-700/KX133=10527 +AMD Athlon-750/KT133=11457 +AMD Athlon-800/AMD-750=12149 +AMD Duron-850/KT133=12954 +AMD Duron-900/KT133=13712 +AMD Duron-928 (9x103)=14150 +AMD Duron-950/KT133=14479 +AMD Athlon-1000/KT133=15252 +AMD Athlon-1200/KT133=18378 +AMD Athlon XP 1500+/KT133=20757 +AMD Athlon XP 1800+=23375 +AMD Athlon XP 2000+/KT133A=25693 +AMD Athlon XP 2200+/KT133A=28296 +AMD Athlon XP-M 2500+/KM400=28877 +AMD Athlon XP-M 3000+/SiS748=34104 +Intel P3-1000/i815=9813 +Intel P4-1600=3282 +Intel P4-1800=3833 +Intel P4-2000=4256 +Intel P4-2500=6020 +Intel Pentium-M ULV-1000=8547 +Intel Pentium-M-1300=11089 +Intel Pentium-M-1600=13614 +Intel Pentium-M 735=14211 +Intel Pentium-M 755=16772 +Intel Pentium-M 770=17807 +Intel P4-2800(noHT)/i875P=6799 +Intel P4-3066(noHT)/i845PE=7396 +Intel P4-3000 530 (HT)=9220 +Intel P4-3200E(noHT)/i875P=6578 +Intel P4-3600E(noHT)/i925X=8163 +Intel Xeon-3800(HT)=17241 +AMD Athlon64 3200+=31194 +AMD Athlon64 3800+=37379 +AMD Athlon64 FX-53=37426 +AMD Opteron 248=34115 +AMD Turion64 ML-34+=28056 +AMD Turion64 X2 TL-60=62143 +AMD Athlon 64 X2 4400+=68974 +Intel Core Duo T2600 (1core)=16967 +Intel Core Duo T2600 (2core)=34039 +Intel Core 2 Duo E6600=36031 +Intel Core 2 Duo E6700=40075 +Intel Core 2 Duo T7400=32659 +Transmeta Crusoe TM5800-1000=4251 +2xIntel Xeon 5150/5000P=80725 +4xIntel Xeon MP 7040=54379 +Intel Core 2 Extreme QX6700=80338 +AMD Phenom 9500=133430 +Intel Atom 230=10769 +Intel Core i5-520M=60634 +Intel Core i7-860=131820 +Intel Core i7-820QM=90751 +Intel Core i7-980X=215620 +Intel Core i5-2520M=55354 +Intel Core i7-3820=130252 + +[Benchmark_MMX] +AMD-K6-166/QDI=909 +AMD-K6-200/QDI=1070 +Intel P2-266/440LX=1339 +VIA Cyrix III 533/133=1815 +Intel Pentium MMX-200=2041 +Intel Mobile Pentium MMX-233=2363 +Intel P2-233/440BX=2390 +Intel Celeron-300=2931 +Intel Celeron-366=3742 +Intel Celeron-450=4602 +Intel Celeron-300A@467=4737 +Intel P3-500/GA-6BXDS=5009 +AMD Duron-600/KT133=5454 +Intel P3-550/Siemens=5513 +AMD Athlon-650/KX133=5906 +AMD Athlon-700/Abit KA7=6356 +Intel P3-650/BX=6490 +AMD Duron-750/KT133=6823 +AMD Athlon-750/KT133=6846 +Intel P3-700/BX=7025 +AMD Duron-800/KT133=7277 +AMD Duron-850/KT133=7738 +AMD Duron-900/KT133=8192 +AMD Duron-928 (9x103)=8448 +AMD Duron-950/KT133=8645 +Intel P3-650@870/BX=8706 +AMD Athlon-1000/KT133=9110 +Intel P3-650@917/BX=9173 +Intel Celeron-566@1010=10080 +VIA C3-1333=6063 +AMD Athlon-1200/KT133=10998 +AMD Athlon XP 1500+/KT133=12125 +AMD Athlon XP 1800+=13642 +AMD Athlon XP 2000+/KT133A=15013 +AMD Athlon XP 2200+/KT133A=16516 +AMD Athlon XP-M 2500+/KM400=16858 +AMD Athlon XP-M 3000+/SiS748=20040 +Intel P3-1000=9903 +Intel P4-1600=14468 +Intel P4-1800=16319 +Intel P4-2000=18140 +Intel P4-2500=22681 +Intel Pentium-M ULV-1000=9937 +Intel Pentium-M-1300=12865 +Intel Pentium-M-1600=15835 +Intel Pentium-M 735=16839 +Intel Pentium-M 755=19869 +Intel Pentium-M 770=21149 +Intel P4-2800(noHT)/i875P=24478 +Intel P4-3066(noHT)/i845PE=26437 +Intel P4-3000 530 (HT)=27352 +Intel P4-3200E(noHT)/i875P=22592 +Intel P4-3600E(noHT)/i925X=25314 +Intel Xeon-3800(HT)=53268 +AMD Athlon64 3200+=18228 +AMD Athlon64 3800+=21859 +AMD Athlon64 FX-53=21856 +AMD Opteron 248=19926 +AMD Turion64 ML-34+=16403 +AMD Turion64 X2 TL-60=36363 +AMD Athlon 64 X2 4400+=40282 +Intel Core Duo T2600 (1core)=21423 +Intel Core Duo T2600 (2core)=42912 +Intel Core 2 Duo E6600=74154 +Intel Core 2 Duo E6700=82312 +Intel Core 2 Duo T7400=67321 +Transmeta Crusoe TM5800-1000=5272 +2xIntel Xeon 5150/5000P=51186 +4xIntel Xeon MP 7040=83086 +Intel Core 2 Extreme QX6700=165067 +AMD Phenom 9500=80202 +Intel Atom 230=14545 +Intel Core i5-520M=80822 +Intel Core i7-860=171336 +Intel Core i7-820QM=115063 +Intel Core i7-980X=261051 +Intel Core i5-2520M=81444 +Intel Core i7-3820=160178 + +[Benchmark_Memory] +Intel Pentium-100/FPM=69 +Intel Pentium Pro-166 Dual CPU=78 +AMD-K6-166/QDI/EDO=85 +Intel Pentium MMX-200/EDO=92 +AMD-K6-200/QDI/EDO=93 +Intel Pentium MMX-233/PC66=101 +Intel P2-233/440BX/PC66=111 +VIA Cyrix III 533/133=114 +Intel P2-266/440BX/PC66=117 +AMD-K6-III-400=135 +Intel Celeron-366/PC66=163 +AMD Duron-600/KT133=173 +AMD Athlon-700/KX133/PC133=202 +AMD Athlon-650/KX133=205 +Intel P3-500/GA-6BXDS/PC100=209 +Intel P3-550/Siemens/PC100=215 +Intel Celeron-300A@467/PC66=209 +Intel Celeron-300/PC66=146 +Intel P3-650/BX/PC100=238 +Intel P3-700/BX/PC100=211 +AMD Athlon-750/KT133/PC133=214 +AMD Duron-750/KT133=263 +Intel Celeron-566@1010=273 +VIA C3-1333/CN400=223 +AMD Duron-950/KT133=275 +AMD Duron-928 (9x103)/KT133=292 +AMD Duron-1100/SiS745/DDR333=477 +AMD Athlon XP-M 2500+/DDR333=548 +Intel P3-650@917/FSB140=310 +Intel P3-1000/PC133=218 +Intel P4-1600/i850=1115 +Intel P4-2000/i850/PC800=1245 +Intel P4-1800/i845G/DDR266=867 +Intel P4-2500/i845/DDR266=757 +Intel Pentium-M-1600/DDR266=830 +Intel Pentium-M 735/855PM/DDR400=971 +Intel P4-3066/i845PE/DDR266=1028 +Intel P4-2800/i875P/2Ch/DDR400=2056 +Intel P4-3200E/i875P/2Ch/DDR400=2342 +Intel P4-3600E/i915P/DDR2-533=2556 +Intel P4-3600E/i925X/DDR2-533=2844 +Intel Xeon-3800/E7525/DDR2-400=1635 +AMD Athlon64 3200+/1Ch/DDR400=1266 +AMD Athlon64 3800+/2Ch/DDR400=2375 +AMD Athlon64 FX-53/2Ch/DDR400=2166 +AMD Opteron 248/DDR266=947 +AMD Turion64 ML-34+=1071 +Intel Core 2 Duo E6700/DDR2-800=2894 +Transmeta Crusoe TM5800-1000=337 +2xIntel Xeon 5150/5000P/DDR2-667F=2919 +4xIntel Xeon MP 7040=1721 +AMD Phenom 9500=1795 +Intel Atom 230/945/DDR2-800=1682 +Intel Core i5-520M=5235 +Intel Core i7-860/DDR3-667/2CH=6506 +Intel Core i7-820QM=5424 +Intel Core i7-980X=9343 +Intel Core i7-3820/DDR3-1600/4CH=13366 + +[Benchmark_Disk_ReadBurst] +Fujitsu MPB3043ATU E/PIO=4.03 +Seagate ST38410A/PIO=4.33 +Maxtor 91021U2/PIO=4.61 +Maxtor 92041U4/PIO=4.82 +Quantum Fireball_TM2110S300X=6.83 +SEAGATE ST51080N=7.92 +Seagate ST31277A=8,37 +IBM DCAS-32160 S65A=8.65 +QUANTUM FIREBALL ST3.2A/PIO=14.74 +Seagate ST39102LW Cheetah=30.05 +IBM DJNA-370910/UDMA66=15.27 +Seagate ST34321A/UDMA33=21.03 +Seagate ST38421A=23.82 +Seagate ST34310A=23.88 +QUANTUM FIREBALL SE2.1A=26.43 +Maxtor 91021U2/UDMA33=29.13 +Maxtor 54098U8/UDMA33=29.5 +IBM DTTA-350430=29.7 +IBM-DPTA-371360=29.86 +Seagate ST320420A=47.3 +IBM-DJNA-371350=27.87 +IBM-DTLA-307030/ATA100=82.22 +SEAGATE Cheetah X15/RAID=137.08 +IBM Deskstar 60GXP/ATA100=81.98 +MAXTOR 4K020H1/ATA100=84.58 +Seagate ST317221A/UDMA66=42.03 +Maxtor 6E040L0=79.36 +Seagate ST380021A/ATA100=73.11 +HITACHI DK23EA-40=80.04 +WDC WD800JB/ATA100=85.71 +TOSHIBA MK4019GAX=83.60 +Maxtor MaxLine III SATA+NCQ=119.96 +ST312002 6AS=106.61 +Maxtor Atlas 10K5 73SCA=145.86 +WDC WD3200YS-01PGB0=167.33 +Hitachi HTE726040M9AT00=84.61 +Seagate ST3160827AS=120.88 +WDC WD5000AADS-00S9B0=122.87 +Hitachi HTS545032B9A=161.10 +Seagate ST1000DM003-9YN1=282.43 + +[Benchmark_Disk_ReadRandom] +Hitachi HTE726040M9AT00=22.82 +Maxtor Atlas 10K5 73SCA=31.61 +Seagate ST3160827AS=32.26 +FUJITSU MHV2080BH=17.79 +TOSHIBA MK8034GSX=18.12 +ST916082 1AS=22.27 +WDC WD5000AADS-00S9B0=24.58 +Hitachi HTS545032B9A=24.72 +Seagate ST1000DM003-9YN1=37.09 + +[Benchmark_Disk_RandomAccess] +SEAGATE ST51080N=20.96 +Quantum Fireball_TM2110S300X=20.74 +Seagate ST34321A/UDMA33=17.21 +Seagate ST38410A/PIO=17.17 +Seagate ST31277A=16.75 +Fujitsu MPB3043ATU E=16.18 +IBM DTTA-350430=16.5 +IBM DCAS-32160 S65A=15.95 +Maxtor 92041U4/PIO=15.81 +Seagate ST34310A=15.56 +Maxtor 91021U2/PIO=15.66 +Seagate ST38421A=15.71 +QUANTUM FIREBALL ST3.2A=15.50 +QUANTUM FIREBALL SE2.1A=14.94 +Maxtor 54098U8/UDMA33=13.77 +Seagate ST320420A=12.57 +IBM DJNA-370910/UDMA66=12.10 +Seagate ST39102LW Cheetah=8.78 +IBM-DPTA-371360=13.37 +IBM-DJNA-371350=13.38 +IBM-DTLA-307030/ATA100=12.44 +IBM-DTLA-307030/ATA100+AAM=22.34 +SEAGATE Cheetah X15/RAID=5.65 +IBM Deskstar 60GXP=12.70 +MAXTOR 4K020H1/ATA100=19.12 +Seagate ST317221A/UDMA66=16.60 +Maxtor 6E040L0=14.52 +Seagate ST380021A/ATA100=14.58 +HITACHI DK23EA-40=19.40 +WDC WD800JB/ATA100=13.61 +TOSHIBA MK4019GAX=18.61 +Maxtor MaxLine III SATA+NCQ=15.82 +ST312002 6AS=12.51 +Maxtor Atlas 10K5 73SCA=10.16 +WDC WD3200YS-01PGB0=13.16 +Hitachi HTE726040M9AT00=12.90 +Seagate ST3160827AS=11.65 +Seagate ST380215A=14.82 +WDC WD5000AADS-00S9B0=17.37 +Hitachi HTS545032B9A=22.16 +Seagate ST1000DM003-9YN1=15.53 + +[LogfileSettings] +COMP=1 +COMP_SP=1 +COMP_Name=1 +COMP_Os=1 +COMP_User=0 +CPU=1 +CPU_Name=1 +CPU_ID=1 +CPU_Vendor=1 +CPU_Stepping=1 +CPU_Type=1 +CPU_BrandID=1 +CPU_PN=1 +CPU_Clock=1 +CPU_MaxFreq=1 +CPU_CacheL1=1 +CPU_CacheL2=1 +CPU_TLB_I=1 +CPU_TLB_D=1 +CPU_Features=1 +CPU_PIROM=1 +MEM=1 +MEM_TotalSize=1 +MEM_Timing=1 +MEM_Row=1 +MEM_Row_Size=1 +MEM_Row_Type=1 +MEM_Row_Speed=1 +MEM_Row_Model=1 +MEM_Row_ECC=1 +MEM_Row_Date=1 +MEM_Row_SN=1 +MEM_Row_Cfg=1 +MEM_Row_Latency=1 +MEM_Row_Features=1 +MEM_Row_iFeatures=1 +BUS=1 +BUS_PCI=1 +BUS_PCI_DevName=1 +BUS_PCI_DevNumber=1 +BUS_PCI_Resources=1 +BUS_PCI_Features=1 +BUS_PCI_DevSpecific=1 +BUS_PCIX_Features=1 +BUS_PCIe_Features=1 +BUS_PCI_DRV_INFO=1 +BUS_EISA=1 +DMI=1 +DMI_0=1 +DMI_1=1 +DMI_2=1 +DMI_3=1 +DMI_4=1 +DMI_5=1 +DMI_6=1 +DMI_7=1 +DMI_8=1 +DMI_9=1 +DMI_10=1 +DMI_11=1 +DMI_12=1 +DMI_13=1 +DMI_14=1 +DMI_15=1 +DMI_16=1 +DMI_17=1 +DMI_18=1 +DMI_19=1 +DMI_20=1 +DMI_21=1 +DMI_22=1 +DMI_23=1 +DMI_24=1 +DMI_25=1 +DMI_26=1 +DMI_27=1 +DMI_28=1 +DMI_29=1 +DMI_30=1 +DMI_31=1 +DMI_32=1 +DMI_33=1 +DMI_34=1 +DMI_35=1 +DMI_36=1 +DMI_37=1 +DMI_38=1 +DMI_39=1 +DMI_129=1 +DMI_130=1 +DMI_131=1 +VIDEO=1 +VIDEO_Chipset=1 +VIDEO_Memory=1 +VIDEO_Card=1 +VIDEO_Bus=1 +VIDEO_RAMDAC=1 +VIDEO_BIOSver=1 +VIDEO_Clock=1 +VIDEO_HWID=1 +VIDEO_DRV_INFO=1 +VIDEO_DirectX=1 +MON=1 +MON_Name=1 +MON_SN=1 +MON_Date=1 +MON_Dimensions=1 +MON_DisplayType=1 +MON_InputSignal=1 +MON_Gamma=1 +MON_DPMSinput=1 +MON_DPMSmodes=1 +MOBO=1 +MOBO_Model=1 +MOBO_Chipset=1 +MOBO_CompName=1 +MOBO_MachineType=1 +MOBO_Slots=1 +MOBO_BIOS_Manuf=1 +MOBO_BIOS_Date=1 +MOBO_PNP_Devs=1 +MOBO_PNP_Nodes=1 +MOBO_ACPI_Devs=1 +MOBO_ACPI_Enum=1 +DRIVE=1 +DRIVE_IDE=1 +DRIVE_IDE_Ctrller=1 +DRIVE_IDE_Channel=1 +DRIVE_IDE_Model=1 +DRIVE_IDE_Rev=1 +DRIVE_IDE_SN=1 +DRIVE_IDE_Capacity=1 +DRIVE_IDE_Geometry=1 +DRIVE_IDE_Cache=1 +DRIVE_IDE_Xfer=1 +DRIVE_IDE_BasicCapab=1 +DRIVE_IDE_ATA2Capab=1 +DRIVE_IDE_SMART=1 +DRIVE_SCSI=1 +DRIVE_SCSI_ID=1 +DRIVE_SCSI_Desc=1 +DRIVE_SCSI_Class=1 +DRIVE_Floppy=1 +NETWORK=1 +NETWORK_HWID=1 +NETWORK_DRV_INFO=1 +AUDIO=1 +AUDIO_DRV_INFO=1 +AUDIO_HWID=1 +PORTS=1 +BUS_USB=1 +BUS_USB_DRV_INFO=1 +BATTERY=1 +SENSORS=1 + +[Settings] +AC97CodecID=1 +AcpiEnum=0 +AcpiEval=1 +AutoUpdate=0 +AutoUpdateBetaDisable=1 +BusClkPolling=1 +CpuClkFromBusClk=1 +DebugMode=0 +DefReportType=5 +EC=1 +FlushBuffers=1 +GPUI2C=1 +GPUI2CADL=0 +GPUI2CBusExclude=00000000 +GPUI2CNVAPI=1 +GPUI2Ccaching=1 +HighestIdeAddress=0 +IoctlKernel=0 +KeepTheme=0 +LargeFonts=0 +MinimalizeMainWnd=0 +MinimalizeSensors=0 +OpenSensors=0 +OpenSystemSummary=0 +PCIdirect=1 +PersistentDriver=0 +RememberPreferences=1 +SMBus=1 +SMBusAdrExclude=11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000 +SWSMI=1 +SensorsSM=1 +ShowWelcomeAndProgress=0 +SkipProblematicPciDev=0 +TPM=0 +TempScale=C +UseHPET=1 +WakeGPUs=1 +iMEsupport=1 +MinimizeGraphs=1 +SensorRowShading=1 +SensorsTopmost=0 +DecimalSeparator=. +ThousandsSeparator=, +CsvSeparator=, +TextButtons=0 diff --git a/.bin/SDI/sdi.cfg b/.bin/SDI/sdi.cfg new file mode 100644 index 00000000..471c83d1 --- /dev/null +++ b/.bin/SDI/sdi.cfg @@ -0,0 +1,23 @@ +"-drp_dir:drivers" +"-index_dir:indexes\SDI" +"-output_dir:indexes\SDI\txt" +"-data_dir:tools\SDI" +"-log_dir:logs" + +"-finish_cmd:" +"-finishrb_cmd:" +"-finish_upd_cmd:" + +"-lang:English" +"-theme:YetAnotherSDI" +-hintdelay:250 +-license:1 +-scale:256 +-filters:166 + +-port:50171 +-downlimit:1 +-uplimit:1 +-connections:0 + +-expertmode -norestorepnt -novirusalerts -showdrpnames2 -onlyupdates -preservecfg \ No newline at end of file diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 8725613b..5ef9d0f6 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -18,9 +18,16 @@ call :DeQuote L_PATH call :DeQuote L_TYPE :SetVariables -set "ARCHIVE_PASS=Abracadabra" -set "OFFICE_SERVER=10.0.0.10" -set "QUICKBOOKS_SERVER=10.0.0.10" +rem Set variables using settings\main.py file +set "SETTINGS=%bin%\Scripts\settings\main.py" +for %%v in (ARCHIVE_PASSWORD KIT_NAME_FULL OFFICE_SERVER_IP QUICKBOOKS_SERVER_IP) do ( + set "var=%%v" + for /f "tokens=* usebackq" %%f in (`findstr "!var!=" %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "%%v=!_v:~0,-1!" + ) +) rem Set ARCH to 32 as a gross assumption and check for x86_64 status set ARCH=32 if /i "%PROCESSOR_ARCHITECTURE%" == "AMD64" set "ARCH=64" @@ -35,6 +42,17 @@ if %ARCH% equ 64 ( set "PYTHON=%bin%\Python\x64\python.exe" ) +:UpdateTitle +rem Sets title using KIT_NAME_FULL from settings\main.py (unless %window_title% already set) +if defined window_title ( + title %window_title% +) else ( + set "window_title=%*" + if not defined window_title set "window_title=Launcher" + set "window_title=%KIT_NAME_FULL%: %window_title%" + title %window_title% +) + :CheckUsage rem Check for empty passed variables if not defined L_TYPE (goto Usage) @@ -96,64 +114,35 @@ goto Exit :LaunchOfficeSetup rem set args and copy setup files to system -rem NOTE: init_client_dir.cmd sets %client_dir% and creates %SystemDrive%\WK\Office folder +rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\Office folder call "%bin%\Scripts\init_client_dir.cmd" /Office echo Copying setup file(s) for %L_ITEM%... -rem NOTE: If L_PATH == "2013" or "2016" extract the ODT setup/xml, otherwise copy from OFFICE_SERVER -set "_odt=False" -if %L_PATH% equ 2013 (set "_odt=True") -if %L_PATH% equ 2016 (set "_odt=True") -if "%_odt%" == "True" ( - rem extract setup/xml and start installation - set "source=%L_PATH%\setup.exe" - set "dest=%client_dir%\Office\%L_PATH%" - "%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASS% -o"!dest!" !source! !L_ITEM! || exit /b 1 - "%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul - if not exist "!dest!\setup.exe" (goto ErrorOfficeSourceNotFound) - if not exist "!dest!\!L_ITEM!" (goto ErrorOfficeSourceNotFound) - pushd "!dest!" - rem # The line below jumps to ErrorUnknown even though setup.exe is run correctly?? - rem start "" "setup.exe" /configure !L_ITEM! || popd & goto ErrorUnknown - rem # Going to assume it extracted correctly and blindly start setup.exe - start "" "setup.exe" /configure !L_ITEM! - popd -) else ( - rem copy setup files from OFFICE_SERVER - set "fastcopy_args=/cmd=diff /no_ui /auto_close" - set "product=%L_PATH%\%L_ITEM%" - set "product_name=%L_ITEM%" - call :GetBasename product_name || goto ErrorBasename - set "source=\\%OFFICE_SERVER%\Office\!product!" - set "dest=%client_dir%\Office" - rem Verify source - if not exist "!source!" (goto ErrorOfficeSourceNotFound) - rem Copy setup file(s) to system - start "" /wait "%FASTCOPY%" !fastcopy_args! "!source!" /to="!dest!\" - rem Run setup - if exist "!dest!\!product_name!\setup.exe" ( - start "" "!dest!\!product_name!\setup.exe" || goto ErrorUnknown - ) else if "!product_name:~-3,3!" == "exe" ( - start "" "!dest!\!product_name!" || goto ErrorUnknown - ) else if "!product_name:~-3,3!" == "msi" ( - start "" "!dest!\!product_name!" || goto ErrorUnknown - ) else ( - rem Office source not supported by this script - goto ErrorOfficeUnsupported - ) -) +rem extract setup/xml and start installation +set "setup=%L_PATH%\setup.exe" +set "dest=%client_dir%\Office\%L_PATH%" +"%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"!dest!" !setup! !L_ITEM! || exit /b 1 +"%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul +if not exist "!dest!\setup.exe" (goto ErrorOfficeSourceNotFound) +if not exist "!dest!\!L_ITEM!" (goto ErrorOfficeSourceNotFound) +pushd "!dest!" +rem # The line below jumps to ErrorUnknown even though setup.exe is run correctly?? +rem start "" "setup.exe" /configure !L_ITEM! || popd & goto ErrorUnknown +rem # Going to assume it extracted correctly and blindly start setup.exe +start "" "setup.exe" /configure !L_ITEM! +popd goto Exit :LaunchQuickBooksSetup rem set args and copy setup files to system -rem NOTE: init_client_dir.cmd sets %client_dir% and creates %SystemDrive%\WK\QuickBooks folder +rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\QuickBooks folder call "%bin%\Scripts\init_client_dir.cmd" /QuickBooks echo Copying setup file(s) for %L_ITEM%... -rem copy setup files from QUICKBOOKS_SERVER +rem copy setup files from QUICKBOOKS_SERVER_IP set "fastcopy_args=/cmd=diff /no_ui /auto_close" set "product=%L_PATH%\%L_ITEM%" set "product_name=%L_ITEM%" call :GetBasename product_name || goto ErrorBasename -set "source=\\%QUICKBOOKS_SERVER%\QuickBooks\!product!" +set "source=\\%QUICKBOOKS_SERVER_IP%\QuickBooks\!product!" set "dest=%client_dir%\QuickBooks" rem Verify source if not exist "!source!" (goto ErrorQuickBooksSourceNotFound) @@ -276,9 +265,9 @@ for /f "delims=" %%a in ('echo %%%1%%') do set %1=%%~a rem Extract %cbin% archive into %bin% echo Extracting "%L_ITEM%"... if exist "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" ( - "%SEVEN_ZIP%" x "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASS% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 + "%SEVEN_ZIP%" x "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 ) else ( - "%SEVEN_ZIP%" x "%cbin%\%L_PATH%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASS% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 + "%SEVEN_ZIP%" x "%cbin%\%L_PATH%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 ) ping.exe -n 2 127.0.0.1>nul exit /b 0 diff --git a/.bin/Scripts/Launcher_Template.cmd b/.bin/Scripts/Launcher_Template.cmd index 03f27bb1..552382db 100644 --- a/.bin/Scripts/Launcher_Template.cmd +++ b/.bin/Scripts/Launcher_Template.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/.bin/Scripts/_Update Kit.cmd b/.bin/Scripts/_Update Kit.cmd index 8d9c8c1c..5d7e71d5 100644 --- a/.bin/Scripts/_Update Kit.cmd +++ b/.bin/Scripts/_Update Kit.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. @@ -108,4 +123,4 @@ goto Exit :: Cleanup and exit :: :Exit endlocal -exit /b %errorlevel% \ No newline at end of file +exit /b %errorlevel% diff --git a/.bin/Scripts/activate.py b/.bin/Scripts/activate.py index c7bdb663..29dac590 100644 --- a/.bin/Scripts/activate.py +++ b/.bin/Scripts/activate.py @@ -1,23 +1,20 @@ # Wizard Kit: Activate Windows using various methods import os -import re import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: Windows Activation Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.activation import * +from functions.common import * init_global_vars() - -def abort(): - print_warning('Aborted.') - exit_script() +os.system('title {}: Windows Activation Tool'.format(KIT_NAME_FULL)) def activate_with_bios(): """Attempt to activate Windows with a key stored in the BIOS.""" - try_and_print(message='BIOS Activation:', function=activate_windows_with_bios, other_results=other_results) + try_and_print(message='BIOS Activation:', + function=activate_windows_with_bios, other_results=other_results) if __name__ == '__main__': try: @@ -25,13 +22,14 @@ if __name__ == '__main__': # Bail early if already activated if windows_is_activated(): print_info('This system is already activated') + sleep(5) exit_script() # Determine activation method activation_methods = [ {'Name': 'Activate with BIOS key', 'Function': activate_with_bios}, ] - if not re.match(r'^(8|10)$', global_vars['OS']['Version']): + if global_vars['OS']['Version'] not in ['8', '10']: activation_methods[0]['Disabled'] = True actions = [ {'Name': 'Quit', 'Letter': 'Q'}, @@ -39,7 +37,9 @@ if __name__ == '__main__': # Main loop while True: - selection = menu_select('Wizard Kit: Windows Activation Menu', activation_methods, actions) + selection = menu_select( + '{}: Windows Activation Menu'.format(KIT_NAME_FULL), + activation_methods, actions) if (selection.isnumeric()): activation_methods[int(selection)-1]['Function']() diff --git a/.bin/Scripts/acpi.py b/.bin/Scripts/borrowed/acpi.py similarity index 97% rename from .bin/Scripts/acpi.py rename to .bin/Scripts/borrowed/acpi.py index d9ccf321..bb109caf 100644 --- a/.bin/Scripts/acpi.py +++ b/.bin/Scripts/borrowed/acpi.py @@ -1,5 +1,7 @@ import sys +# Code borrowed from https://github.com/aeruder/get_win8key + if sys.platform.startswith('win32'): import ctypes import ctypes.wintypes diff --git a/.bin/Scripts/borrowed/knownpaths-LICENSE.txt b/.bin/Scripts/borrowed/knownpaths-LICENSE.txt new file mode 100644 index 00000000..19673bd6 --- /dev/null +++ b/.bin/Scripts/borrowed/knownpaths-LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Michael Kropat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/.bin/Scripts/borrowed/knownpaths.py b/.bin/Scripts/borrowed/knownpaths.py new file mode 100644 index 00000000..96b1a009 --- /dev/null +++ b/.bin/Scripts/borrowed/knownpaths.py @@ -0,0 +1,164 @@ +import ctypes, sys +from ctypes import windll, wintypes +from uuid import UUID + +class GUID(ctypes.Structure): # [1] + _fields_ = [ + ("Data1", wintypes.DWORD), + ("Data2", wintypes.WORD), + ("Data3", wintypes.WORD), + ("Data4", wintypes.BYTE * 8) + ] + + def __init__(self, uuid_): + ctypes.Structure.__init__(self) + self.Data1, self.Data2, self.Data3, self.Data4[0], self.Data4[1], rest = uuid_.fields + for i in range(2, 8): + self.Data4[i] = rest>>(8 - i - 1)*8 & 0xff + +class FOLDERID: # [2] + AccountPictures = UUID('{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}') + AdminTools = UUID('{724EF170-A42D-4FEF-9F26-B60E846FBA4F}') + ApplicationShortcuts = UUID('{A3918781-E5F2-4890-B3D9-A7E54332328C}') + CameraRoll = UUID('{AB5FB87B-7CE2-4F83-915D-550846C9537B}') + CDBurning = UUID('{9E52AB10-F80D-49DF-ACB8-4330F5687855}') + CommonAdminTools = UUID('{D0384E7D-BAC3-4797-8F14-CBA229B392B5}') + CommonOEMLinks = UUID('{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}') + CommonPrograms = UUID('{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}') + CommonStartMenu = UUID('{A4115719-D62E-491D-AA7C-E74B8BE3B067}') + CommonStartup = UUID('{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}') + CommonTemplates = UUID('{B94237E7-57AC-4347-9151-B08C6C32D1F7}') + Contacts = UUID('{56784854-C6CB-462b-8169-88E350ACB882}') + Cookies = UUID('{2B0F765D-C0E9-4171-908E-08A611B84FF6}') + Desktop = UUID('{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}') + DeviceMetadataStore = UUID('{5CE4A5E9-E4EB-479D-B89F-130C02886155}') + Documents = UUID('{FDD39AD0-238F-46AF-ADB4-6C85480369C7}') + DocumentsLibrary = UUID('{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}') + Downloads = UUID('{374DE290-123F-4565-9164-39C4925E467B}') + Favorites = UUID('{1777F761-68AD-4D8A-87BD-30B759FA33DD}') + Fonts = UUID('{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}') + GameTasks = UUID('{054FAE61-4DD8-4787-80B6-090220C4B700}') + History = UUID('{D9DC8A3B-B784-432E-A781-5A1130A75963}') + ImplicitAppShortcuts = UUID('{BCB5256F-79F6-4CEE-B725-DC34E402FD46}') + InternetCache = UUID('{352481E8-33BE-4251-BA85-6007CAEDCF9D}') + Libraries = UUID('{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}') + Links = UUID('{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}') + LocalAppData = UUID('{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}') + LocalAppDataLow = UUID('{A520A1A4-1780-4FF6-BD18-167343C5AF16}') + LocalizedResourcesDir = UUID('{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}') + Music = UUID('{4BD8D571-6D19-48D3-BE97-422220080E43}') + MusicLibrary = UUID('{2112AB0A-C86A-4FFE-A368-0DE96E47012E}') + NetHood = UUID('{C5ABBF53-E17F-4121-8900-86626FC2C973}') + OriginalImages = UUID('{2C36C0AA-5812-4b87-BFD0-4CD0DFB19B39}') + PhotoAlbums = UUID('{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}') + PicturesLibrary = UUID('{A990AE9F-A03B-4E80-94BC-9912D7504104}') + Pictures = UUID('{33E28130-4E1E-4676-835A-98395C3BC3BB}') + Playlists = UUID('{DE92C1C7-837F-4F69-A3BB-86E631204A23}') + PrintHood = UUID('{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}') + Profile = UUID('{5E6C858F-0E22-4760-9AFE-EA3317B67173}') + ProgramData = UUID('{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}') + ProgramFiles = UUID('{905e63b6-c1bf-494e-b29c-65b732d3d21a}') + ProgramFilesX64 = UUID('{6D809377-6AF0-444b-8957-A3773F02200E}') + ProgramFilesX86 = UUID('{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}') + ProgramFilesCommon = UUID('{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}') + ProgramFilesCommonX64 = UUID('{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}') + ProgramFilesCommonX86 = UUID('{DE974D24-D9C6-4D3E-BF91-F4455120B917}') + Programs = UUID('{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}') + Public = UUID('{DFDF76A2-C82A-4D63-906A-5644AC457385}') + PublicDesktop = UUID('{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}') + PublicDocuments = UUID('{ED4824AF-DCE4-45A8-81E2-FC7965083634}') + PublicDownloads = UUID('{3D644C9B-1FB8-4f30-9B45-F670235F79C0}') + PublicGameTasks = UUID('{DEBF2536-E1A8-4c59-B6A2-414586476AEA}') + PublicLibraries = UUID('{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}') + PublicMusic = UUID('{3214FAB5-9757-4298-BB61-92A9DEAA44FF}') + PublicPictures = UUID('{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}') + PublicRingtones = UUID('{E555AB60-153B-4D17-9F04-A5FE99FC15EC}') + PublicUserTiles = UUID('{0482af6c-08f1-4c34-8c90-e17ec98b1e17}') + PublicVideos = UUID('{2400183A-6185-49FB-A2D8-4A392A602BA3}') + QuickLaunch = UUID('{52a4f021-7b75-48a9-9f6b-4b87a210bc8f}') + Recent = UUID('{AE50C081-EBD2-438A-8655-8A092E34987A}') + RecordedTVLibrary = UUID('{1A6FDBA2-F42D-4358-A798-B74D745926C5}') + ResourceDir = UUID('{8AD10C31-2ADB-4296-A8F7-E4701232C972}') + Ringtones = UUID('{C870044B-F49E-4126-A9C3-B52A1FF411E8}') + RoamingAppData = UUID('{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}') + RoamedTileImages = UUID('{AAA8D5A5-F1D6-4259-BAA8-78E7EF60835E}') + RoamingTiles = UUID('{00BCFC5A-ED94-4e48-96A1-3F6217F21990}') + SampleMusic = UUID('{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}') + SamplePictures = UUID('{C4900540-2379-4C75-844B-64E6FAF8716B}') + SamplePlaylists = UUID('{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}') + SampleVideos = UUID('{859EAD94-2E85-48AD-A71A-0969CB56A6CD}') + SavedGames = UUID('{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}') + SavedSearches = UUID('{7d1d3a04-debb-4115-95cf-2f29da2920da}') + Screenshots = UUID('{b7bede81-df94-4682-a7d8-57a52620b86f}') + SearchHistory = UUID('{0D4C3DB6-03A3-462F-A0E6-08924C41B5D4}') + SearchTemplates = UUID('{7E636BFE-DFA9-4D5E-B456-D7B39851D8A9}') + SendTo = UUID('{8983036C-27C0-404B-8F08-102D10DCFD74}') + SidebarDefaultParts = UUID('{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}') + SidebarParts = UUID('{A75D362E-50FC-4fb7-AC2C-A8BEAA314493}') + SkyDrive = UUID('{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}') + SkyDriveCameraRoll = UUID('{767E6811-49CB-4273-87C2-20F355E1085B}') + SkyDriveDocuments = UUID('{24D89E24-2F19-4534-9DDE-6A6671FBB8FE}') + SkyDrivePictures = UUID('{339719B5-8C47-4894-94C2-D8F77ADD44A6}') + StartMenu = UUID('{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}') + Startup = UUID('{B97D20BB-F46A-4C97-BA10-5E3608430854}') + System = UUID('{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}') + SystemX86 = UUID('{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}') + Templates = UUID('{A63293E8-664E-48DB-A079-DF759E0509F7}') + UserPinned = UUID('{9E3995AB-1F9C-4F13-B827-48B24B6C7174}') + UserProfiles = UUID('{0762D272-C50A-4BB0-A382-697DCD729B80}') + UserProgramFiles = UUID('{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}') + UserProgramFilesCommon = UUID('{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}') + Videos = UUID('{18989B1D-99B5-455B-841C-AB7C74E4DDFC}') + VideosLibrary = UUID('{491E922F-5643-4AF4-A7EB-4E7A138D8174}') + Windows = UUID('{F38BF404-1D43-42F2-9305-67DE0B28FC23}') + +class UserHandle: # [3] + current = wintypes.HANDLE(0) + common = wintypes.HANDLE(-1) + +_CoTaskMemFree = windll.ole32.CoTaskMemFree # [4] +_CoTaskMemFree.restype= None +_CoTaskMemFree.argtypes = [ctypes.c_void_p] + +_SHGetKnownFolderPath = windll.shell32.SHGetKnownFolderPath # [5] [3] +_SHGetKnownFolderPath.argtypes = [ + ctypes.POINTER(GUID), wintypes.DWORD, wintypes.HANDLE, ctypes.POINTER(ctypes.c_wchar_p) +] + +class PathNotFoundException(Exception): pass + +def get_path(folderid, user_handle=UserHandle.common): + fid = GUID(folderid) + pPath = ctypes.c_wchar_p() + S_OK = 0 + if _SHGetKnownFolderPath(ctypes.byref(fid), 0, user_handle, ctypes.byref(pPath)) != S_OK: + raise PathNotFoundException() + path = pPath.value + _CoTaskMemFree(pPath) + return path + +if __name__ == '__main__': + if len(sys.argv) < 2 or sys.argv[1] in ['-?', '/?']: + print('python knownpaths.py FOLDERID {current|common}') + sys.exit(0) + + try: + folderid = getattr(FOLDERID, sys.argv[1]) + except AttributeError: + print('Unknown folder id "%s"' % sys.argv[1], file=sys.stderr) + sys.exit(1) + + try: + if len(sys.argv) == 2: + print(get_path(folderid)) + else: + print(get_path(folderid, getattr(UserHandle, sys.argv[2]))) + except PathNotFoundException: + print('Folder not found "%s"' % ' '.join(sys.argv[1:]), file=sys.stderr) + sys.exit(1) + +# [1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa373931.aspx +# [2] http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457.aspx +# [3] http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188.aspx +# [4] http://msdn.microsoft.com/en-us/library/windows/desktop/ms680722.aspx +# [5] http://www.themacaque.com/?p=954 diff --git a/.bin/Scripts/cbs_fix.py b/.bin/Scripts/cbs_fix.py new file mode 100644 index 00000000..ab3ba01c --- /dev/null +++ b/.bin/Scripts/cbs_fix.py @@ -0,0 +1,38 @@ +# Wizard Kit: Copy user data to the system over the network + +import os +import sys + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +sys.path.append(os.getcwd()) +from functions.cleanup import * +from functions.data import * +init_global_vars() +os.system('title {}: CBS Cleanup'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\CBS Cleanup.log'.format(**global_vars) + +if __name__ == '__main__': + try: + # Prep + stay_awake() + get_ticket_number() + os.system('cls') + folder_path = r'{}\Backups'.format(KIT_NAME_SHORT) + dest = select_destination(folder_path=folder_path, + prompt='Which disk are we using for temp data and backup?') + if (not ask('Proceed with CBS cleanup?')): + abort() + + # Run Cleanup + try_and_print(message='Running cleanup...', function=cleanup_cbs, + cs='Done', dest_folder=dest) + + # Done + print_standard('\nDone.') + pause("Press Enter to exit...") + exit_script() + except SystemExit: + pass + except: + major_exception() diff --git a/.bin/Scripts/check_disk.py b/.bin/Scripts/check_disk.py index ad9f974e..f233f544 100644 --- a/.bin/Scripts/check_disk.py +++ b/.bin/Scripts/check_disk.py @@ -1,19 +1,15 @@ -# Wizard Kit: Check Disk Tool +# Wizard Kit: Check or repair the %SYSTEMDRIVE% filesystem via CHKDSK import os import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: Check Disk Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.repairs import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\Check Disk.log'.format(**global_vars) - -def abort(): - print_warning('Aborted.') - exit_script() +os.system('title {}: Check Disk Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\Check Disk.log'.format(**global_vars) if __name__ == '__main__': try: @@ -26,9 +22,27 @@ if __name__ == '__main__': 'GenericRepair': 'Repaired', 'UnsupportedOSError': 'Unsupported OS', }} + options = [ + {'Name': 'Run CHKDSK scan (read-only)', 'Repair': False}, + {'Name': 'Schedule CHKDSK scan (offline repair)', 'Repair': True}] + actions = [{'Name': 'Quit', 'Letter': 'Q'}] + selection = menu_select( + 'Please select action to perform', options, actions) os.system('cls') print_info('Check Disk Tool') - try_and_print(message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']), function=run_chkdsk, other_results=other_results) + if selection == 'Q': + abort() + elif selection.isnumeric(): + repair = options[int(selection)-1]['Repair'] + if repair: + cs = 'Scheduled' + else: + cs = 'CS' + message = 'CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']) + try_and_print(message=message, function=run_chkdsk, + cs=cs, other_results=other_results, repair=repair) + else: + abort() # Done print_success('Done.') diff --git a/.bin/Scripts/check_disk_fix.py b/.bin/Scripts/check_disk_fix.py deleted file mode 100644 index 5569f098..00000000 --- a/.bin/Scripts/check_disk_fix.py +++ /dev/null @@ -1,45 +0,0 @@ -# Wizard Kit: Check Disk (Fix) Tool - -import os -import sys - -# Init -os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: Check Disk (Fix) Tool') -sys.path.append(os.getcwd()) -from functions import * -init_global_vars() -global_vars['LogFile'] = '{LogDir}\\Check Disk (Fix).log'.format(**global_vars) - -def abort(): - print_warning('Aborted.') - exit_script() - -if __name__ == '__main__': - try: - stay_awake() - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - }, - 'Warning': { - 'GenericRepair': 'Repaired', - 'UnsupportedOSError': 'Unsupported OS', - }} - offline_scan = True - os.system('cls') - print_info('Check Disk Tool') - _spotfix = try_and_print(message='CHKDSK Spotfix ({SYSTEMDRIVE})...'.format(**global_vars['Env']), function=run_chkdsk_spotfix, other_results=other_results) - if global_vars['OS']['Version'] in ['8', '10'] and not _spotfix['CS']: - offline_scan = ask('Run full offline scan?') - try_and_print(message='CHKDSK Offline ({SYSTEMDRIVE})...'.format(**global_vars['Env']), function=run_chkdsk_offline, cs='Scheduled', ns='Error', other_results=other_results) - - # Done - print_success('Done.') - pause("Press Enter to reboot...") - run_program(['shutdown', '-r', '-t', '15'], check=False) - exit_script() - except SystemExit: - pass - except: - major_exception() diff --git a/.bin/Scripts/dism.py b/.bin/Scripts/dism.py index 63adb27b..d9c6d7bf 100644 --- a/.bin/Scripts/dism.py +++ b/.bin/Scripts/dism.py @@ -1,19 +1,15 @@ -# Wizard Kit: DISM wrapper +# Wizard Kit: Check or repair component store health via DISM import os import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: DISM helper Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.repairs import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\DISM helper tool.log'.format(**global_vars) - -def abort(): - print_warning('Aborted.') - exit_script() +os.system('title {}: DISM helper Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\DISM helper tool.log'.format(**global_vars) if __name__ == '__main__': try: @@ -27,18 +23,24 @@ if __name__ == '__main__': 'UnsupportedOSError': 'Unsupported OS', }} options = [ - {'Name': 'Check Health', 'Command': 'Check'}, - {'Name': 'Restore Health', 'Command': 'Restore'}] + {'Name': 'Check Health', 'Repair': False}, + {'Name': 'Restore Health', 'Repair': True}] actions = [{'Name': 'Quit', 'Letter': 'Q'}] - selection = menu_select('Please select action to perform', options, actions) + selection = menu_select( + 'Please select action to perform', options, actions) os.system('cls') print_info('DISM helper tool') if selection == 'Q': abort() - elif options[int(selection)-1]['Command'] == 'Check': - try_and_print(message='DISM ScanHealth...', function=run_dism_scan_health, cs='No corruption', ns='Corruption detected', other_results=other_results) - elif options[int(selection)-1]['Command'] == 'Restore': - try_and_print(message='DISM RestoreHealth...', function=run_dism_restore_health, cs='No corruption', ns='Corruption detected', other_results=other_results) + elif selection.isnumeric(): + repair = options[int(selection)-1]['Repair'] + if repair: + message='DISM RestoreHealth...' + else: + message='DISM ScanHealth...' + try_and_print(message=message, function=run_dism, + cs='No corruption', ns='Corruption detected', + other_results=other_results, repair=repair) else: abort() diff --git a/.bin/Scripts/functions.py b/.bin/Scripts/functions.py deleted file mode 100644 index 2f609c30..00000000 --- a/.bin/Scripts/functions.py +++ /dev/null @@ -1,2811 +0,0 @@ -# Wizard Kit: Init - -import os -import partition_uids -import psutil -import re -import shutil -import subprocess -import sys -import time -import traceback -import winreg - -from operator import itemgetter -from subprocess import CalledProcessError - -# STATIC VARIABLES -ARCHIVE_PASSWORD='Abracadabra' -COLORS = { - 'CLEAR': '\033[0m', - 'RED': '\033[31m', - 'GREEN': '\033[32m', - 'YELLOW': '\033[33m', - 'BLUE': '\033[34m' -} -BACKUP_SERVERS = [ - { 'IP': '10.0.0.10', - 'Name': 'ServerOne', - 'Mounted': False, - 'Share': 'Backups', - 'User': 'restore', - 'Pass': 'Abracadabra', - }, - { 'IP': '10.0.0.11', - 'Name': 'ServerTwo', - 'Mounted': False, - 'Share': 'Backups', - 'User': 'restore', - 'Pass': 'Abracadabra', - }, -] -CLIENT_INFO_SERVER = { - 'IP': '10.0.0.10', - 'RegEntry': r'0x10001,0xcc674aebbd889f5fd553564adcf3cab550791eca12542033d52134db893c95aabb6b318a4621d8116f6838d873edfe9db4509e1dfc9177ee7484808a62cbc42b913387f694fd67e81950f85198acf721c5767b54db7b864d69cce65e12c78c87d0fb4fc54996609c9b9274b1de7bae2f95000c9ca8d7e3f9b3f2cdb21cd578adf9ba98d10400a8203bb1a879a4cd2fad99baeb12738b9b4b99fec821f881acb62598a43c059f74af287bc8dceeb4821317aa44e2e0ee66d346927a654c702854a71a2eaed6a53f6be9360c7049974a2597a548361da42ac982ae55f993700a8b1fc9f3b4458314fbd41f239de0a29716cdcefbbb2c8d02b4c2effa4163cfeac9', - 'Share': '/srv/ClientInfo', - 'User': 'wkdiag', -} -OFFICE_SERVER = { - 'IP': '10.0.0.10', - 'Name': 'ServerOne', - 'Mounted': False, - 'Share': 'Office', - 'User': 'restore', # Using these credentials in case the backup shares are also mounted. - 'Pass': 'Abracadabra', # This is because Windows only allows one set of credentials to be used per server at a time. -} -WINDOWS_SERVER = { - 'IP': '10.0.0.10', - 'Name': 'ServerOne', - 'Mounted': False, - 'Share': 'Windows', - 'User': 'restore', # Using these credentials in case the backup shares are also mounted. - 'Pass': 'Abracadabra', # This is because Windows only allows one set of credentials to be used per server at a time. -} -SHELL_FOLDERS = { - #GUIDs from: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx - 'Desktop': ('{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}'), - 'Documents': ('Personal', '{FDD39AD0-238F-46AF-ADB4-6C85480369C7}'), - 'Downloads': ('{374DE290-123F-4565-9164-39C4925E467B}'), - 'Favorites': ('{1777F761-68AD-4D8A-87BD-30B759FA33DD}'), - 'Music': ('My Music', '{4BD8D571-6D19-48D3-BE97-422220080E43}'), - 'Pictures': ('My Pictures', '{33E28130-4E1E-4676-835A-98395C3BC3BB}'), - 'Videos': ('My Video', '{18989B1D-99B5-455B-841C-AB7C74E4DDFC}'), -} -EXTRA_FOLDERS = [ - 'Dropbox', - 'Google Drive', - 'OneDrive', - 'SkyDrive', -] -TOOLS = { - # NOTE: The brace variables will be expanded at runtime - 'AIDA64': { - '32': '{BinDir}\\AIDA64\\aida64.exe'}, - 'AutoRuns': { - '32': '{BinDir}\\SysinternalsSuite\\autoruns.exe', - '64': '{BinDir}\\SysinternalsSuite\\autoruns64.exe'}, - 'BleachBit': { - '32': '{BinDir}\\BleachBit\\bleachbit_console.exe'}, - 'Caffeine': { - '32': '{BinDir}\\caffeine\\caffeine.exe'}, - 'curl': { - '32': '{BinDir}\\curl\\curl.exe'}, - 'Du': { - '32': '{BinDir}\\SysinternalsSuite\\du.exe', - '64': '{BinDir}\\SysinternalsSuite\\du64.exe'}, - 'ERUNT': { - '32': '{BinDir}\\erunt\\ERUNT.EXE'}, - 'Everything': { - '32': '{BinDir}\\Everything\\Everything.exe', - '64': '{BinDir}\\Everything\\Everything64.exe'}, - 'FastCopy': { - '32': '{BinDir}\\FastCopy\\FastCopy.exe', - '64': '{BinDir}\\FastCopy\\FastCopy64.exe'}, - 'HitmanPro': { - '32': '{BinDir}\\HitmanPro\\HitmanPro.exe', - '64': '{BinDir}\\HitmanPro\\HitmanPro64.exe'}, - 'HWiNFO': { - '32': '{BinDir}\\HWiNFO\\HWiNFO.exe', - '64': '{BinDir}\\HWiNFO\\HWiNFO64.exe'}, - 'KVRT': { - '32': '{BinDir}\\KVRT\\KVRT.exe'}, - 'NotepadPlusPlus': { - '32': '{BinDir}\\notepadplusplus\\notepadplusplus.exe'}, - 'ProduKey': { - '32': '{BinDir}\\ProduKey\\ProduKey.exe', - '64': '{BinDir}\\ProduKey\\ProduKey64.exe'}, - 'PuTTY-PSFTP': { - '32': '{BinDir}\\PuTTY\\PSFTP.EXE'}, - 'RKill': { - '32': '{BinDir}\\RKill\\RKill.exe'}, - 'SevenZip': { - '32': '{BinDir}\\7-Zip\\7za.exe', - '64': '{BinDir}\\7-Zip\\7za64.exe'}, - 'TDSSKiller': { - '32': '{BinDir}\\TDSSKiller\\TDSSKiller.exe'}, - 'wimlib-imagex': { - '32': '{BinDir}\\wimlib\\x32\\wimlib-imagex.exe', - '64': '{BinDir}\\wimlib\\x64\\wimlib-imagex.exe'}, - 'XMPlay': { - '32': '{BinDir}\\XMPlay\\xmplay.exe'}, -} -# Browsers -DEFAULT_HOMEPAGE = 'https://www.google.com/' -REGEX_CHROMIUM_ITEMS = re.compile(r'^(Bookmarks|Cookies|Favicons|Google Profile|History|Login Data|Top Sites|TransportSecurity|Visited Links|Web Data).*', re.IGNORECASE) -REGEX_FIREFOX = re.compile(r'^(bookmarkbackups|(cookies|formhistory|places).sqlite|key3.db|logins.json|persdict.dat)$', re.IGNORECASE) -REGEX_OFFICE = re.compile(r'(Microsoft (Office\s+(365|Enterprise|Home|Pro(\s|fessional)|Single|Small|Standard|Starter|Ultimate|system)|Works[-\s\d]+\d)|(Libre|Open|Star)\s*Office|WordPerfect|Gnumeric|Abiword)', re.IGNORECASE) -# Registry -REGEX_REGISTRY_DIRS = re.compile(r'^(config$|RegBack$|System32$|Transfer|Win)', re.IGNORECASE) -REGEX_SOFTWARE_HIVE = re.compile(r'^Software$', re.IGNORECASE) -# Data 1 -REGEX_EXCL_ITEMS = re.compile(r'^(\.(AppleDB|AppleDesktop|AppleDouble|com\.apple\.timemachine\.supported|dbfseventsd|DocumentRevisions-V100.*|DS_Store|fseventsd|PKInstallSandboxManager|Spotlight.*|SymAV.*|symSchedScanLockxz|TemporaryItems|Trash.*|vol|VolumeIcon\.icns)|desktop\.(ini|.*DB|.*DF)|(hiberfil|pagefile)\.sys|lost\+found|Network\.*Trash\.*Folder|Recycle[dr]|System\.*Volume\.*Information|Temporary\.*Items|Thumbs\.db)$', flags=re.IGNORECASE) -REGEX_EXCL_ROOT_ITEMS = re.compile(r'^\\?(boot(mgr|nxt)$|Config.msi|(eula|globdata|install|vc_?red)|.*.sys$|System Volume Information|RECYCLER?|\$Recycle\.bin|\$?Win(dows(.old.*|\.~BT|)$|RE_)|\$GetCurrent|PerfLogs|Program Files|.*\.(esd|swm|wim|dd|map|dmg|image)$|SYSTEM.SAV|Windows10Upgrade)', flags=re.IGNORECASE) -REGEX_INCL_ROOT_ITEMS = re.compile(r'^\\?(AdwCleaner|(My\s*|)(Doc(uments?( and Settings|)|s?)|Downloads|WK(-?Info|-?Transfer|)|Media|Music|Pic(ture|)s?|Vid(eo|)s?)|(ProgramData|Recovery|Temp.*|Users)$|.*\.(log|txt|rtf|qb\w*|avi|m4a|m4v|mp4|mkv|jpg|png|tiff?)$)', flags=re.IGNORECASE) -REGEX_WIM_FILE = re.compile(r'\.wim$', flags=re.IGNORECASE) -REGEX_WINDOWS_OLD = re.compile(r'^\\Win(dows|)\.old', flags=re.IGNORECASE) -FAST_COPY_ARGS = [ - '/cmd=noexist_only', - '/utf8', - '/skip_empty_dir', - '/linkdest', - '/no_ui', - '/auto_close', - r'/exclude=\*.esd;\*.swm;\*.wim;\*.dd;\*.dd.tgz;\*.dd.txz;\*.map;\*.dmg;\*.image;$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db'] -VCR_REDISTS = [ - {'Name': 'Visual C++ 2005 SP1 x32...', 'Cmd': ['msiexec', '/i', '2005sp1\\x86\\vcredist.msi', '/qb!', '/norestart']}, - {'Name': 'Visual C++ 2005 SP1 x64...', 'Cmd': ['msiexec', '/i', '2005sp1\\x64\\vcredist.msi', '/qb!', '/norestart']}, - {'Name': 'Visual C++ 2008 SP1 x32...', 'Cmd': ['2008sp1\\vcredist_x86.exe', '/qb! /norestart']}, - {'Name': 'Visual C++ 2008 SP1 x64...', 'Cmd': ['2008sp1\\vcredist_x64.exe', '/qb! /norestart']}, - {'Name': 'Visual C++ 2010 x32...', 'Cmd': ['2010\\vcredist_x86.exe', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2010 x64...', 'Cmd': ['2010\\vcredist_x64.exe', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2012 Update 4 x32...', 'Cmd': ['2012u4\\vcredist_x86.exe', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2012 Update 4 x64...', 'Cmd': ['2012u4\\vcredist_x64.exe', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2013 x32...', 'Cmd': ['2013\\vcredist_x86.exe', '/install', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2013 x64...', 'Cmd': ['2013\\vcredist_x64.exe', '/install', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2015 Update 3 x32...', 'Cmd': ['2015u3\\vc_redist.x86.exe', '/install', '/passive', '/norestart']}, - {'Name': 'Visual C++ 2015 Update 3 x64...', 'Cmd': ['2015u3\\vc_redist.x64.exe', '/install', '/passive', '/norestart']}] - -global_vars = {} - -# Error Classes -class BIOSKeyNotFoundError(Exception): - pass - -class BinNotFoundError(Exception): - pass - -class GenericError(Exception): - pass - -class GenericRepair(Exception): - pass - -class NotInstalledError(Exception): - pass - -class NoProfilesError(Exception): - pass - -class UnsupportedOSError(Exception): - pass - -# General functions -def ask(prompt='Kotaero!'): - """Prompt the user with a Y/N question, log answer, and return a bool.""" - answer = None - prompt = prompt + ' [Y/N]: ' - while answer is None: - tmp = input(prompt) - if re.search(r'^y(es|)$', tmp, re.IGNORECASE): - answer = True - elif re.search(r'^n(o|ope|)$', tmp, re.IGNORECASE): - answer = False - _message = '{prompt}{answer_text}'.format( - prompt = prompt, - answer_text = 'Yes' if answer else 'No') - print_log(message=_message) - return answer - -def convert_to_bytes(size): - """Convert human-readable size str to bytes and return an int.""" - size = str(size) - tmp = re.search(r'(\d+)\s+([KMGT]B)', size.upper()) - if tmp: - size = int(tmp.group(1)) - units = tmp.group(2) - if units == 'TB': - size *= 1099511627776 - elif units == 'GB': - size *= 1073741824 - elif units == 'MB': - size *= 1048576 - elif units == 'KB': - size *= 1024 - else: - return -1 - - return size - -def exit_script(): - # Remove dirs (if empty) - for dir in ['BackupDir', 'LogDir', 'TmpDir']: - try: - dir = global_vars[dir] - os.rmdir(dir) - except: - pass - - # Open Log (if it exists) - _log = global_vars.get('LogFile', '') - if os.path.exists(_log): - try: - extract_item('NotepadPlusPlus', silent=True) - popen_program([global_vars['Tools']['NotepadPlusPlus'], global_vars['LogFile']]) - except: - print_error('ERROR: Failed to extract Notepad++ and open log.') - - # Kill Caffeine if still running - kill_process('caffeine.exe') - - # Exit - sys.exit(0) - -def extract_item(item=None, filter='', silent=False): - """Extract item from .cbin into .bin.""" - if item is None: - raise Exception - _cmd = [ - global_vars['Tools']['SevenZip'], 'x', '-aos', '-bso0', '-bse0', - '-p{ArchivePassword}'.format(**global_vars), - '-o"{BinDir}\\{item}"'.format(item=item, **global_vars), - '"{CBinDir}\\{item}.7z"'.format(item=item, **global_vars), - filter] - if not silent: - print_standard('Extracting "{item}"...'.format(item=item)) - try: - run_program(_cmd, shell=True) - except subprocess.CalledProcessError: - if not silent: - print_warning('WARNING: Errors encountered while exctracting data') - -def get_ticket_number(): - """Get TicketNumber from user and save it in the info folder.""" - global_vars['TicketNumber'] = None - while global_vars['TicketNumber'] is None: - _ticket = input('Enter ticket number: ') - if re.match(r'^([0-9]+([-_]?\w+|))$', _ticket): - global_vars['TicketNumber'] = _ticket - with open('{LogDir}\\TicketNumber'.format(**global_vars), 'w') as f: - f.write(_ticket) - -def human_readable_size(size, decimals=0): - """Convert size in bytes to a human-readable format and return a str.""" - # Prep string formatting - width = 3+decimals - if decimals > 0: - width += 1 - human_format = '>{width}.{decimals}f'.format(width=width, decimals=decimals) - tmp = '' - - # Convert size to int - try: - size = int(size) - except ValueError: - size = convert_to_bytes(size) - - # Verify we have a valid size - if size <= 0: - return '{size:>{width}} b'.format(size='???', width=width) - - # Format string - if size >= 1099511627776: - size /= 1099511627776 - tmp = '{size:{human_format}} Tb'.format(size=size, human_format=human_format) - elif size >= 1073741824: - size /= 1073741824 - tmp = '{size:{human_format}} Gb'.format(size=size, human_format=human_format) - elif size >= 1048576: - size /= 1048576 - tmp = '{size:{human_format}} Mb'.format(size=size, human_format=human_format) - elif size >= 1024: - size /= 1024 - tmp = '{size:{human_format}} Kb'.format(size=size, human_format=human_format) - else: - tmp = '{size:{human_format}} b'.format(size=size, human_format=human_format) - - # Return - return tmp - -def kill_process(name=None): - """Kill any running caffeine.exe processes.""" - if name is None: - raise Exception - for proc in psutil.process_iter(): - if proc.name() == name: - proc.kill() - -def major_exception(): - """Display traceback and exit""" - print_error('Major exception') - print_warning(' Please let The Wizard know and he\'ll look into it (Please include the details below).') - print(traceback.format_exc()) - print_log(traceback.format_exc()) - sleep(30) - pause("Press Enter to exit...") - sys.exit(1) - -def menu_select(title='~ Untitled Menu ~', main_entries=[], action_entries=[], - prompt='Please make a selection', secret_exit=False, disabled_label='DISABLED'): - """Display options in a menu for user and return selected option as a str.""" - # Bail early - if (len(main_entries) + len(action_entries) == 0): - raise Exception("MenuError: No items given") - - # Build menu - menu_splash = '{title}\n\n'.format(title=title) - width = len(str(len(main_entries))) - valid_answers = [] - if (secret_exit): - valid_answers.append('Q') - - # Add main entries - if (len(main_entries) > 0): - for i in range(len(main_entries)): - entry = main_entries[i] - # Add Spacer - if ('CRLF' in entry): - menu_splash += '\n' - if entry.get('Disabled', False): - menu_splash += '{YELLOW}{number:>{width}}: {name} ({disabled}){CLEAR}\n'.format( - number = i+1, - disabled = disabled_label, - width = width, - name = entry.get('Display Name', entry['Name']), - **COLORS) - else: - valid_answers.append(str(i+1)) - menu_splash += '{number:>{width}}: {name}\n'.format( - number = i+1, - width = width, - name = entry.get('Display Name', entry['Name'])) - menu_splash += '\n' - - # Add action entries - if (len(action_entries) > 0): - for entry in action_entries: - # Add Spacer - if ('CRLF' in entry): - menu_splash += '\n' - valid_answers.append(entry['Letter']) - menu_splash += '{letter:>{width}}: {name}\n'.format( - letter = entry['Letter'].upper(), - width = len(str(len(action_entries))), - name = entry['Name']) - menu_splash += '\n' - - answer = '' - - while (answer.upper() not in valid_answers): - os.system('cls') - print(menu_splash) - answer = input('{prompt}: '.format(prompt=prompt)) - - return answer.upper() - -def non_clobber_rename(full_path): - """Append suffix to path, if necessary, to avoid clobbering path""" - new_path = full_path - _i = 1; - while os.path.exists(new_path): - new_path = '{path}_{i}'.format(i=_i, path=full_path) - _i += 1 - - return new_path - -def pause(prompt='Press Enter to continue... '): - """Simple pause implementation.""" - input(prompt) - -def popen_program(cmd=None, pipe=False, minimized=False, shell=False): - """Run program and return a subprocess.Popen object.""" - if cmd is None: - raise Exception('No program passed.') - - startupinfo=None - if minimized: - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags = subprocess.STARTF_USESHOWWINDOW - startupinfo.wShowWindow = 6 - - if pipe: - popen_obj = subprocess.Popen(cmd, shell=shell, startupinfo=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - popen_obj = subprocess.Popen(cmd, shell=shell, startupinfo=None) - - return popen_obj - -def print_error(message='Generic error', end='\n', timestamp=True, **kwargs): - """Prints message to screen in RED.""" - print('{RED}{message}{CLEAR}'.format(message=message, **COLORS), end=end, **kwargs) - print_log(message, end, timestamp) - -def print_info(message='Generic info', end='\n', timestamp=True, **kwargs): - """Prints message to screen in BLUE.""" - print('{BLUE}{message}{CLEAR}'.format(message=message, **COLORS), end=end, **kwargs) - print_log(message, end, timestamp) - -def print_warning(message='Generic warning', end='\n', timestamp=True, **kwargs): - """Prints message to screen in YELLOW.""" - print('{YELLOW}{message}{CLEAR}'.format(message=message, **COLORS), end=end, **kwargs) - print_log(message, end, timestamp) - -def print_standard(message='Generic info', end='\n', timestamp=True, **kwargs): - """Prints message to screen.""" - print('{message}'.format(message=message, **COLORS), end=end, **kwargs) - print_log(message, end, timestamp) - -def print_success(message='Generic success', end='\n', timestamp=True, **kwargs): - """Prints message to screen in GREEN.""" - print('{GREEN}{message}{CLEAR}'.format(message=message, **COLORS), end=end, **kwargs) - print_log(message, end, timestamp) - -def print_log(message='', end='\n', timestamp=True): - if 'LogFile' in global_vars and global_vars['LogFile'] is not None: - with open(global_vars['LogFile'], 'a') as f: - for line in message.splitlines(): - f.write('{timestamp}{line}{end}'.format( - timestamp = time.strftime("%Y-%m-%d %H%M%z: ") if timestamp else '', - line = line, - end = end)) - -def run_program(cmd=None, args=[], check=True, pipe=True, shell=False): - """Run program and return a subprocess.CompletedProcess object.""" - if cmd is None: - raise Exception('No program passed.') - - _cmd = cmd - if len(args) > 0: - # BAD Need to refactor all calls to run_program to only use cmd=X - ## That way the cmd var is set the same as the real run() and Popen() calls - _cmd = [cmd] + args - if shell: - _cmd = ' '.join(_cmd) - - if pipe: - process_return = subprocess.run(_cmd, check=check, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - process_return = subprocess.run(_cmd, check=check, shell=shell) - - return process_return - -def show_info(message='~Some message~', info='~Some info~', indent=8, width=32): - print_standard('{indent}{message:<{width}}{info}'.format(indent=' '*indent, width=width, message=message, info=info)) - -def sleep(seconds=2): - time.sleep(seconds) - -def stay_awake(): - """Prevent the system from sleeping or hibernating.""" - # Bail if caffeine is already running - for proc in psutil.process_iter(): - if proc.name() == 'caffeine.exe': - return - # Extract and run - extract_item('caffeine', silent=True) - try: - popen_program(global_vars['Tools']['Caffeine']) - except: - print_error('ERROR: No caffeine available; please set the power setting to High Performace.') - -def try_and_print(function=None, message='Trying...', cs='CS', ns='NS', other_results={}, - catch_all=True, indent=8, width=32, print_return=False, silent_function=True, *args, **kwargs): - """Run function, print if successful or not, and return dict. - - other_results is in the form of {'Warning': {'ExceptionClassName': 'Result Message'}, 'Error': {'ExceptionClassName': 'Result Message'}} - The the ExceptionClassNames will be additionally excepted conditions and the result string will be printed in the correct color. - catch_all=False will result in unspecified exceptions being re-raised.""" - if function is None: - raise Exception - err = '' - wrn_exceptions = other_results.get('Warning', {}).keys() - wrn_exceptions = tuple(getattr(sys.modules[__name__], e) for e in wrn_exceptions) - err_exceptions = other_results.get('Error', {}).keys() - err_exceptions = tuple(getattr(sys.modules[__name__], e) for e in err_exceptions) - wrn_results = other_results.get('Warning', {}) - err_results = other_results.get('Error', {}) - - # Run function and catch errors - print_standard('{indent}{message:<{width}}'.format(indent=' '*indent, message=message, width=width), end='', flush=True) - try: - out = function(*args, **kwargs) - if print_return: - print_standard(out[0], timestamp=False) - for item in out[1:]: - print_standard('{indent}{item}'.format(indent=' '*(indent+width), item=item)) - elif silent_function: - print_success(cs, timestamp=False) - except wrn_exceptions as e: - _result = wrn_results.get(e.__class__.__name__, 'Warning') - print_warning(_result, timestamp=False) - err = e - except err_exceptions as e: - _result = err_results.get(e.__class__.__name__, 'Error') - print_error(_result, timestamp=False) - err = e - except: - print_error(ns, timestamp=False) - err = traceback.format_exc() - - # Return or raise? - if bool(err) and not catch_all: - raise - else: - return {'CS': not bool(err), 'Error': err} - -def upload_data(path=None, file=None): - """Add CLIENT_INFO_SERVER to authorized connections and upload file.""" - extract_item('PuTTY', filter='WK.ppk psftp.exe', silent=True) - - # Authorize connection to the server - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\SimonTatham\PuTTY\SshHostKeys') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\SimonTatham\PuTTY\SshHostKeys', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'rsa2@22:{IP}'.format(**CLIENT_INFO_SERVER), 0, winreg.REG_SZ, CLIENT_INFO_SERVER['RegEntry']) - - # Write batch file - with open('{TmpDir}\\psftp.batch'.format(**global_vars), 'w', encoding='ascii') as f: - f.write('lcd "{path}"\n'.format(path=path)) - f.write('cd "{Share}"\n'.format(**CLIENT_INFO_SERVER)) - f.write('mkdir {TicketNumber}\n'.format(**global_vars)) - f.write('cd {TicketNumber}\n'.format(**global_vars)) - f.write('put "{file}"\n'.format(file=file)) - - # Upload Info - _cmd = [ - global_vars['Tools']['PuTTY-PSFTP'], - '-noagent', - '-i', '{BinDir}\\PuTTY\\WK.ppk'.format(**global_vars), - '{User}@{IP}'.format(**CLIENT_INFO_SERVER), - '-b', '{TmpDir}\\psftp.batch'.format(**global_vars)] - run_program(_cmd) - -def wait_for_process(name=None): - """Wait for process by name.""" - if name is None: - raise Exception - _still_running = True - while _still_running: - sleep(1) - _still_running = False - for proc in psutil.process_iter(): - if re.search(r'^{name}'.format(name=name), proc.name(), re.IGNORECASE): - _still_running = True - sleep(1) - -# global_vars functions -def init_global_vars(): - """Sets global variables based on system info.""" - print_info('Initializing') - try: - try_and_print(message='Checking .bin...', function=find_bin, catch_all=False, cs='Done', ns='Error') - try_and_print(message='Checking environment...', function=set_common_vars, catch_all=False, cs='Done', ns='Error') - try_and_print(message='Checking OS...', function=check_os, catch_all=False, cs='Done', ns='Error') - try_and_print(message='Checking tools...', function=check_tools, catch_all=False, cs='Done', ns='Error') - try_and_print(message='Creating folders...', function=make_tmp_dirs, catch_all=False, cs='Done', ns='Error') - try_and_print(message='Clearing collisions...', function=clean_env_vars, catch_all=False, cs='Done', ns='Error') - except: - major_exception() - -def check_os(): - _vars_os = {} - # Query registry - _reg_path = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion') - for key in ['CSDVersion', 'CurrentBuild', 'CurrentBuildNumber', 'CurrentVersion', 'ProductName']: - try: - _vars_os[key] = winreg.QueryValueEx(_reg_path, key)[0] - if key in ['CurrentBuild', 'CurrentBuildNumber']: - _vars_os[key] = int(_vars_os[key]) - except ValueError: - # Couldn't convert Build to int so this should return interesting results... - _vars_os[key] = 0 - except: - _vars_os[key] = 'Unknown' - - # Determine OS bit depth - _vars_os['Arch'] = 32 - if 'PROGRAMFILES(X86)' in global_vars['Env']: - _vars_os['Arch'] = 64 - - # Determine OS Name - _vars_os['Name'] = '{ProductName} {CSDVersion}'.format(**_vars_os) - if _vars_os['CurrentBuild'] == 9600: - _vars_os['Name'] += ' Update' - if _vars_os['CurrentBuild'] == 10240: - _vars_os['Name'] += ' Release 1507 "Threshold 1"' - if _vars_os['CurrentBuild'] == 10586: - _vars_os['Name'] += ' Release 1511 "Threshold 2"' - if _vars_os['CurrentBuild'] == 14393: - _vars_os['Name'] += ' Release 1607 "Redstone 1" / "Anniversary Update"' - if _vars_os['CurrentBuild'] == 15063: - _vars_os['Name'] += ' Release 1703 "Redstone 1" / "Creators Update"' - _vars_os['Name'] = _vars_os['Name'].replace('Service Pack ', 'SP') - _vars_os['Name'] = _vars_os['Name'].replace('Unknown Release', 'Release') - _vars_os['Name'] = re.sub(r'\s+', ' ', _vars_os['Name']) - # == vista == - # 6.0.6000 - # 6.0.6001 - # 6.0.6002 - # ==== 7 ==== - # 6.1.7600 - # 6.1.7601 - # 6.1.7602 - # ==== 8 ==== - # 6.2.9200 - # === 8.1 === - # 6.3.9200 - # === 8.1u == - # 6.3.9600 - # === 10 v1507 "Threshold 1" == - # 6.3.10240 - # === 10 v1511 "Threshold 2" == - # 6.3.10586 - # === 10 v1607 "Redstone 1" "Anniversary Update" == - # 6.3.14393 - # === 10 v1703 "Redstone 2" "Creators Update" == - # 6.3.15063 - # === 10 v???? "Redstone 3" "Fall Creators Update" == - # 6.3.????? - - # Determine OS version - _os_name = '{Name} x{Arch}'.format(**_vars_os) - if _vars_os['CurrentVersion'] == '6.0': - _vars_os['Version'] = 'Vista' - _os_name = _os_name + ' (very outdated)' - elif _vars_os['CurrentVersion'] == '6.1': - _vars_os['Version'] = '7' - if _vars_os['CSDVersion'] == 'Service Pack 1': - _os_name = _os_name + ' (outdated)' - else: - _os_name = _os_name + ' (very outdated)' - elif _vars_os['CurrentVersion'] == '6.2': - _vars_os['Version'] = '8' - _os_name = _os_name + ' (very outdated)' - elif _vars_os['CurrentVersion'] == '6.3': - if int(_vars_os['CurrentBuildNumber']) <= 9600: - _vars_os['Version'] = '8' - elif int(_vars_os['CurrentBuildNumber']) >= 10240: - _vars_os['Version'] = '10' - if _vars_os['CurrentBuild'] == 9200: - _os_name = _os_name + ' (very outdated)' - elif _vars_os['CurrentBuild'] == 9600: - _os_name = _os_name + ' (outdated)' - elif _vars_os['CurrentBuild'] == 10240: - _os_name = _os_name + ' (very outdated)' - elif _vars_os['CurrentBuild'] == 10586: - _os_name = _os_name + ' (outdated)' - elif _vars_os['CurrentBuild'] == 14393: - _os_name = _os_name + ' (outdated)' - elif _vars_os['CurrentBuild'] == 15063: - pass # Current Win10 - else: - _os_name = _os_name + ' (unrecognized)' - _vars_os['DisplayName'] = _os_name - - # Determine bootup type - _vars_os['SafeMode'] = False - if 'SAFEBOOT_OPTION' in global_vars['Env']: - _vars_os['SafeMode'] = True - - # Ignore activation status if in Safe Mode - if _vars_os['SafeMode']: - _vars_os['Activation'] = 'Activation status unavailable in safe mode' - else: - _vars_os['Activation'] = 'Unknown' - - global_vars['OS'] = _vars_os - - # Update activation status - update_windows_activation_status() - -def check_tools(): - # Add tools to dict - if global_vars['OS'].get('Arch', 32) == 64: - global_vars['Tools'] = {k: v.get('64', v.get('32')) for (k, v) in TOOLS.items()} - else: - global_vars['Tools'] = {k: v.get('32') for (k, v) in TOOLS.items()} - - # Fix paths - global_vars['Tools'] = {k: v.format(**global_vars) for (k, v) in global_vars['Tools'].items()} - -def clean_env_vars(): - # This fixes an issue where both global_vars and global_vars['Env'] are expanded at the same time - for key in global_vars.keys(): - global_vars['Env'].pop(key, None) - -def find_bin(): - _wd = os.getcwd() - _base = None - while _base is None: - if os.path.exists('.bin'): - _base = os.getcwd() - break - if re.fullmatch(r'\w:\\', os.getcwd()): - break - os.chdir('..') - os.chdir(_wd) - if _base is None: - raise BinNotFoundError - global_vars['BaseDir'] = _base - -def make_tmp_dirs(): - os.makedirs(global_vars['BackupDir'], exist_ok=True) - os.makedirs(global_vars['LogDir'], exist_ok=True) - os.makedirs(global_vars['TmpDir'], exist_ok=True) - -def set_common_vars(): - global_vars['Date'] = time.strftime("%Y-%m-%d") - global_vars['Date-Time'] = time.strftime("%Y-%m-%d_%H%M_%z") - global_vars['Env'] = os.environ.copy() - - global_vars['ArchivePassword'] = ARCHIVE_PASSWORD - global_vars['BinDir'] = '{BaseDir}\\.bin'.format(**global_vars) - global_vars['CBinDir'] = '{BaseDir}\\.cbin'.format(**global_vars) - global_vars['ClientDir'] = '{SYSTEMDRIVE}\\WK'.format(**global_vars['Env']) - global_vars['BackupDir'] = '{ClientDir}\\Backups\\{Date}'.format(**global_vars) - global_vars['LogDir'] = '{ClientDir}\\Info\\{Date}'.format(**global_vars) - global_vars['QuarantineDir'] = '{ClientDir}\\Quarantine'.format(**global_vars) - global_vars['TmpDir'] = '{BinDir}\\tmp'.format(**global_vars) - -# Browsers -def backup_browsers(): - functions = [ - backup_chromium, - backup_chrome, - backup_chrome_canary, - backup_firefox, - backup_internet_explorer, - backup_opera, - backup_opera_beta, - backup_opera_dev] - errors = False - for function in functions: - try: - function() - except NoProfilesError: - pass - except: - errors = True - if errors: - raise GenericError - -def backup_chromium(): - """Create backup of Chromium in the BackupDir.""" - if os.path.exists('{LOCALAPPDATA}\\Chromium\\User Data'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Chromium.7z'.format(**global_vars, **global_vars['Env']), - '{LOCALAPPDATA}\\Chromium\\User Data'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def backup_chrome(): - """Create backup of Google Chrome in the BackupDir.""" - if os.path.exists('{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Google Chrome.7z'.format(**global_vars, **global_vars['Env']), - '{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def backup_chrome_canary(): - """Create backup of Google Chrome Canary in the BackupDir.""" - if os.path.exists('{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Google Chrome Canary.7z'.format(**global_vars, **global_vars['Env']), - '{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def backup_internet_explorer(): - """Create backup of Internet Explorer in the BackupDir.""" - run_program('reg export "hkcu\\Software\\Microsoft\\Internet Explorer" "{TmpDir}\\Internet Explorer (HKCU).reg" /y'.format(**global_vars), check=False) - run_program('reg export "hklm\\Software\\Microsoft\\Internet Explorer" "{TmpDir}\\Internet Explorer (HKLM).reg" /y'.format(**global_vars), check=False) - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Internet Explorer.7z'.format(**global_vars, **global_vars['Env']), - '{TmpDir}\\Internet*.reg'.format(**global_vars), - '{USERPROFILE}\\Favorites'.format(**global_vars['Env'])] - run_program(cmd, check=False) - -def backup_firefox(): - """Create backup of Mozilla Firefox in the BackupDir.""" - if os.path.exists('{APPDATA}\\Mozilla\\Firefox'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Mozilla Firefox.7z'.format(**global_vars, **global_vars['Env']), - '{APPDATA}\\Mozilla\\Firefox\\Profile*'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def backup_opera(): - """Create backup of Opera Chromium in the BackupDir.""" - if os.path.exists('{APPDATA}\\Opera Software\\Opera Stable'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Opera.7z'.format(**global_vars, **global_vars['Env']), - '{APPDATA}\\Opera Software\\Opera Stable'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def backup_opera_beta(): - """Create backup of Opera Chromium Beta in the BackupDir.""" - if os.path.exists('{APPDATA}\\Opera Software\\Opera Next'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Opera Beta.7z'.format(**global_vars, **global_vars['Env']), - '{APPDATA}\\Opera Software\\Opera Next'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def backup_opera_dev(): - """Create backup of Opera Chromium Developer in the BackupDir.""" - if os.path.exists('{APPDATA}\\Opera Software\\Opera Developer'.format(**global_vars['Env'])): - cmd = [ - global_vars['Tools']['SevenZip'], 'a', '-aoa', '-bso0', '-bse0', '-mx=1', - '{BackupDir}\\Browsers ({USERNAME})\\Opera Dev.7z'.format(**global_vars, **global_vars['Env']), - '{APPDATA}\\Opera Software\\Opera Developer'.format(**global_vars['Env'])] - run_program(cmd, check=False) - else: - raise NoProfilesError - -def clean_chromium_profile(profile): - """Renames profile folder as backup and then recreates the folder with only the essential files.""" - if profile is None: - raise Exception - # print_info(' Resetting profile: {name}'.format(name=profile.name)) - backup_path = '{path}_{Date}.bak'.format(path=profile.path, **global_vars) - backup_path = non_clobber_rename(backup_path) - shutil.move(profile.path, backup_path) - os.makedirs(profile.path, exist_ok=True) - - # Restore essential files from backup_path - for entry in os.scandir(backup_path): - if REGEX_CHROMIUM_ITEMS.search(entry.name): - shutil.copy(entry.path, '{path}\\{name}'.format(path=profile.path, name=entry.name)) - -def clean_internet_explorer(): - """Uses the built-in function to reset IE and sets the homepage.""" - kill_process('iexplore.exe') - run_program('rundll32.exe', ['inetcpl.cpl,ResetIEtoDefaults'], check=False) - key = r'Software\Microsoft\Internet Explorer\Main' - - # Set homepage - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key, access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'Start Page', 0, winreg.REG_SZ, DEFAULT_HOMEPAGE) - try: - winreg.DeleteValue(_key, 'Secondary Start Pages') - except FileNotFoundError: - pass - -def clean_firefox_profile(profile): - """Renames profile folder as backup and then recreates the folder with only the essential files.""" - if profile is None: - raise Exception - # print_info(' Resetting profile: {name}'.format(name=profile.name)) - backup_path = '{path}_{Date}.bak'.format(path=profile.path, **global_vars) - backup_path = non_clobber_rename(backup_path) - shutil.move(profile.path, backup_path) - homepages = [] - os.makedirs(profile.path, exist_ok=True) - - # Restore essential files from backup_path - for entry in os.scandir(backup_path): - if REGEX_FIREFOX.search(entry.name): - if entry.is_dir(): - shutil.copytree(entry.path, '{path}\\{name}'.format(path=profile.path, name=entry.name)) - else: - shutil.copy(entry.path, '{path}\\{name}'.format(path=profile.path, name=entry.name)) - - # Set profile defaults - with open('{path}\\prefs.js'.format(path=profile.path), 'a', encoding='ascii') as f: - f.write('user_pref("browser.search.geoSpecificDefaults", false);\n') - - # Set search to Google - f.write('user_pref("browser.search.defaultenginename", "Google");\n') - f.write('user_pref("browser.search.defaultenginename.US", "Google");\n') - - # Set homepage - f.write('user_pref("browser.startup.homepage", "{homepage}");\n'.format(homepage=DEFAULT_HOMEPAGE)) - -def config_internet_explorer(): - ie_exe = get_iexplorer_exe() - run_program(ie_exe, ['https://www.microsoft.com/en-us/iegallery'], check=False) - -def config_google_chrome(): - chrome_exe = get_chrome_exe() - if chrome_exe is None: - raise NotInstalledError - - # Check for system exensions - _ublock_origin = None - _ublock_extra = None - try: - _ublock_origin = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, r'Software\Wow6432Node\Google\Chrome\Extensions\cjpalhdlnbpafiamejdnhcphjbkeiagm') - except FileNotFoundError: - pass - try: - _ublock_extra = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, r'Software\Wow6432Node\Google\Chrome\Extensions\pgdnlhfefecpicbbihgmbmffkjpaplco') - except FileNotFoundError: - pass - - # Open Chrome - _args = [ - 'https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en', - 'https://chrome.google.com/webstore/detail/ublock-origin-extra/pgdnlhfefecpicbbihgmbmffkjpaplco?hl=en'] - if _ublock_origin is None and _ublock_extra is None: - run_program(chrome_exe, _args, check=False) - elif _ublock_origin is None: - run_program(chrome_exe, [_args[0]], check=False) - elif _ublock_extra is None: - run_program(chrome_exe, [_args[1]], check=False) - else: - run_program(chrome_exe, ['chrome://extensions'], check=False) - -def config_google_chrome_canary(): - chrome_canary_exe = get_chrome_canary_exe() - if chrome_canary_exe is None: - raise NotInstalledError - _args = [ - 'https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en', - 'https://chrome.google.com/webstore/detail/ublock-origin-extra/pgdnlhfefecpicbbihgmbmffkjpaplco?hl=en'] - run_program(chrome_canary_exe, _args, check=False) - -def config_mozilla_firefox(): - firefox_exe = get_firefox_exe() - if firefox_exe is None: - raise NotInstalledError - - # Check for system extension(s) - _ublock_origin = '{PROGRAMFILES}\\Mozilla Firefox\\distribution\\extensions\\uBlock0@raymondhill.net'.format(**global_vars['Env']) - if 'PROGRAMFILES(X86)' in global_vars['Env']: - _ublock_origin = '{PROGRAMFILES(X86)}\\Mozilla Firefox\\distribution\\extensions\\uBlock0@raymondhill.net'.format(**global_vars['Env']) - - # Open Firefox - if os.path.exists(_ublock_origin): - run_program(firefox_exe, ['about:addons'], check=False) - else: - run_program(firefox_exe, ['https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/'], check=False) - -def config_mozilla_firefox_dev(): - firefox_dev_exe = get_firefox_dev_exe() - if firefox_dev_exe is None: - raise NotInstalledError - run_program(firefox_dev_exe, ['https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/'], check=False) - -def config_opera(): - opera_exe = get_opera_exe() - if opera_exe is None: - raise NotInstalledError - run_program(opera_exe, ['https://addons.opera.com/en/extensions/details/ublock/?display=en'], check=False) - -def config_opera_beta(): - opera_beta_exe = get_opera_beta_exe() - if opera_beta_exe is None: - raise NotInstalledError - run_program(opera_beta_exe, ['https://addons.opera.com/en/extensions/details/ublock/?display=en'], check=False) - -def config_opera_dev(): - opera_dev_exe = get_opera_dev_exe() - if opera_dev_exe is None: - raise NotInstalledError - run_program(opera_dev_exe, ['https://addons.opera.com/en/extensions/details/ublock/?display=en'], check=False) - -def create_firefox_default_profiles(): - """Create new default profile for Mozilla Firefox for both stable and dev releases.""" - firefox_exe = get_firefox_exe() - firefox_dev_exe = get_firefox_dev_exe() - profiles_ini_path = '{APPDATA}\\Mozilla\\Firefox\\profiles.ini'.format(**global_vars['Env']) - - # Rename profiles.ini - if os.path.exists(profiles_ini_path): - backup_path = '{path}_{Date}.bak'.format(path=profiles_ini_path, **global_vars) - backup_path = non_clobber_rename(backup_path) - shutil.move(profiles_ini_path, backup_path) - - # Create profile(s) - if firefox_exe is not None: - run_program(firefox_exe, ['-createprofile', 'default'], check=False) - if firefox_dev_exe is not None: - run_program(firefox_dev_exe, ['-createprofile'], check=False) - -def get_chrome_exe(): - """Check for conflicting Chrome installations and return chrome.exe path as str.""" - install_multi = '{PROGRAMFILES}\\Google\\Chrome\\Application\\chrome.exe'.format(**global_vars['Env']) - if 'PROGRAMFILES(X86)' in global_vars['Env']: - install_multi = '{PROGRAMFILES(X86)}\\Google\\Chrome\\Application\\chrome.exe'.format(**global_vars['Env']) - install_single = '{LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe'.format(**global_vars['Env']) - if os.path.exists(install_multi): - if os.path.exists(install_single): - print_log(' WARNING: Single-user and multi-user installations present.') - print_log(' It is recommended to move to only having the multi-user installation.') - return install_multi - elif os.path.exists(install_single): - return install_single - else: - return None - -def get_chrome_profiles(): - """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" - profiles = [] - try: - for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**global_vars['Env'])): - if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): - profiles.append(entry) - profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] - except: - pass - - return profiles - -def get_chrome_canary_exe(): - """Check for Google Chrome Canary installation and return chrome.exe path as str.""" - prog_exe = '{LOCALAPPDATA}\\Google\\Chrome SxS\\Application\\chrome.exe'.format(**global_vars['Env']) - if os.path.exists(prog_exe): - return prog_exe - else: - return None - -def get_chrome_canary_profiles(): - """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" - profiles = [] - try: - for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**global_vars['Env'])): - if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): - profiles.append(entry) - profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] - except: - pass - - return profiles - -def get_iexplorer_exe(): - """Find and return iexplorer.exe path as str.""" - ie_exe = '{PROGRAMFILES}\\Internet Explorer\\iexplore.exe'.format(**global_vars['Env']) - if 'PROGRAMFILES(X86)' in global_vars['Env']: - ie_exe = '{PROGRAMFILES(X86)}\\Internet Explorer\\iexplore.exe'.format(**global_vars['Env']) - return ie_exe - -def get_firefox_exe(): - """Check for Mozilla Firefox installation and return firefox.exe path as str.""" - prog_exe = '{PROGRAMFILES}\\Mozilla Firefox\\firefox.exe'.format(**global_vars['Env']) - if 'PROGRAMFILES(X86)' in global_vars['Env']: - prog_exe = '{PROGRAMFILES(X86)}\\Mozilla Firefox\\firefox.exe'.format(**global_vars['Env']) - if os.path.exists(prog_exe): - return prog_exe - else: - return None - -def get_firefox_dev_exe(): - """Check for Mozilla Firefox Developer Edition installation and return firefox.exe path as str.""" - prog_exe = '{PROGRAMFILES}\\Firefox Developer Edition\\firefox.exe'.format(**global_vars['Env']) - if 'PROGRAMFILES(X86)' in global_vars['Env']: - prog_exe = '{PROGRAMFILES(X86)}\\Firefox Developer Edition\\firefox.exe'.format(**global_vars['Env']) - if os.path.exists(prog_exe): - return prog_exe - else: - return None - -def get_firefox_profiles(): - """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" - profiles = [] - try: - for entry in os.scandir('{APPDATA}\\Mozilla\\Firefox\\Profiles'.format(**global_vars['Env'])): - if entry.is_dir(): - profiles.append(entry) - profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] - except: - pass - - return profiles - -def get_opera_exe(): - """Check for Opera installation and return launcher.exe path as str.""" - prog_exe = '{PROGRAMFILES}\\Opera\\launcher.exe'.format(**global_vars['Env']) - if 'PROGRAMFILES(X86)' in global_vars['Env']: - prog_exe = '{PROGRAMFILES(X86)}\\Opera\\launcher.exe'.format(**global_vars['Env']) - if os.path.exists(prog_exe): - return prog_exe - else: - return None - -def get_opera_beta_exe(): - """Check for Opera Beta installation and return launcher.exe path as str.""" - prog_exe = '{PROGRAMFILES}\\Opera beta\\launcher.exe'.format(**global_vars['Env']) - # Installs as 64-bit on a 64-bit OS so PROGRAMFILES should always be correct - - if os.path.exists(prog_exe): - return prog_exe - else: - return None - -def get_opera_dev_exe(): - """Check for Opera Beta installation and return launcher.exe path as str.""" - prog_exe = '{PROGRAMFILES}\\Opera developer\\launcher.exe'.format(**global_vars['Env']) - # Installs as 64-bit on a 64-bit OS so PROGRAMFILES should always be correct - - if os.path.exists(prog_exe): - return prog_exe - else: - return None - -def get_opera_profile(): - """Find an existing Opera profile and return as a length-1 list of os.DirEntry objects.""" - profiles = [] - try: - for entry in os.scandir('{APPDATA}\\Opera Software'.format(**global_vars['Env'])): - if entry.is_dir() and entry.name == 'Opera Stable': - return [entry] - except: - pass - - return profiles - -def get_opera_beta_profile(): - """Find an existing Opera Beta profile and return as a length-1 list of os.DirEntry objects.""" - profiles = [] - try: - for entry in os.scandir('{APPDATA}\\Opera Software'.format(**global_vars['Env'])): - if entry.is_dir() and entry.name == 'Opera Next': - return [entry] - except: - pass - - return profiles - -def get_opera_dev_profile(): - """Find an existing Opera Dev profile and return as a length-1 list of os.DirEntry objects.""" - profiles = [] - try: - for entry in os.scandir('{APPDATA}\\Opera Software'.format(**global_vars['Env'])): - if entry.is_dir() and entry.name == 'Opera Developer': - return [entry] - except: - pass - - return profiles - -def list_homepages(indent=8, width=32): - """List current homepages for reference.""" - print_standard('{indent}{browser:<{width}}'.format(indent=' '*indent, width=width, browser='Google Chrome...'), end='', flush=True) - print_warning('Currently not possible', timestamp=False) - - # Firefox - profiles = get_firefox_profiles() - if len(profiles) > 0: - print_standard('{indent}{browser:<{width}}'.format(indent=' '*indent, width=width, browser='Mozilla Firefox...')) - - for profile in profiles: - homepages = [] - try: - with open('{path}\\prefs.js'.format(path=profile.path), 'r') as f: - _search = re.search(r'browser\.startup\.homepage", "([^"]*)"', f.read(), re.IGNORECASE) - if _search: - homepages = _search.group(1).split('|') - except FileNotFoundError: - pass - - for page in homepages: - print_standard('{indent}{name:<{width}}{page}'.format(indent=' '*(indent+4), width=width-4, name=profile.name, page=page)) - - # IE - homepage = '' - secondary_homepages = [] - key = r'Software\Microsoft\Internet Explorer\Main' - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key) as _key: - homepage = winreg.QueryValueEx(_key, 'Start Page')[0] - try: - secondary_homepages = winreg.QueryValueEx(_key, 'Secondary Start Pages')[0] - except FileNotFoundError: - pass - print_standard('{indent}{browser:<{width}}{page}'.format(indent=' '*indent, width=width, browser='Internet Explorer...', page=homepage)) - for page in secondary_homepages: - print_standard('{indent}{page}'.format(indent=' '*(indent+width), page=page)) - -def reset_google_chrome(): - kill_process('chrome.exe') - chrome_exe = get_chrome_exe() - profiles = get_chrome_profiles() - if len(profiles) == 0: - raise NoProfilesError - - for profile in profiles: - clean_chromium_profile(profile) - -def reset_google_chrome_canary(): - kill_process('chrome.exe') - chrome_canary_exe = get_chrome_canary_exe() - profiles = get_chrome_canary_profiles() - if len(profiles) == 0: - raise NoProfilesError - - for profile in profiles: - clean_chromium_profile(profile) - -def reset_mozilla_firefox(): - kill_process('firefox.exe') - profiles = get_firefox_profiles() - - if len(profiles) == 0: - create_firefox_default_profiles() - kill_process('firefox.exe') - raise NoProfilesError - else: - for profile in profiles: - clean_firefox_profile(profile) - -def reset_opera(): - kill_process('opera.exe') - opera_exe = get_opera_exe() - profiles = get_opera_profile() - if len(profiles) == 0: - raise NoProfilesError - - # Reset browser (Opera only supports one profile) - clean_chromium_profile(profiles[0]) - -def reset_opera_beta(): - kill_process('opera.exe') - opera_beta_exe = get_opera_beta_exe() - profiles = get_opera_beta_profile() - if len(profiles) == 0: - raise NoProfilesError - - # Reset browser (Opera only supports one profile) - clean_chromium_profile(profiles[0]) - -def reset_opera_dev(): - kill_process('opera.exe') - opera_dev_exe = get_opera_dev_exe() - profiles = get_opera_dev_profile() - if len(profiles) == 0: - raise NoProfilesError - - # Reset browser (Opera only supports one profile) - clean_chromium_profile(profiles[0]) - -def set_chrome_as_default(): - chrome_exe = get_chrome_exe() - if chrome_exe is None: - raise NotInstalledError - run_program(chrome_exe, ['--make-default-browser'], check=False) - if global_vars['OS']['Version'] in ['10']: - popen_program('ms-settings:defaultapps') - -# Cleanup -def cleanup_adwcleaner(): - _path = '{SYSTEMDRIVE}\\AdwCleaner'.format(**global_vars['Env']) - if os.path.exists(_path): - os.makedirs('{ClientDir}\\Info'.format(**global_vars), exist_ok=True) - for entry in os.scandir(_path): - if entry.is_file() and re.search(r'*.(log|txt)', entry.name): - _name = re.sub(r'^(.*)\.', '\1_{Date-Time}'.format(**global_vars), entry.name, re.IGNORECASE) - _name = '{ClientDir}\\Info\\{name}'.format(name=_name, **global_vars) - shutil.move(entry.path, non_clobber_rename(_name)) - elif entry.name == 'Quarantine': - os.makedirs(global_vars['QuarantineDir'], exist_ok=True) - _name = '{QuarantineDir}\\AdwCleaner_{Date-Time}'.format(**global_vars) - shutil.move(entry.path, non_clobber_rename(_name)) - shutil.rmtree(_path) - -def cleanup_desktop(): - os.makedirs('{ClientDir}\\Info'.format(**global_vars), exist_ok=True) - if os.path.exists('{USERPROFILE}\\Desktop'.format(**global_vars['Env'])): - for entry in os.scandir('{USERPROFILE}\\Desktop'.format(**global_vars['Env'])): - # JRT, RKill, Shortcut cleaner - if re.search(r'^((JRT|RKill).*|sc-cleaner)', entry.name, re.IGNORECASE): - _name = '{ClientDir}\\Info\\{name}'.format(name=entry.name, **global_vars) - shutil.move(entry.path, non_clobber_rename(_name)) - run_program('rmdir "{path}"'.format(path='{ClientDir}\\Info'.format(**global_vars)), check=False, shell=True) - -def uninstall_eset(): - if 'PROGRAMFILES(X86)' in global_vars['Env']: - _path = '{PROGRAMFILES(X86)}\\ESET'.format(**global_vars['Env']) - else: - _path = '{PROGRAMFILES}\\ESET'.format(**global_vars['Env']) - if os.path.exists('{path}\\ESET Online Scanner'.format(path=_path)): - run_program('"{path}\\ESET Online Scanner\\OnlineScannerUninstaller.exe" -s'.format(path=_path)) - shutil.rmtree('{path}\\ESET Online Scanner'.format(path=_path)) - run_program('rmdir "{path}"'.format(path=_path), check=False) - -def uninstall_mbam(): - # if 'PROGRAMFILES(X86)' in global_vars['Env']: - # _path = '{PROGRAMFILES(X86)}\\Malwarebytes Anti-Malware'.format(**global_vars['Env']) - # else: - # _path = '{PROGRAMFILES}\\Malwarebytes Anti-Malware'.format(**global_vars['Env']) - # if os.path.exists('{path}'.format(path=_path)): - # print_warning('* Malwarebytes Anti-Malware installed.') - # if ask(' Uninstall?'): - # try: - # run_program('"{path}\\unins000.exe" /SILENT'.format(path=_path)) - # run_program('rmdir "{path}"'.format(path=_path), check=False) - # except: - # print_error('ERROR: Failed to uninstall Malwarebytes Anti-Malware.') - pass - -def uninstall_sas(): - # It is always in programfiles (not x86) ?? - _path = '{PROGRAMFILES}\\SUPERAntiSpyware'.format(**global_vars['Env']) - if os.path.exists(_path): - run_program('{path}\\Uninstall.exe'.format(path=_path)) - run_program('rmdir "{path}"'.format(path=_path), check=False) - -# Config -def config_classicstart(): - # User level, not system level - _classicstart = '{PROGRAMFILES}\\Classic Shell\\ClassicStartMenu.exe'.format(**global_vars['Env']) - _skin = '{PROGRAMFILES}\\Classic Shell\\Skins\\Metro-Win10-Black.skin7'.format(**global_vars['Env']) - extract_item('ClassicStartSkin', silent=True) - - # Stop Classic Start - run_program([_classicstart, '-exit'], check=False) - - # Configure - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\IvoSoft\ClassicShell\Settings') - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\IvoSoft\ClassicStartMenu\MRU') - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\IvoSoft\ClassicStartMenu\Settings') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\IvoSoft\ClassicStartMenu', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'ShowedStyle2', 0, winreg.REG_DWORD, 1) - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\IvoSoft\ClassicStartMenu\Settings', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'MenuStyle', 0, winreg.REG_SZ, 'Win7') - winreg.SetValueEx(_key, 'RecentPrograms', 0, winreg.REG_SZ, 'Recent') - winreg.SetValueEx(_key, 'SkipMetro', 0, winreg.REG_DWORD, 1) - - # Enable Win10 theme if on Win10 - if global_vars['OS']['Version'] == '10' and os.path.exists(_skin): - winreg.SetValueEx(_key, 'SkinW7', 0, winreg.REG_SZ, 'Metro-Win10-Black') - winreg.SetValueEx(_key, 'SkinVariationW7', 0, winreg.REG_SZ, '') - - # Pin Google Chrome to Start Menu (Classic) - _source = '{BinDir}\\ClassicStartSkin\\Google Chrome.lnk'.format(**global_vars) - _dest_path = '{APPDATA}\\ClassicShell\\Pinned'.format(**global_vars['Env']) - _dest = '{dest_path}\\Google Chrome.lnk'.format(dest_path=_dest_path) - try: - os.makedirs(_dest_path, exist_ok=True) - shutil.copy(_source, _dest) - except: - pass # Meh, it's fine without - - # (Re)start Classic Start - run_program([_classicstart, '-exit'], check=False) - sleep(1) - kill_process('ClassicStartMenu.exe') - run_program(_classicstart, check=False) - -def config_explorer_system(): - # Disable Telemetry - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection', 0, winreg.KEY_WRITE) - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\DataCollection', 0, winreg.KEY_WRITE) - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'AllowTelemetry', 0, winreg.REG_DWORD, 0) - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Microsoft\Windows\DataCollection', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'AllowTelemetry', 0, winreg.REG_DWORD, 0) - with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) as _key: - winreg.SetValueEx(_key, 'AllowTelemetry', 0, winreg.REG_DWORD, 0) - - # Disable Wi-Fi Sense - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting', 0, winreg.KEY_WRITE) - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots', 0, winreg.KEY_WRITE) - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'Value', 0, winreg.REG_DWORD, 0) - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'Value', 0, winreg.REG_DWORD, 0) - - # Disable Location Tracking - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'SensorPermissionState', 0, winreg.REG_DWORD, 0) - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'System\CurrentControlSet\Services\lfsvc\Service\Configuration', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'Status', 0, winreg.REG_DWORD, 0) - -def config_explorer_user(): - # Disable Cortana - winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Personalization\Settings', 0, winreg.KEY_WRITE) - winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\InputPersonalization', 0, winreg.KEY_WRITE) - winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\InputPersonalization\TrainedDataStore', 0, winreg.KEY_WRITE) - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Personalization\Settings', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'AcceptedPrivacyPolicy', 0, winreg.REG_DWORD, 0) - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\InputPersonalization', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'RestrictImplicitTextCollection', 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(_key, 'RestrictImplicitInkCollection', 0, winreg.REG_DWORD, 1) - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\InputPersonalization\TrainedDataStore', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'HarvestContacts', 0, winreg.REG_DWORD, 1) - - # Hide Search button / box - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Search', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'SearchboxTaskbarMode', 0, winreg.REG_DWORD, 0) - - # Change default Explorer view to "Computer" - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'LaunchTo', 0, winreg.REG_DWORD, 1) - -def update_clock(): - # Set Timezone and sync clock - run_program('tzutil /s "Pacific Standard Time"', check=False) - run_program('net stop w32ime', check=False) - run_program('w32tm /config /syncfromflags:manual /manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"', check=False) - run_program('net start w32ime', check=False) - run_program('w32tm /resync /nowait', check=False) - -# Disk Management and Data Transfers -def cleanup_transfer(): - """Fix permissions and walk through transfer folder (from the bottom) and remove extraneous items.""" - cmd = ['attrib', '-a', '-h', '-r', '-s', global_vars['Data']['Destination']] - run_program(cmd, check=False) - try: - os.rmdir(global_vars['Data']['Destination']) - except: - pass # Should only remove when empty - if os.path.exists(global_vars['Data']['Destination']): - for root, dirs, files in os.walk(global_vars['Data']['Destination'], topdown=False): - for name in dirs: - # Remove empty directories and junction points - try: - os.rmdir(os.path.join(root, name)) - except OSError: - pass - for name in files: - # Remove files based on exclusion regex - if REGEX_EXCL_ITEMS.search(name): - try: - os.remove(os.path.join(root, name)) - except OSError: - pass - -def extract_keys(): - """Extract keys from provided hives and return a dict.""" - keys = {} - - # Extract keys - extract_item('ProduKey', silent=True) - for hive in find_software_hives(): - _cmd = [ - global_vars['Tools']['ProduKey'], - '/IEKeys', '0', - '/WindowsKeys', '1', - '/OfficeKeys', '1', - '/ExtractEdition', '1', - '/nosavereg', - '/regfile', hive, - '/scomma', ''] - _out = run_program(_cmd) - - for line in _out.stdout.decode().splitlines(): - # Add key to keys under product only if unique - _tmp = line.split(',') - _product = _tmp[0] - _key = _tmp[2] - if _product not in keys: - keys[_product] = [] - if _key not in keys[_product]: - keys[_product].append(_key) - - global_vars['Keys'] = keys - -def is_valid_wim_image(item): - _valid = bool(item.is_file() and REGEX_WIM_FILE.search(item.name)) - if _valid: - extract_item('wimlib', silent=True) - try: - _cmd = [global_vars['Tools']['wimlib-imagex'], 'info', item.path] - run_program(_cmd) - except subprocess.CalledProcessError: - _valid = False - print_log('WARNING: Image "{image}" damaged.'.format(image=item.name)) - return _valid - -def mount_backup_shares(): - """Mount the backup shares unless labeled as already mounted.""" - for server in BACKUP_SERVERS: - # Blindly skip if we mounted earlier - if server['Mounted']: - continue - else: - try: - # Test connection - ping_test(server['IP']) - - # Mount - run_program('net use \\\\{IP}\\{Share} /user:{User} {Pass}'.format(**server)) - print_info('Mounted {Name}'.format(**server)) - server['Mounted'] = True - except subprocess.CalledProcessError: - print_error('Failed to mount \\\\{Name}\\{Share}, {IP} unreachable.'.format(**server)) - sleep(1) - except: - print_warning('Failed to mount \\\\{Name}\\{Share} ({IP})'.format(**server)) - sleep(1) - -def run_fast_copy(items=None, dest=None): - if items is None or dest is None: - raise Exception - elif len(items) == 0: - raise Exception - - cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS] - if 'LogFile' in global_vars: - cmd.append('/logfile={LogFile}'.format(**global_vars)) - cmd.extend(items) - cmd.append('/to={dest}\\'.format(dest=dest)) - run_program(cmd) - -def run_wimextract(source=None, items=None, dest=None): - if source is None or items is None or dest is None: - raise Exception - elif len(items) == 0: - raise Exception - extract_item('wimlib', silent=True) - - # Write files.txt - with open('{TmpDir}\\wim_files.txt'.format(**global_vars), 'w') as f: - # Defaults - for item in items: - f.write('{item}\n'.format(item=item)) - sleep(1) # For safety? - - # Extract files - cmd = [ - global_vars['Tools']['wimlib-imagex'], - 'extract', - source, '1', - '@{TmpDir}\\wim_files.txt'.format(**global_vars), - '--dest-dir={dest}\\'.format(dest=dest), - '--no-acls', - '--nullglob'] - run_program(cmd) - -def save_keys(): - key_list = [] - if global_vars['Keys']: - for product in sorted(global_vars['Keys']): - key_list.append(product) - for key in sorted(global_vars['Keys'][product]): - key_list.append(' {key}'.format(key=key)) - else: - key_list.append('No keys found.') - - return key_list - -def scan_backup(): - if 'Source' not in global_vars['Data']: - raise Exception - backup = global_vars['Data']['Source'] - global_vars['Data']['Selected Items'] = [] - - if backup.is_dir(): - # File-Based - print_standard('Scanning File-Based backup: {}'.format(backup.path)) - scan_backup_folder(backup) - else: - # Image-Based - if REGEX_WIM_FILE.search(backup.name): - print_standard('Scanning Image-Based backup: {}'.format(backup.path)) - selected_items = scan_backup_wim(backup) - else: - print_error('ERROR: Unsupported image: {}'.format(backup.path)) - raise GenericError - -def scan_backup_folder(backup_folder=None, rel_path=None, interactive=True): - if backup_folder is None: - raise Exception - win_olds = [] - dest = '{dest}{rel_path}'.format( - dest = global_vars['Data']['Destination'], - rel_path = '' if rel_path is None else '\\'+rel_path) - - # Root items - _items = [] - for item in os.scandir(backup_folder.path): - if REGEX_INCL_ROOT_ITEMS.search(item.name): - _items.append(item.path) - elif not REGEX_EXCL_ROOT_ITEMS.search(item.name): - if (not interactive - or ask('Copy: "{rel_path}{name}" ?'.format(name=item.name, rel_path='' if rel_path is None else rel_path+'\\'))): - _items.append(item.path) - if REGEX_WINDOWS_OLD.search(item.name): - win_olds.append(item) - if len(_items) > 0: - global_vars['Data']['Selected Items'].append({ - 'Message': '{}Root Items...'.format('' if rel_path is None else rel_path+'\\'), - 'Items': _items.copy(), - 'Destination': dest}) - - # Fonts - if os.path.exists('{}\\Windows\\Fonts'.format(backup_folder.path)): - global_vars['Data']['Selected Items'].append({ - 'Message': '{}Fonts...'.format('' if rel_path is None else rel_path+'\\'), - 'Items': ['{}\\Windows\\Fonts'.format(backup_folder.path)], - 'Destination': '{}\\{}'.format(dest, 'Windows')}) - _items.append('{source}\\Windows\\Fonts'.format(source=backup_folder.path)) - - # Registry - _items = [] - if os.path.exists('{}\\Windows\\System32\\config'.format(backup_folder.path)): - _items.append('{}\\Windows\\System32\\config'.format(backup_folder.path)) - if os.path.exists('{}\\Windows\\System32\\OEM'.format(backup_folder.path)): - _items.append('{}\\Windows\\System32\\OEM'.format(backup_folder.path)) - if len(_items) > 0: - global_vars['Data']['Selected Items'].append({ - 'Message': '{}Registry...'.format('' if rel_path is None else rel_path+'\\'), - 'Items': _items.copy(), - 'Destination': '{}\\{}'.format(dest, 'Windows\\System32')}) - - # Windows.old(s) - for old in win_olds: - scan_backup_folder(old.path, rel_path=old.name, interactive=False) - -def scan_backup_wim(backup_file=None, rel_path=None, interactive=True): - if backup_file is None: - raise Exception - if rel_path is None: - rel_path = '' - else: - rel_path = rel_path + '\\' - win_olds = [] - - # Scan source - extract_item('wimlib', silent=True) - _cmd = [ - global_vars['Tools']['wimlib-imagex'], 'dir', - backup_file.path, '1'] - try: - _list = run_program(_cmd) - except subprocess.CalledProcessError as err: - print_error('ERROR: Failed to get file list.') - raise - - # Root Items - _items = [] - root_items = [i.strip() for i in _list.stdout.decode('utf-8', 'ignore').splitlines() if i.count('\\') == 1 and i.strip() != '\\'] - if rel_path: - root_items = [i.replace(rel_path, '') for i in root_items if rel_path in i] - for item in root_items: - if REGEX_INCL_ROOT_ITEMS.search(item): - _items.append(item) - elif not REGEX_EXCL_ROOT_ITEMS.search(item): - if (not interactive - or ask('Extract: "{rel_path}{name}" ?'.format(name=item, rel_path=rel_path))): - _items.append('{}{}'.format(rel_path, item)) - if REGEX_WINDOWS_OLD.search(item): - win_olds.append(item) - if len(_items) > 0: - global_vars['Data']['Selected Items'].append({ - 'Message': '{}Root Items...'.format(rel_path), - 'Items': _items.copy(), - 'Destination': global_vars['Data']['Destination']}) - - # Fonts - if wim_contains(backup_file.path, '{}Windows\\Fonts'.format(rel_path)): - global_vars['Data']['Selected Items'].append({ - 'Message': '{}Fonts...'.format(rel_path), - 'Items': ['{}\\Windows\\Fonts'.format(rel_path)], - 'Destination': global_vars['Data']['Destination']}) - - # Registry - _items = [] - if wim_contains(backup_file.path, '{}Windows\\System32\\config'.format(rel_path)): - _items.append('{}Windows\\System32\\config'.format(rel_path)) - if wim_contains(backup_file.path, '{}Windows\\System32\\OEM'.format(rel_path)): - _items.append('{}Windows\\System32\\OEM'.format(rel_path)) - if len(_items) > 0: - global_vars['Data']['Selected Items'].append({ - 'Message': '{}Registry...'.format(rel_path), - 'Items': _items.copy(), - 'Destination': global_vars['Data']['Destination']}) - - # Windows.old(s) - for old in win_olds: - scan_backup_wim(backup_file, rel_path=old, interactive=False) - -def select_backup(): - """Select backup from those found on the BACKUP_SERVERS for the ticket.""" - sources = [] - mount_backup_shares() - - # Check for ticket folders on servers - for server in BACKUP_SERVERS: - if server['Mounted']: - print_standard('Scanning {server}...'.format(server=server['Name'])) - for d in os.scandir('\\\\{IP}\\{Share}'.format(**server)): - if d.is_dir() and re.match('^{}'.format(global_vars['TicketNumber']), d.name): - # Add folder to sources - sources.append({ - 'Name': '{server:9}| File-Based: [DIR] {ticket}'.format(server=server['Name'], ticket=d.name), - 'Server': server, - 'Source': d}) - - # Check for images and subfolders - for ticket_folder in sources.copy(): - for item in os.scandir(ticket_folder['Source'].path): - if item.is_dir(): - # Add folder to sources - sources.append({ - 'Name': '{server:9}| File-Based: [DIR] {ticket}\\{folder}'.format( - folder = item.name, - server = ticket_folder['Server']['Name'], - ticket = ticket_folder['Source'].name), - 'Server': ticket_folder['Server'], - 'Source': item}) - - # Check for images in folder - for subitem in os.scandir(item.path): - if REGEX_WIM_FILE.search(item.name): - # Add image to sources - try: - size = human_readable_size(item.stat().st_size) - except: - size = ' ? ?' # unknown - sources.append({ - 'Disabled': bool(not is_valid_wim_image(subitem)), - 'Name': '{server:9}| Image-Based: {size:>7} {ticket}\\{folder}\\{image}'.format( - folder = item.name, - image = subitem.name, - server = ticket_folder['Server']['Name'], - size = size, - ticket = ticket_folder['Source'].name), - 'Server': ticket_folder['Server'], - 'Source': subitem}) - elif REGEX_WIM_FILE.search(item.name): - # Add image to sources - try: - size = human_readable_size(item.stat().st_size) - except: - size = ' ? ?' # unknown - sources.append({ - 'Disabled': bool(not is_valid_wim_image(item)), - 'Name': '{server:9}| Image-Based: {size:>7} {ticket}\\{image}'.format( - image = item.name, - server = ticket_folder['Server']['Name'], - size = size, - ticket = ticket_folder['Source'].name), - 'Server': ticket_folder['Server'], - 'Source': item}) - - # Build Menu - sources.sort(key=itemgetter('Name')) - actions = [{'Name': 'Quit', 'Letter': 'Q'}] - - # Select backup from sources - if len(sources) > 0: - selection = menu_select('Which backup are we using?', sources, actions, disabled_label='DAMAGED') - if selection == 'Q': - umount_backup_shares() - exit_script() - else: - global_vars['Data']['Source'] = sources[int(selection)-1]['Source'] - else: - print_error('ERROR: No backups found for ticket: {TicketNumber}.'.format(**global_vars)) - umount_backup_shares() - pause("Press Enter to exit...") - exit_script() - -def select_destination(): - """Select destination for data 1 transfer.""" - disk = select_disk() - path = '{disk}{folder_path}_{Date}'.format( - disk = disk['Disk'].mountpoint, - folder_path = 'WK\\Transfer' if 'fixed' in disk['Disk'].opts else 'WK-Transfer', - **global_vars) - - # Avoid merging with existing transfer - path = non_clobber_rename(path) - os.makedirs(path, exist_ok=True) - - global_vars['Data']['Destination'] = path - -def select_disk(): - """Select disk from attached disks. returns dict.""" - actions = [{'Name': 'Quit', 'Letter': 'Q'}] - disks = [] - for d in psutil.disk_partitions(): - info = { - 'Disk': d, - 'Name': d.mountpoint} - try: - usage = psutil.disk_usage(d.device) - free = '{free} / {total} available'.format( - free = human_readable_size(usage.free, 2), - total = human_readable_size(usage.total, 2)) - except: - # Meh, leaving unsupported destinations out - pass - # free = 'Unknown' - # info['Disabled'] = True - else: - info['Display Name'] = '{disk} ({free})'.format(disk=info['Name'], free=free) - disks.append(info) - - selection = menu_select('Which disk are we transferring to?', disks, actions) - if selection == 'Q': - exit_script() - else: - return disks[int(selection)-1] - -def transfer_backup(): - if 'Source' not in global_vars['Data']: - raise Exception - backup = global_vars['Data']['Source'] - - if backup.is_dir(): - # File-Based - transfer_backup_file_based() - else: - # Image-Based - if REGEX_WIM_FILE.search(backup.name): - transfer_backup_image_based() - else: - print_error('ERROR: Unsupported image: {}'.format(backup.path)) - raise GenericError - -def transfer_backup_file_based(): - if 'Source' not in global_vars['Data'] or 'Selected Items' not in global_vars['Data']: - raise Exception - backup = global_vars['Data']['Source'] - selected_items = global_vars['Data']['Selected Items'] - - # Run FastCopy for each selection "group" - for group in selected_items: - try_and_print(message=group['Message'], function=run_fast_copy, cs='Done', items=group['Items'], dest=group['Destination']) - -def transfer_backup_image_based(): - if 'Source' not in global_vars['Data'] or 'Selected Items' not in global_vars['Data']: - raise Exception - backup = global_vars['Data']['Source'] - selected_items = global_vars['Data']['Selected Items'] - - # Run wimlib-imagex for each selection "group" - for group in selected_items: - try_and_print(message=group['Message'], function=run_wimextract, cs='Done', source=global_vars['Data']['Source'].path, items=group['Items'], dest=group['Destination']) - -def umount_backup_shares(): - """Unnount the backup shares regardless of current status.""" - for server in BACKUP_SERVERS: - try: - # Umount - run_program('net use \\\\{IP}\\{Share} /delete'.format(**server)) - print_info('Umounted {Name}'.format(**server)) - server['Mounted'] = False - except: - print_error('Failed to umount \\\\{Name}\\{Share}.'.format(**server)) - sleep(1) - -def wim_contains(source_path=None, file_path=None): - if file_path is None or source_path is None: - raise Exception - - _cmd = [ - global_vars['Tools']['wimlib-imagex'], 'dir', - '{source}'.format(source=source_path), '1', - '--path={}'.format(file_path), - '--one-file-only'] - try: - run_program(_cmd) - except subprocess.CalledProcessError: - return False - else: - return True - -# Kit Updates -def download_file(out_dir, out_name, source_url): - """Downloads a file using curl.""" - extract_item('curl', silent=True) - _cmd = [ - global_vars['Tools']['curl'], - # '-#LSfo', # ProgressBar - '-Lfso', - '{out_dir}/{out_name}'.format(out_dir=out_dir, out_name=out_name), - source_url] - os.makedirs(out_dir, exist_ok=True) - run_program(_cmd, pipe=False) - -def resolve_dynamic_url(source_url, regex): - """Download the "download page" and scan for a url using the regex provided; returns str.""" - # Download the "download page" - extract_item('curl', silent=True) - _tmp_file = '{TmpDir}/webpage.tmp'.format(**global_vars) - _cmd = [ - global_vars['Tools']['curl'], - '-#LSfo', - _tmp_file, - source_url] - try: - run_program(_cmd) - except: - # "Fail silently as the download_file() function will catch it - return None - - # Scan the file for the regex - with open(_tmp_file, 'r') as file: - for line in file: - if re.search(regex, line): - _url = line.strip() - _url = re.sub(r'.*(a |)href="([^"]+)".*', r'\2', _url) - _url = re.sub(r".*(a |)href='([^']+)'.*", r'\2', _url) - break - - # Cleanup and return - os.remove(_tmp_file) - return _url - -def update_adwcleaner(): - _path = global_vars['BinDir'] - _name = 'AdwCleaner.exe' - _dl_page = 'http://www.bleepingcomputer.com/download/adwcleaner/dl/125/' - _regex = r'href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/a/adwcleaner/AdwCleaner\.exe' - _url = resolve_dynamic_url(_dl_page, _regex) - download_file(_path, _name, _url) - -def update_eset(): - _path = global_vars['BinDir'] - _name = 'ESET.exe' - _url = 'http://download.eset.com/special/eos/esetsmartinstaller_enu.exe' - download_file(_path, _name, _url) - -def update_jrt(): - _path = global_vars['BinDir'] - _name = 'JRT.exe' - _url = 'http://downloads.malwarebytes.org/file/jrt' - download_file(_path, _name, _url) - -def update_kvrt(): - _path = global_vars['BinDir'] - _name = 'KVRT.exe' - _url = 'http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe' - download_file(_path, _name, _url) - -def update_hitmanpro(): - _path = '{BinDir}/HitmanPro'.format(**global_vars) - _name = 'HitmanPro.exe' - _url = 'http://dl.surfright.nl/HitmanPro.exe' - download_file(_path, _name, _url) - - _name = 'HitmanPro64.exe' - _url = 'http://dl.surfright.nl/HitmanPro_x64.exe' - download_file(_path, _name, _url) - -def update_intel_driver_utility(): - _path = '{BinDir}/_Drivers'.format(**global_vars) - _name = 'Intel Driver Update Utility.exe' - _dl_page = 'http://www.intel.com/content/www/us/en/support/detect.html' - _regex = r'a href.*http(s|)://downloadmirror\.intel\.com/[a-zA-Z0-9]+/[a-zA-Z0-9]+/Intel%20Driver%20Update%20Utility%20Installer.exe' - _url = resolve_dynamic_url(_dl_page, _regex) - _url = resolve_dynamic_url(_dl_page, _regex) - download_file(_path, _name, _url) - -def update_intel_ssd_toolbox(): - _path = '{BinDir}/_Drivers'.format(**global_vars) - _name = 'Intel SSD Toolbox.exe' - _dl_page = 'https://downloadcenter.intel.com/download/26085/Intel-Solid-State-Drive-Toolbox' - _regex = r'href=./downloads/eula/[0-9]+/Intel-Solid-State-Drive-Toolbox.httpDown=https\%3A\%2F\%2Fdownloadmirror\.intel\.com\%2F[0-9]+\%2Feng\%2FIntel\%20SSD\%20Toolbox\%20-\%20v[0-9\.]+.exe' - _url = resolve_dynamic_url(_dl_page, _regex) - _url = re.sub(r'.*httpDown=(.*)', r'\1', _url, flags=re.IGNORECASE) - _url = _url.replace('%3A', ':') - _url = _url.replace('%2F', '/') - download_file(_path, _name, _url) - -def update_rkill(): - _path = '{BinDir}/RKill'.format(**global_vars) - _name = 'RKill.exe' - _dl_page = 'http://www.bleepingcomputer.com/download/rkill/dl/10/' - _regex = r'href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/r/rkill/rkill\.exe' - _url = resolve_dynamic_url(_dl_page, _regex) - download_file(_path, _name, _url) - -def update_samsung_magician(): - print_warning('Disabled.') - #~Broken~# _path = '{BinDir}/_Drivers'.format(**global_vars) - #~Broken~# _name = 'Samsung Magician.zip' - #~Broken~# _dl_page = 'http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html' - #~Broken~# _regex = r'href=./semiconductor/minisite/ssd/downloads/software/Samsung_Magician_Setup_v[0-9]+.zip' - #~Broken~# _url = resolve_dynamic_url(_dl_page, _regex) - #~Broken~# # Convert relative url to absolute - #~Broken~# _url = 'http://www.samsung.com' + _url - #~Broken~# download_file(_path, _name, _url) - #~Broken~# # Extract and replace old copy - #~Broken~# _args = [ - #~Broken~# 'e', '"{BinDir}/_Drivers/Samsung Magician.zip"'.format(**global_vars), - #~Broken~# '-aoa', '-bso0', '-bsp0', - #~Broken~# '-o"{BinDir}/_Drivers"'.format(**global_vars) - #~Broken~# ] - #~Broken~# run_program(seven_zip, _args) - #~Broken~# try: - #~Broken~# os.remove('{BinDir}/_Drivers/Samsung Magician.zip'.format(**global_vars)) - #~Broken~# #~PoSH~# Move-Item "$bin\_Drivers\Samsung*exe" "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null - #~Broken~# except: - #~Broken~# pass - pass - -def update_sysinternalssuite(): - _path = '{BinDir}/tmp'.format(**global_vars) - _name = 'SysinternalsSuite.zip' - _url = 'https://download.sysinternals.com/files/SysinternalsSuite.zip' - download_file(_path, _name, _url) - # Extract - _args = [ - 'e', '"{BinDir}/tmp/SysinternalsSuite.zip"'.format(**global_vars), - '-aoa', '-bso0', '-bsp0', - '-o"{BinDir}/SysinternalsSuite"'.format(**global_vars)] - run_program(seven_zip, _args) - try: - os.remove('{BinDir}/tmp/SysinternalsSuite.zip'.format(**global_vars)) - except: - pass - -def update_tdsskiller(): - _path = global_vars['BinDir'] - _name = 'TDSSKiller.exe' - _url = 'http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe' - download_file(_path, _name, _url) - -# Installations -def install_adobe_reader(): - cmd = [ - '{BaseDir}/Installers/Extras/Office/Adobe Reader DC.exe'.format(**global_vars), - '/sAll', - '/msi', '/norestart', '/quiet', - 'ALLUSERS=1', - 'EULA_ACCEPT=YES'] - try_and_print(message='Adobe Reader DC...', function=run_program, cmd=cmd) - -def install_chrome_extensions(): - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Google\Chrome\Extensions', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Google\Chrome\Extensions\cjpalhdlnbpafiamejdnhcphjbkeiagm', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) - with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Google\Chrome\Extensions\cjpalhdlnbpafiamejdnhcphjbkeiagm', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) as _key: - winreg.SetValueEx(_key, 'update_url', 0, winreg.REG_SZ, 'https://clients2.google.com/service/update2/crx') - winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Google\Chrome\Extensions\pgdnlhfefecpicbbihgmbmffkjpaplco', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) - with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Google\Chrome\Extensions\pgdnlhfefecpicbbihgmbmffkjpaplco', 0, winreg.KEY_WRITE | winreg.KEY_WOW64_32KEY) as _key: - winreg.SetValueEx(_key, 'update_url', 0, winreg.REG_SZ, 'https://clients2.google.com/service/update2/crx') - -def install_classicstart_skin(): - if global_vars['OS']['Version'] not in ['8', '10']: - raise UnsupportedOSError - extract_item('ClassicStartSkin', silent=True) - _source = '{BinDir}\\ClassicStartSkin\\Metro-Win10-Black.skin7'.format(**global_vars) - _dest_path = '{PROGRAMFILES}\\Classic Shell\\Skins'.format(**global_vars['Env']) - _dest = '{dest_path}\\Metro-Win10-Black.skin7'.format(dest_path=_dest_path) - os.makedirs(_dest_path, exist_ok=True) - shutil.copy(_source, _dest) - -def install_firefox_extensions(): - extract_item('FirefoxExtensions', silent=True) - extensions = ['uBlock0@raymondhill.net'] - dests = ['{PROGRAMFILES}\\Mozilla Firefox\\distribution\\extensions'.format(**global_vars['Env'])] - if 'PROGRAMFILES(X86)' in global_vars['Env']: - dests.append('{PROGRAMFILES(X86)}\\Mozilla Firefox\\distribution\\extensions'.format(**global_vars['Env'])) - for extension in extensions: - _source = '{BinDir}\\FirefoxExtensions\\{extension}'.format(extension=extension, **global_vars) - for dest in dests: - _dest = '{}\\{}'.format(dest, extension) - if not os.path.exists(dest): - shutil.copytree(_source, _dest) - -def install_ninite_bundle(mse=False): - if global_vars['OS']['Version'] in ['8', '10']: - # Modern selection - popen_program('{BaseDir}/Installers/Extras/Bundles/Modern.exe'.format(**global_vars)) - else: - # Legacy selection - if mse: - popen_program('{BaseDir}/Installers/Extras/Security/Microsoft Security Essentials.exe'.format(**global_vars)) - popen_program('{BaseDir}/Installers/Extras/Bundles/Legacy.exe'.format(**global_vars)) - -def install_vcredists(): - extract_item('_vcredists', silent=True) - prev_dir = os.getcwd() - os.chdir('{BinDir}/_vcredists'.format(**global_vars)) - for vcr in VCR_REDISTS: - try_and_print(message=vcr['Name'], function=run_program, cmd=vcr['Cmd']) - - os.chdir(prev_dir) - -# Network -def check_connection(): - while True: - result = try_and_print(message='Ping test...', function=ping_test, cs='OK') - if result['CS']: - break - else: - if not ask('ERROR: System appears offline, try again?'): - abort() - -def ping_test(addr='google.com'): - """Attempt to ping addr and if unsuccessful either retry or abort.""" - _cmd = ['ping', '-n', '2', addr] - run_program(_cmd) - -# OSR / VR -def run_autoruns(): - """Run AutoRuns in the background with VirusTotal checks enabled.""" - extract_item('SysinternalsSuite', filter='autoruns*', silent=True) - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'checkvirustotal', 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(_key, 'shownomicrosoft', 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(_key, 'shownowindows', 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(_key, 'showonlyvirustotal', 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(_key, 'submitvirustotal', 0, winreg.REG_DWORD, 0) - winreg.SetValueEx(_key, 'verifysignatures', 0, winreg.REG_DWORD, 1) - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\SigCheck') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\SigCheck', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\Streams') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\Streams', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\VirusTotal') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\VirusTotal', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'VirusTotalTermsAccepted', 0, winreg.REG_DWORD, 1) - popen_program(global_vars['Tools']['AutoRuns'], minimized=True) - -def run_chkdsk(): - """Run CHKDSK in a "split window" and report errors.""" - if global_vars['OS']['Version'] in ['8', '10']: - _cmd = [ - 'chkdsk', - '{SYSTEMDRIVE}'.format(**global_vars['Env']), - '/scan', '/perf'] - else: - _cmd = [ - 'chkdsk', - '{SYSTEMDRIVE}'.format(**global_vars['Env'])] - _out = run_program(_cmd, check=False) - # retcode == 0: no issues - # retcode == 1: fixed issues (also happens when chkdsk.exe is killed?) - # retcode == 2: issues - if int(_out.returncode) > 0: - # print_error(' ERROR: CHKDSK encountered errors') - raise GenericError - - # Save stderr - with open('{LogDir}\\CHKDSK.err'.format(**global_vars), 'a') as f: - for line in _out.stderr.decode().splitlines(): - f.write(line.strip() + '\n') - # Save stdout - with open('{LogDir}\\CHKDSK.log'.format(**global_vars), 'a') as f: - for line in _out.stdout.decode().splitlines(): - f.write(line.strip() + '\n') - -def run_chkdsk_offline(): - """Set filesystem 'dirty bit' to force a chkdsk during next boot.""" - _cmd = [ - 'fsutil', 'dirty', 'set', - '{SYSTEMDRIVE}'.format(**global_vars['Env'])] - _out = run_program(_cmd, check=False) - if int(_out.returncode) > 0: - raise GenericError - -def run_chkdsk_spotfix(): - """Run CHKDSK in a "split window" and report errors.""" - if global_vars['OS']['Version'] in ['8', '10']: - _cmd = [ - 'chkdsk', - '{SYSTEMDRIVE}'.format(**global_vars['Env']), - '/scan', '/perf'] - else: - raise UnsupportedOSError - _out = run_program(_cmd, check=False) - # retcode == 0: no issues - # retcode == 1: fixed issues (also happens when chkdsk.exe is killed?) - # retcode == 2: issues - if int(_out.returncode) > 0: - # print_error(' ERROR: CHKDSK encountered errors') - raise GenericError - - # Save stderr - with open('{LogDir}\\CHKDSK_Spotfix.err'.format(**global_vars), 'a') as f: - for line in _out.stderr.decode().splitlines(): - f.write(line.strip() + '\n') - # Save stdout - with open('{LogDir}\\CHKDSK_Spotfix.log'.format(**global_vars), 'a') as f: - for line in _out.stdout.decode().splitlines(): - f.write(line.strip() + '\n') - -def run_dism_restore_health(): - """Run DISM /ScanHealth, then /CheckHealth, and then report errors.""" - if global_vars['OS']['Version'] in ['8', '10']: - # Scan Health - _cmd = [ - 'DISM', '/Online', '/Cleanup-Image', '/RestoreHealth', - '/LogPath:"{LogDir}\\DISM_RestoreHealth.log"'.format(**global_vars), - '-new_console:n', '-new_console:s33V'] - run_program(_cmd, pipe=False, check=False, shell=True) - wait_for_process('dism') - # Now check health - _cmd = [ - 'DISM', '/Online', '/Cleanup-Image', '/CheckHealth', - '/LogPath:"{LogDir}\\DISM_CheckHealth.log"'.format(**global_vars)] - _result = run_program(_cmd, shell=True).stdout.decode() - # Check result - if re.search(r'No component store corruption detected', _result, re.IGNORECASE): - pass - else: - raise GenericError - else: - raise UnsupportedOSError - -def run_dism_scan_health(): - """Run DISM /ScanHealth, then /CheckHealth, and then report errors.""" - if global_vars['OS']['Version'] in ['8', '10']: - # Scan Health - _cmd = [ - 'DISM', '/Online', '/Cleanup-Image', '/ScanHealth', - '/LogPath:"{LogDir}\\DISM_ScanHealth.log"'.format(**global_vars), - '-new_console:n', '-new_console:s33V'] - run_program(_cmd, pipe=False, check=False, shell=True) - wait_for_process('dism') - # Now check health - _cmd = [ - 'DISM', '/Online', '/Cleanup-Image', '/CheckHealth', - '/LogPath:"{LogDir}\\DISM_CheckHealth.log"'.format(**global_vars)] - _result = run_program(_cmd, shell=True).stdout.decode() - # Check result - if re.search(r'No component store corruption detected', _result, re.IGNORECASE): - pass - else: - raise GenericError - else: - raise UnsupportedOSError - -def run_hitmanpro(): - """Run HitmanPro in the background.""" - extract_item('HitmanPro', silent=True) - _cmd = [ - global_vars['Tools']['HitmanPro'], - '/quiet', '/noinstall', '/noupload', - '/log={LogDir}\\hitman.xml'.format(**global_vars)] - popen_program(_cmd) - -def run_kvrt(): - """Run KVRT.""" - extract_item('KVRT', silent=True) - os.makedirs(global_vars['QuarantineDir'], exist_ok=True) - _cmd = [ - global_vars['Tools']['KVRT'], - '-accepteula', '-dontcryptsupportinfo', '-fixednames', - '-d', global_vars['QuarantineDir'], - '-processlevel', '3'] - popen_program(_cmd, pipe=False) - -def run_process_killer(): - """Kill most running processes skipping those in the whitelist.txt.""" - # borrowed from TronScript (reddit.com/r/TronScript) and credit to /u/cuddlychops06 - _prev_dir = os.getcwd() - extract_item('ProcessKiller', silent=True) - os.chdir('{BinDir}\\ProcessKiller'.format(**global_vars)) - run_program(['ProcessKiller.exe', '/silent'], check=False) - os.chdir(_prev_dir) - -def run_rkill(): - """Run RKill and cleanup afterwards.""" - extract_item('RKill', silent=True) - _cmd = [ - global_vars['Tools']['RKill'], - '-l', '{LogDir}\\RKill.log'.format(**global_vars), - '-new_console:n', '-new_console:s33V'] - run_program(_cmd, check=False) - wait_for_process('RKill') - kill_process('notepad.exe') - - # RKill cleanup - if os.path.exists('{USERPROFILE}\\Desktop'.format(**global_vars['Env'])): - for item in os.scandir('{USERPROFILE}\\Desktop'.format(**global_vars['Env'])): - if re.search(r'^RKill', item.name, re.IGNORECASE): - _name = re.sub(r'^(.*)\.', '\1_{Date-Time}'.format(**global_vars), item.name, re.IGNORECASE) - _name = '{ClientDir}\\Info\\{name}'.format(name=_name, **global_vars) - shutil.move(item.path, non_clobber_rename(_name)) - -def run_sfc_scan(): - """Run SFC in a "split window" and report errors.""" - _cmd = [ - '{SYSTEMROOT}\\System32\\sfc.exe'.format(**global_vars['Env']), - '/scannow'] - _out = run_program(_cmd, check=False) - # Save stderr - with open('{LogDir}\\SFC.err'.format(**global_vars), 'a') as f: - for line in _out.stderr.decode('utf-8', 'ignore').splitlines(): - f.write(line.strip() + '\n') - # Save stdout - with open('{LogDir}\\SFC.log'.format(**global_vars), 'a') as f: - for line in _out.stdout.decode('utf-8', 'ignore').splitlines(): - f.write(line.strip() + '\n') - # Check result - log_text = _out.stdout.decode('utf-8', 'ignore').replace('\0', '') - if re.findall(r'did\s+not\s+find\s+any\s+integrity\s+violations', log_text): - pass - elif re.findall(r'successfully\s+repaired\s+them', log_text): - raise GenericRepair - else: - raise GenericError - -def run_tdsskiller(): - """Run TDSSKiller.""" - extract_item('TDSSKiller', silent=True) - os.makedirs('{QuarantineDir}\\TDSSKiller'.format(**global_vars), exist_ok=True) - _cmd = [ - global_vars['Tools']['TDSSKiller'], - '-l', '{LogDir}\\TDSSKiller.log'.format(**global_vars), - '-qpath', '{QuarantineDir}\\TDSSKiller'.format(**global_vars), - '-accepteula', '-accepteulaksn', - '-dcexact', '-tdlfs'] - run_program(_cmd, pipe=False) - -# Windows Activation -def activate_windows_with_bios(): - """Attempt to activate Windows with a key stored in the BIOS.""" - # Code borrowed from https://github.com/aeruder/get_win8key - ##################################################### - #script to query windows 8.x OEM key from PC firmware - #ACPI -> table MSDM -> raw content -> byte offset 56 to end - #ck, 03-Jan-2014 (christian@korneck.de) - ##################################################### - bios_key = None - table = b"MSDM" - if acpi.FindAcpiTable(table) is True: - rawtable = acpi.GetAcpiTable(table) - #http://msdn.microsoft.com/library/windows/hardware/hh673514 - #byte offset 36 from beginning = Microsoft 'software licensing data structure' / 36 + 20 bytes offset from beginning = Win Key - bios_key = rawtable[56:len(rawtable)].decode("utf-8") - else: - raise Exception('ACPI table {} not found.'.format(str(table))) - if bios_key is None: - raise BIOSKeyNotFoundError - - # Install Key - run_program('cscript {SYSTEMROOT}\\System32\\slmgr.vbs /ipk {pkey} //nologo'.format(**global_vars['Env'], pkey=bios_key), check=False) - sleep(5) - - # Attempt activation - run_program('cscript {SYSTEMROOT}\\System32\\slmgr.vbs /ato //nologo'.format(**global_vars['Env']), check=False) - sleep(5) - - # Check status - if not windows_is_activated(): - raise Exception('Activation Failed') - -def update_windows_activation_status(): - if not re.search(r'(permanent|safe mode)', global_vars['OS']['Activation'], re.IGNORECASE): - _out = run_program('cscript /nologo {SYSTEMROOT}\\System32\\slmgr.vbs /xpr'.format(**global_vars['Env'])) - _out = _out.stdout.decode().splitlines() - _out = [l for l in _out if re.match(r'^\s', l)] - if len(_out) > 0: - global_vars['OS']['Activation'] = re.sub(r'^\s+', '', _out[0]) - else: - global_vars['OS']['Activation'] = 'Activation status unknown' - -def windows_is_activated(): - """Updates activation status, checks if activated, and returns a bool.""" - update_windows_activation_status() - return re.search(r'permanent', global_vars['OS']['Activation'], re.IGNORECASE) - -# System Info -def backup_file_list(): - """Export current file listing for the system.""" - extract_item('Everything', silent=True) - _cmd = [ - global_vars['Tools']['Everything'], - '-nodb', - '-create-filelist', - '{LogDir}\\File List.txt'.format(**global_vars), - '{SYSTEMDRIVE}'.format(**global_vars['Env'])] - run_program(_cmd) - -def backup_power_plans(): - """Export current power plans.""" - os.makedirs('{BackupDir}\\Power Plans'.format(**global_vars), exist_ok=True) - _plans = run_program('powercfg /L') - _plans = _plans.stdout.decode().splitlines() - _plans = [p for p in _plans if re.search(r'^Power Scheme', p)] - for p in _plans: - _guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p) - _name = re.sub(r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p) - # print(' {name} ({guid})'.format(guid=_guid, name=_name)) - _out = '{BackupDir}\\Power Plans\\{name}.pow'.format(name=_name, **global_vars) - if not os.path.exists(_out): - _cmd = ['powercfg', '-export', _out, _guid] - run_program(_cmd, check=False) - -def backup_registry(): - extract_item('erunt', silent=True) - _args = [ - '{LogDir}\\Registry'.format(**global_vars), - 'sysreg', - 'curuser', - 'otherusers', - '/noprogresswindow'] - run_program(global_vars['Tools']['ERUNT'], _args) - -def compress_info(): - path = '{ClientDir}'.format(**global_vars) - file = 'Info_{Date-Time}.7z'.format(**global_vars) - _cmd = [ - global_vars['Tools']['SevenZip'], - 'a', '-t7z', '-mx=9', '-bso0', '-bse0', - '{path}\\{file}'.format(path=path, file=file), - '{ClientDir}\\Info'.format(**global_vars)] - run_program(_cmd) - -def find_software_hives(): - """Search for transferred SW hives and return a list.""" - hives = [] - search_paths = [global_vars['ClientDir']] - - while len(search_paths) > 0: - for item in os.scandir(search_paths.pop(0)): - if item.is_dir() and REGEX_REGISTRY_DIRS.search(item.name): - search_paths.append(item.path) - if item.is_file() and REGEX_SOFTWARE_HIVE.search(item.name): - hives.append(item.path) - - return hives - -def get_installed_office(): - programs = [] - with open ('{LogDir}\\Installed Program List (AIDA64).txt'.format(**global_vars), 'r') as f: - for line in sorted(f.readlines()): - if REGEX_OFFICE.search(line): - programs.append(line[4:82].strip()) - - if len(programs) == 0: - programs = ['No programs found'] - return programs - -def get_product_keys(): - keys = [] - - with open ('{LogDir}\\Product Keys (ProduKey).txt'.format(**global_vars), 'r') as f: - for line in f.readlines(): - if re.search(r'^Product Name', line): - line = re.sub(r'^Product Name\s+:\s+(.*)', r'\1', line.strip()) - keys.append(line) - - if len(keys) == 0: - keys = ['No product keys found'] - return keys - -def get_user_data_size_info(all_users=True, indent=8, width=32): - """Get size of user folders for all users and return a dict of dicts.""" - users = {} - TMP_HIVE_PATH = 'HKU\\wk_tmp' - # Extract and configure du - extract_item('SysinternalsSuite', filter='du*', silent=True) - winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\Du') - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\Du', access=winreg.KEY_WRITE) as _key: - winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) - - try: - # Get SIDs - if all_users: - out = run_program('wmic useraccount get sid') - else: - out = run_program('wmic useraccount where name="{USERNAME}" get sid'.format(**global_vars['Env'])) - sids = out.stdout.decode().splitlines() - sids = [s.strip() for s in sids if re.search(r'-1\d+$', s.strip())] - - # Get Usernames and add to _users - for sid in sids: - try: - out = run_program('wmic useraccount where sid="{sid}" get name'.format(sid=sid)) - name = out.stdout.decode().splitlines()[2].strip() - users[name] = {'Extra Folders': {}, 'Shell Folders': {}, 'SID': sid} - except: - # Just skip problem users - pass - except subprocess.CalledProcessError: - # This results in an empty dict being returned, leaving it to the calling section to handle that case - pass - - # Use username/SID pairs to check profile folder sizes - for u in users.keys(): - try: - # Main Profile path - key = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\{SID}'.format(**users[u]) - with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key) as _key: - users[u]['ProfileImagePath'] = winreg.QueryValueEx(_key, 'ProfileImagePath')[0] - try: - out = run_program(global_vars['Tools']['Du'], ['-nobanner', '-q', users[u]['ProfileImagePath']]) - size = out.stdout.decode().splitlines()[4] - size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) - size = size.replace(',', '') - size = human_readable_size(size) - size_str = '{indent}{folder:<{width}}{size:>6} ({path})'.format( - indent = ' ' * indent, - width = width, - folder = 'Profile', - size = size, - path = users[u]['ProfileImagePath']) - users[u]['ProfileSize'] = size_str - except subprocess.CalledProcessError: - # Failed to get folder size - pass - - # Check if user hive is already loaded - unload_hive = False - try: - # This tests if the user hive is already loaded and throws FileNotFoundError if not. - winreg.QueryValue(winreg.HKEY_USERS, users[u]['SID']) - except FileNotFoundError: - # User not logged-in. Loading hive and setting unload_hive so it will be unloaded before the script exits. - try: - _cmd = 'reg load {tmp_path} "{ProfileImagePath}\\NTUSER.DAT"'.format(tmp_path=TMP_HIVE_PATH, **users[u]) - run_program(_cmd) - unload_hive = True - except subprocess.CalledProcessError: - # Failed to load user hive - pass - - # Get Shell folder sizes - key = r'{SID}\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'.format(**users[u]) - try: - with winreg.OpenKey(winreg.HKEY_USERS, key) as _key: - for folder in SHELL_FOLDERS.keys(): - for value in SHELL_FOLDERS[folder]: - try: - # Query value and break out of for look if successful - folder_path = winreg.QueryValueEx(_key, value)[0] - try: - # Finally calculate folder size - out = run_program(global_vars['Tools']['Du'], ['-nobanner', '-q', folder_path]) - size = out.stdout.decode().splitlines()[4] - size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) - size = size.replace(',', '') - size = human_readable_size(size) - str = '{indent}{folder:<{width}}{size:>6} ({path})'.format( - indent = ' ' * indent, - width = width, - folder = folder, - size = size, - path = folder_path) - users[u]['Shell Folders'][folder] = str - except subprocess.CalledProcessError: - # Failed to get folder size - pass - break - except FileNotFoundError: - # Failed to query value above - pass - except FileNotFoundError: - # Can't read the user hive, skipping this user. - pass - - # Extra shell folder check - for folder in SHELL_FOLDERS.keys(): - if folder not in users[u]['Shell Folders']: - folder_path = '{ProfileImagePath}\\{folder}'.format(folder=folder, **users[u]) - if os.path.exists(folder_path): - try: - out = run_program(global_vars['Tools']['Du'], ['-nobanner', '-q', folder_path]) - size = out.stdout.decode().splitlines()[4] - size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) - size = size.replace(',', '') - size = human_readable_size(size) - str = '{indent}{folder:<{width}}{size:>6} ({path})'.format( - indent = ' ' * indent, - width = width, - folder = folder, - size = size, - path = folder_path) - users[u]['Shell Folders'][folder] = str - except subprocess.CalledProcessError: - # Failed to get folder size - pass - - # Extra folder sizes - for folder in EXTRA_FOLDERS: - folder_path = '{ProfileImagePath}\\{folder}'.format(folder=folder, **users[u]) - if os.path.exists(folder_path): - try: - out = run_program(global_vars['Tools']['Du'], ['-nobanner', '-q', folder_path]) - size = size.stdout.decode().splitlines()[4] - size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) - size = size.replace(',', '') - size = human_readable_size(size) - str = '{indent}{folder:<{width}}{size:>6} ({path})'.format( - indent = ' ' * indent, - width = width, - folder = folder, - size = size, - path = folder_path) - users[u]['Extra Folders'][folder] = str - except subprocess.CalledProcessError: - # Failed to get folder size - pass - # Unload user hive (if necessary) - if unload_hive: - _cmd = 'reg unload {tmp_path}'.format(tmp_path=TMP_HIVE_PATH) - run_program(_cmd, check=False) - - except FileNotFoundError: - # Can't find the ProfileImagePath, skipping this user. - pass - except: - # Unload the wk_tmp hive no matter what - _cmd = 'reg unload {tmp_path}'.format(tmp_path=TMP_HIVE_PATH) - run_program(_cmd, check=False) - # Done - return users - -def run_aida64(): - extract_item('AIDA64', silent=True) - # All system info - if not os.path.exists('{LogDir}\\System Information (AIDA64).html'.format(**global_vars)): - _cmd = [ - global_vars['Tools']['AIDA64'], - '/R', '{LogDir}\\System Information (AIDA64).html'.format(**global_vars), - '/CUSTOM', '{BinDir}\\AIDA64\\full.rpf'.format(**global_vars), - '/HTML', '/SILENT', '/SAFEST'] - run_program(_cmd, check=False) - - # Installed Programs - if not os.path.exists('{LogDir}\\Installed Program List (AIDA64).txt'.format(**global_vars)): - _cmd = [ - global_vars['Tools']['AIDA64'], - '/R', '{LogDir}\\Installed Program List (AIDA64).txt'.format(**global_vars), - '/CUSTOM', '{BinDir}\\AIDA64\\installed_programs.rpf'.format(**global_vars), - '/TEXT', '/SILENT', '/SAFEST'] - run_program(_cmd, check=False) - - # Product Keys - if not os.path.exists('{LogDir}\\Product Keys (AIDA64).txt'.format(**global_vars)): - _cmd = [ - global_vars['Tools']['AIDA64'], - '/R', '{LogDir}\\Product Keys (AIDA64).txt'.format(**global_vars), - '/CUSTOM', '{BinDir}\\AIDA64\\licenses.rpf'.format(**global_vars), - '/TEXT', '/SILENT', '/SAFEST'] - run_program(_cmd, check=False) - -def run_bleachbit(): - if not os.path.exists('{LogDir}\\BleachBit.log'.format(**global_vars)): - extract_item('BleachBit', silent=True) - _cmd = [global_vars['Tools']['BleachBit'], '--preview', '--preset'] - _out = run_program(_cmd, check=False) - # Save stderr - if len(_out.stderr.decode().splitlines()) > 0: - with open('{LogDir}\\BleachBit.err'.format(**global_vars), 'a') as f: - for line in _out.stderr.decode().splitlines(): - f.write(line.strip() + '\n') - # Save stdout - with open('{LogDir}\\BleachBit.log'.format(**global_vars), 'a') as f: - for line in _out.stdout.decode().splitlines(): - f.write(line.strip() + '\n') - -def run_hwinfo_sensors(): - _path = '{BinDir}\\HWiNFO'.format(**global_vars) - for bit in [32, 64]: - # Configure - _source = '{path}\\general.ini'.format(path=_path) - _dest = '{path}\\HWiNFO{bit}.ini'.format(bit=bit, path=_path) - shutil.copy(_source, _dest) - with open(_dest, 'a') as f: - f.write('SensorsOnly=1\n') - f.write('SummaryOnly=0\n') - popen_program(global_vars['Tools']['HWiNFO']) - -def run_produkey(): - extract_item('ProduKey', silent=True) - if not os.path.exists('{LogDir}\\Product Keys (ProduKey).txt'.format(**global_vars)): - # Clear current configuration - for config in ['ProduKey.cfg', 'ProduKey64.cfg']: - try: - if os.path.exists('{BinDir}\\ProduKey\\{config}'.format(config=config, **global_vars)): - os.remove('{BinDir}\\ProduKey\\{config}'.format(config=config, **global_vars)) - except: - pass - _cmd = [ - global_vars['Tools']['ProduKey'], '/nosavereg', - '/stext', '{LogDir}\\Product Keys (ProduKey).txt'.format(**global_vars)] - run_program(_cmd, check=False) - -def run_xmplay(): - extract_item('XMPlay', silent=True) - popen_program([global_vars['Tools']['XMPlay'], '{BinDir}\\XMPlay\\music.7z'.format(**global_vars)]) - -def show_disk_usage(disk=None): - if disk is None: - raise Exception - print_standard(disk.device.replace('\\', ' '), end='', flush=True, timestamp=False) - try: - usage = psutil.disk_usage(disk.device) - display_string = '{percent:>5.2f}% Free ({free} / {total})'.format( - percent = 100 - usage.percent, - free = human_readable_size(usage.free, 2), - total = human_readable_size(usage.total, 2)) - if usage.percent > 85: - print_error(display_string, timestamp=False) - elif usage.percent > 75: - print_warning(display_string, timestamp=False) - else: - print_standard(display_string, timestamp=False) - except: - print_warning('Unknown', timestamp=False) - -def show_free_space(): - """Show free space info for all fixed disks.""" - message = 'Free Space:' - for disk in psutil.disk_partitions(): - try: - if 'fixed' in disk.opts: - try_and_print(disk=disk, message=message, function=show_disk_usage, ns='Unknown', silent_function=False) - message = '' - except: - pass - -def show_installed_ram(): - mem = psutil.virtual_memory() - if mem.total > 5905580032: - # > 5.5 Gb so 6Gb or greater - print_standard(human_readable_size(mem.total).strip()) - elif mem.total > 3758096384: - # > 3.5 Gb so 4Gb or greater - print_warning(human_readable_size(mem.total).strip()) - else: - print_error(human_readable_size(mem.total).strip()) - -def show_os_activation(): - act_str = global_vars['OS']['Activation'] - if re.search(r'permanent', act_str, re.IGNORECASE): - print_standard(act_str, timestamp=False) - elif re.search(r'unavailable', act_str, re.IGNORECASE): - print_warning(act_str, timestamp=False) - else: - print_error(act_str, timestamp=False) - -def show_os_name(): - os_name = global_vars['OS']['DisplayName'] - if global_vars['OS']['Arch'] == 32: - # Show all 32-bit installs as an error message - print_error(os_name, timestamp=False) - else: - if re.search(r'(unrecognized|very outdated)', os_name, re.IGNORECASE): - print_error(os_name, timestamp=False) - elif re.search(r'outdated', os_name, re.IGNORECASE): - print_warning(os_name, timestamp=False) - else: - print_standard(os_name, timestamp=False) - -def show_temp_files_size(): - # Temp file size - size = None - with open('{LogDir}\\BleachBit.log'.format(**global_vars), 'r') as f: - for line in f.readlines(): - if re.search(r'^disk space to be recovered:', line, re.IGNORECASE): - size = re.sub(r'.*: ', '', line.strip()) - size = re.sub(r'(\w)iB$', r' \1b', size) - if size is None: - print_warning(size, timestamp=False) - else: - print_standard(size, timestamp=False) - -def show_user_data_summary(all_users=True, indent=8, width=32): - users = get_user_data_size_info(all_users) - for user in sorted(users.keys()): - print_success(' User: {user}'.format(user=user)) - print_standard(users[user].get('ProfileSize', 'Unknown')) - print_standard('{}{}'.format(' '*indent, '-'*(width+6))) - for folder in sorted(users[user]['Shell Folders']): - print_standard(users[user]['Shell Folders'][folder]) - for folder in sorted(users[user]['Extra Folders']): - print_standard(users[user]['Shell Folders'][folder]) - -def upload_info(): - path = '{ClientDir}'.format(**global_vars) - file = 'Info_{Date-Time}.7z'.format(**global_vars) - upload_data(path, file) - -if __name__ == '__main__': - print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/activation.py b/.bin/Scripts/functions/activation.py new file mode 100644 index 00000000..7b401c0b --- /dev/null +++ b/.bin/Scripts/functions/activation.py @@ -0,0 +1,71 @@ +# Wizard Kit: Functions - Activation + +import subprocess + +from borrowed import acpi +from os import environ + +# Variables +SLMGR = r'{}\System32\slmgr.vbs'.format(environ.get('SYSTEMROOT')) + +# Error Classes +class BIOSKeyNotFoundError(Exception): + pass + +def activate_windows_with_bios(): + """Attempt to activate Windows with a key stored in the BIOS.""" + # Code borrowed from https://github.com/aeruder/get_win8key + ##################################################### + #script to query windows 8.x OEM key from PC firmware + #ACPI -> table MSDM -> raw content -> byte offset 56 to end + #ck, 03-Jan-2014 (christian@korneck.de) + ##################################################### + bios_key = None + table = b"MSDM" + if acpi.FindAcpiTable(table) is True: + rawtable = acpi.GetAcpiTable(table) + #http://msdn.microsoft.com/library/windows/hardware/hh673514 + #byte offset 36 from beginning \ + # = Microsoft 'software licensing data structure' \ + # / 36 + 20 bytes offset from beginning = Win Key + bios_key = rawtable[56:len(rawtable)].decode("utf-8") + else: + raise Exception('ACPI table {} not found.'.format(str(table))) + if bios_key is None: + raise BIOSKeyNotFoundError + + # Install Key + cmd = ['cscript', '//nologo', SLMGR, '/ipk', bios_key] + subprocess.run(cmd, check=False) + sleep(5) + + # Attempt activation + cmd = ['cscript', '//nologo', SLMGR, '/ato'] + subprocess.run(cmd, check=False) + sleep(5) + + # Check status + if not windows_is_activated(): + raise Exception('Activation Failed') + +def get_activation_string(): + """Get activation status, returns str.""" + act_str = subprocess.run( + ['cscript', '//nologo', SLMGR, '/xpr'], check=False, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + act_str = act_str.stdout.decode() + act_str = act_str.splitlines() + act_str = act_str[1].strip() + return act_str + +def windows_is_activated(): + """Check if Windows is activated via slmgr.vbs and return bool.""" + activation_string = subprocess.run( + ['cscript', '//nologo', SLMGR, '/xpr'], check=False, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + activation_string = activation_string.stdout.decode() + + return bool(activation_string and 'permanent' in activation_string) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/browsers.py b/.bin/Scripts/functions/browsers.py new file mode 100644 index 00000000..e4df7c41 --- /dev/null +++ b/.bin/Scripts/functions/browsers.py @@ -0,0 +1,447 @@ +# Wizard Kit: Functions - Browsers + +from functions.common import * + +# Define other_results for later try_and_print +browser_data = {} +other_results = { + 'Error': { + 'MultipleInstallationsError': 'Multiple installations detected', + }, + 'Warning': { + 'NotInstalledError': 'Not installed', + 'NoProfilesError': 'No profiles found', + } +} + +# Regex +REGEX_BACKUP = re.compile( + r'\.\w+bak.*', + re.IGNORECASE) +REGEX_CHROMIUM_PROFILE = re.compile( + r'^(Default|Profile)', + re.IGNORECASE) +REGEX_CHROMIUM_ITEMS = re.compile( + r'^(Bookmarks|Cookies|Favicons|Google Profile' + r'|History|Login Data|Top Sites|TransportSecurity' + r'|Visited Links|Web Data)', + re.IGNORECASE) +REGEX_MOZILLA = re.compile( + r'^(bookmarkbackups|(cookies|formhistory|places).sqlite' + r'|key3.db|logins.json|persdict.dat)$', + re.IGNORECASE) + +# STATIC VARIABLES +DEFAULT_HOMEPAGE = 'https://www.google.com/' +IE_GALLERY = 'https://www.microsoft.com/en-us/iegallery' +MOZILLA_PREFS = { + 'browser.search.defaultenginename': '"Google"', + 'browser.search.defaultenginename.US': '"Google"', + 'browser.search.geoSpecificDefaults': 'false', + 'browser.startup.homepage': '"{}"'.format(DEFAULT_HOMEPAGE), + 'extensions.ui.lastCategory': '"addons://list/extension"', + } +UBO_CHROME = 'https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en' +UBO_CHROME_REG = r'Software\Wow6432Node\Google\Chrome\Extensions\cjpalhdlnbpafiamejdnhcphjbkeiagm' +UBO_EXTRA_CHROME = 'https://chrome.google.com/webstore/detail/ublock-origin-extra/pgdnlhfefecpicbbihgmbmffkjpaplco?hl=en' +UBO_EXTRA_CHROME_REG = r'Software\Wow6432Node\Google\Chrome\Extensions\pgdnlhfefecpicbbihgmbmffkjpaplco' +UBO_MOZILLA = 'https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/' +UBO_OPERA = 'https://addons.opera.com/en/extensions/details/ublock/?display=en' +SUPPORTED_BROWSERS = { + 'Internet Explorer': { + 'base': 'ie', + 'exe_name': 'iexplore.exe', + 'rel_install_path': 'Internet Explorer', + 'user_data_path': r'{USERPROFILE}\Favorites', + }, + 'Google Chrome': { + 'base': 'chromium', + 'exe_name': 'chrome.exe', + 'rel_install_path': r'Google\Chrome\Application', + 'user_data_path': r'{LOCALAPPDATA}\Google\Chrome\User Data', + }, + 'Google Chrome Canary': { + 'base': 'chromium', + 'exe_name': 'chrome.exe', + 'rel_install_path': r'Google\Chrome SxS\Application', + 'user_data_path': r'{LOCALAPPDATA}\Google\Chrome SxS\User Data', + }, + 'Mozilla Firefox': { + 'base': 'mozilla', + 'exe_name': 'firefox.exe', + 'rel_install_path': 'Mozilla Firefox', + 'user_data_path': r'{APPDATA}\Mozilla\Firefox\Profiles', + }, + 'Mozilla Firefox Dev': { + 'base': 'mozilla', + 'exe_name': 'firefox.exe', + 'rel_install_path': 'Firefox Developer Edition', + 'user_data_path': r'{APPDATA}\Mozilla\Firefox\Profiles', + }, + 'Opera': { + 'base': 'chromium', + 'exe_name': 'launcher.exe', + 'rel_install_path': 'Opera', + 'user_data_path': r'{APPDATA}\Opera Software\Opera Stable', + }, + 'Opera Beta': { + 'base': 'chromium', + 'exe_name': 'launcher.exe', + 'rel_install_path': 'Opera beta', + 'user_data_path': r'{APPDATA}\Opera Software\Opera Next', + }, + 'Opera Dev': { + 'base': 'chromium', + 'exe_name': 'launcher.exe', + 'rel_install_path': 'Opera developer', + 'user_data_path': r'{APPDATA}\Opera Software\Opera Developer', + }, + } + +def archive_browser(name): + """Create backup of Browser saved in the BackupDir.""" + source = '{}*'.format(browser_data[name]['user_data_path']) + dest = r'{BackupDir}\Browsers ({USERNAME})'.format( + **global_vars, **global_vars['Env']) + archive = r'{}\{}.7z'.format(dest, name) + os.makedirs(dest, exist_ok=True) + cmd = [ + global_vars['Tools']['SevenZip'], + 'a', '-aoa', '-bso0', '-bse0', '-mx=1', + archive, source] + run_program(cmd) + +def backup_browsers(): + """Create backup of all detected browsers.""" + for name in sorted(browser_data): + try_and_print(message='{}...'.format(name), + function=archive_browser, name=name) + +def clean_chromium_profile(profile): + """Renames profile, creates a new folder, and copies the user data to it.""" + if profile is None: + raise Exception + backup_path = '{path}_{Date}.bak'.format( + path=profile['path'], **global_vars) + backup_path = non_clobber_rename(backup_path) + shutil.move(profile['path'], backup_path) + os.makedirs(profile['path'], exist_ok=True) + + # Restore essential files from backup_path + for entry in os.scandir(backup_path): + if REGEX_CHROMIUM_ITEMS.search(entry.name): + shutil.copy(entry.path, r'{}\{}'.format( + profile['path'], entry.name)) + +def clean_internet_explorer(**kwargs): + """Uses the built-in function to reset IE and sets the homepage. + + NOTE: kwargs set but unused as a workaround.""" + kill_process('iexplore.exe') + run_program(['rundll32.exe', 'inetcpl.cpl,ResetIEtoDefaults'], check=False) + key = r'Software\Microsoft\Internet Explorer\Main' + + # Set homepage + with winreg.OpenKey(HKCU, key, access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'Start Page', 0, + winreg.REG_SZ, DEFAULT_HOMEPAGE) + try: + winreg.DeleteValue(_key, 'Secondary Start Pages') + except FileNotFoundError: + pass + +def clean_mozilla_profile(profile): + """Renames profile, creates a new folder, and copies the user data to it.""" + if profile is None: + raise Exception + backup_path = '{path}_{Date}.bak'.format( + path=profile['path'], **global_vars) + backup_path = non_clobber_rename(backup_path) + shutil.move(profile['path'], backup_path) + homepages = [] + os.makedirs(profile['path'], exist_ok=True) + + # Restore essential files from backup_path + for entry in os.scandir(backup_path): + if REGEX_MOZILLA.search(entry.name): + if entry.is_dir(): + shutil.copytree(entry.path, r'{}\{}'.format( + profile['path'], entry.name)) + else: + shutil.copy(entry.path, r'{}\{}'.format( + profile['path'], entry.name)) + + # Set profile defaults + with open(r'{path}\prefs.js'.format(**profile), 'a', encoding='ascii') as f: + for k, v in MOZILLA_PREFS.items(): + f.write('user_pref("{}", {});\n'.format(k, v)) + +def get_browser_details(name): + """Get installation status and profile details for all supported browsers.""" + browser = SUPPORTED_BROWSERS[name].copy() + + # Update user_data_path + browser['user_data_path'] = browser['user_data_path'].format( + **global_vars['Env']) + + # Find executable (if multiple files are found, the last one is used) + exe_path = None + num_installs = 0 + for install_path in ['LOCALAPPDATA', 'PROGRAMFILES(X86)', 'PROGRAMFILES']: + test_path = r'{install_path}\{rel_install_path}\{exe_name}'.format( + install_path = global_vars['Env'].get(install_path, ''), + **browser) + if os.path.exists(test_path): + num_installs += 1 + exe_path = test_path + + # Find profile(s) + profiles = [] + if browser['base'] == 'ie': + profiles.append({'name': 'Default', 'path': None}) + elif 'Google Chrome' in name: + profiles.extend( + get_chromium_profiles( + search_path=browser['user_data_path'])) + elif browser['base'] == 'mozilla': + dev = 'Dev' in name + profiles.extend( + get_mozilla_profiles( + search_path=browser['user_data_path'], dev=dev)) + if exe_path and not dev and len(profiles) == 0: + # e.g. If Firefox is installed but no profiles were found. + ## Rename profiles.ini and create a new default profile + profiles_ini_path = browser['user_data_path'].replace( + 'Profiles', 'profiles.ini') + if os.path.exists(profiles_ini_path): + backup_path = '{path}_{Date}.bak'.format( + path=profiles_ini_path, **global_vars) + backup_path = non_clobber_rename(backup_path) + shutil.move(profiles_ini_path, backup_path) + run_program([exe_path, '-createprofile', 'default'], check=False) + profiles.extend( + get_mozilla_profiles( + search_path=browser['user_data_path'], dev=dev)) + + elif 'Opera' in name: + if os.path.exists(browser['user_data_path']): + profiles.append( + {'name': 'Default', 'path': browser['user_data_path']}) + + # Skip browser if there's no profiles + if len(profiles) == 0: + raise NoProfilesError + + # Get homepages + if browser['base'] == 'ie': + # IE is set to only have one profile above + profiles[0]['homepages'] = get_ie_homepages() + elif browser['base'] == 'mozilla': + for profile in profiles: + prefs_path = r'{path}\prefs.js'.format(**profile) + profile['homepages'] = get_mozilla_homepages(prefs_path=prefs_path) + + # Add to browser_data + browser_data[name] = browser + browser_data[name].update({ + 'exe_path': exe_path, + 'profiles': profiles, + }) + + # Raise installation warnings (if any) + if num_installs == 0: + raise NotInstalledError + elif num_installs > 1 and browser['base'] != 'ie': + raise MultipleInstallationsError + +def get_chromium_profiles(search_path): + """Find any chromium-style profiles and return as a list of dicts.""" + profiles = [] + try: + for entry in os.scandir(search_path): + if entry.is_dir() and REGEX_CHROMIUM_PROFILE.search(entry.name): + profiles.append(entry) + REGEX_PROFILE_BACKUP = r'\.\w+bak.*' + profiles = [p for p in profiles if not REGEX_BACKUP.search(p.name)] + # Convert os.DirEntries to dicts + profiles = [{'name': p.name, 'path': p.path} for p in profiles] + except Exception: + pass + + return profiles + +def get_ie_homepages(): + """Read homepages from the registry and return as a list.""" + homepages = [] + main_page = '' + extra_pages = [] + key = r'Software\Microsoft\Internet Explorer\Main' + with winreg.OpenKey(HKCU, key) as _key: + try: + main_page = winreg.QueryValueEx(_key, 'Start Page')[0] + except FileNotFoundError: + pass + try: + extra_pages = winreg.QueryValueEx(_key, 'Secondary Start Pages')[0] + except FileNotFoundError: + pass + if main_page != '': + homepages.append(main_page) + if len(extra_pages) > 0: + homepages.extend(extra_pages) + return homepages + +def get_mozilla_homepages(prefs_path): + """Read homepages from prefs.js and return as a list.""" + homepages = [] + try: + with open(prefs_path, 'r') as f: + search = re.search( + r'browser\.startup\.homepage", "([^"]*)"', + f.read(), re.IGNORECASE) + if search: + homepages = search.group(1).split('|') + except Exception: + pass + + return homepages + +def get_mozilla_profiles(search_path, dev=False): + """Find any mozilla-style profiles and return as a list of dicts.""" + profiles = [] + try: + for entry in os.scandir(search_path): + if entry.is_dir(): + if 'dev-edition' in entry.name: + # NOTE: Not always present which can lead + # to Dev profiles being marked as non-Dev + ## NOTE 2: It is possible that a non-Dev profile + ## to be created with 'dev-edition' in the name. + ## (It wouldn't make sense, but possible) + if dev: + profiles.append(entry) + elif not dev: + profiles.append(entry) + profiles = [p for p in profiles if not REGEX_BACKUP.search(p.name)] + # Convert os.DirEntries to dicts + profiles = [{'name': p.name, 'path': p.path} for p in profiles] + except Exception: + pass + + return profiles + +def install_adblock(indent=8, width=32): + """Install adblock for all supported browsers.""" + for browser in sorted(browser_data): + exe_path = browser_data[browser].get('exe_path', None) + function=run_program + if exe_path is None: + print_standard( + '{indent}{browser:<{width}}'.format( + indent=' '*indent, width=width, browser=browser+'...'), + end='', flush=True) + print_warning('Not installed', timestamp=False) + else: + # Set urls to open + urls = [] + if browser_data[browser]['base'] == 'chromium': + if browser == 'Google Chrome': + # Check for system exensions + try: + winreg.QueryValue(HKLM, UBO_CHROME_REG) + except FileNotFoundError: + urls.append(UBO_CHROME) + try: + winreg.QueryValue(HKLM, UBO_EXTRA_CHROME_REG) + except FileNotFoundError: + urls.append(UBO_EXTRA_CHROME) + + if len(urls) == 0: + urls = ['chrome://extensions'] + elif 'Opera' in browser: + urls.append(UBO_OPERA) + else: + urls.append(UBO_CHROME) + urls.append(UBO_EXTRA_CHROME) + + elif browser_data[browser]['base'] == 'mozilla': + # Assume UBO is not installed first and change if it is + urls.append(UBO_MOZILLA) + if browser == 'Mozilla Firefox': + ubo = browser_data[browser]['exe_path'].replace( + 'firefox.exe', + r'distribution\extensions\uBlock0@raymondhill.net') + if os.path.exists(ubo): + urls = ['about:addons'] + + elif browser_data[browser]['base'] == 'ie': + urls.append(IE_GALLERY) + function=popen_program + + # By using check=False we're skipping any return codes so + # it should only fail if the program can't be run + # (or can't be found). + # In other words, this isn't tracking the addon/extension's + # installation status. + try_and_print(message='{}...'.format(browser), + indent=indent, width=width, + cs='Done', function=function, + cmd=[exe_path, *urls], check=False) + +def list_homepages(indent=8, width=32): + """List current homepages for reference.""" + + for browser in sorted(browser_data): + # Skip Chromium-based browsers + if browser_data[browser]['base'] == 'chromium': + print_info( + '{indent}{browser:<{width}}'.format( + indent=' '*indent, width=width, browser=browser+'...'), + end='', flush=True) + print_warning('Not implemented', timestamp=False) + continue + + # All other browsers + profiles = browser_data[browser].get('profiles', []) + if profiles: + print_info('{indent}{browser:<{width}}'.format( + indent=' '*indent, width=width, browser=browser+'...')) + for profile in profiles: + _name = profile.get('name', '?') + _homepages = profile.get('homepages', []) + if len(_homepages) == 0: + print_standard( + '{indent}{name:<{width}}'.format( + indent=' '*indent, width=width, name=_name), + end='', flush=True) + print_warning('None found', timestamp=False) + else: + for page in _homepages: + print_standard('{indent}{name:<{width}}{page}'.format( + indent=' '*indent, width=width, name=_name, page=page)) + +def reset_browsers(indent=8, width=32): + """Reset all detected browsers to safe defaults.""" + for browser in sorted(browser_data): + print_info('{indent}{name}'.format(indent=' '*indent, name=browser)) + for profile in browser_data[browser]['profiles']: + if browser_data[browser]['base'] == 'chromium': + function = clean_chromium_profile + elif browser_data[browser]['base'] == 'ie': + function = clean_internet_explorer + elif browser_data[browser]['base'] == 'mozilla': + function = clean_mozilla_profile + try_and_print( + message='{}...'.format(profile['name']), + indent=indent, width=width, function=function, + other_results=other_results, profile=profile) + +def scan_for_browsers(): + """Scan system for any supported browsers.""" + for name in sorted(SUPPORTED_BROWSERS): + try_and_print(message='{}...'.format(name), + function=get_browser_details, cs='Detected', + other_results=other_results, name=name) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/build.py b/.bin/Scripts/functions/build.py new file mode 100644 index 00000000..ae7009c2 --- /dev/null +++ b/.bin/Scripts/functions/build.py @@ -0,0 +1,157 @@ +# Wizard Kit: Functions - Build / Update + +from functions.common import * + +def download_file(out_dir, out_name, source_url): + """Downloads a file using curl.""" + extract_item('curl', silent=True) + _cmd = [ + global_vars['Tools']['curl'], + # '-#LSfo', # ProgressBar + '-Lfso', + '{}/{}'.format(out_dir, out_name), + source_url] + os.makedirs(out_dir, exist_ok=True) + run_program(_cmd, pipe=False) + +def resolve_dynamic_url(source_url, regex): + """Scan source_url for a url using the regex provided; returns str.""" + # Download the "download page" + extract_item('curl', silent=True) + _tmp_file = r'{TmpDir}\webpage.tmp'.format(**global_vars) + _cmd = [ + global_vars['Tools']['curl'], + '-#LSfo', + _tmp_file, + source_url] + try: + run_program(_cmd) + except Exception: + # "Fail silently as the download_file() function will catch it + return None + + # Scan the file for the regex + with open(_tmp_file, 'r') as file: + for line in file: + if re.search(regex, line): + _url = line.strip() + _url = re.sub(r'.*(a |)href="([^"]+)".*', r'\2', _url) + _url = re.sub(r".*(a |)href='([^']+)'.*", r'\2', _url) + break + + # Cleanup and return + os.remove(_tmp_file) + return _url + +def update_adwcleaner(): + _path = global_vars['BinDir'] + _name = 'AdwCleaner.exe' + _dl_page = 'http://www.bleepingcomputer.com/download/adwcleaner/dl/125/' + _regex = r'href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/a/adwcleaner/AdwCleaner\.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + download_file(_path, _name, _url) + +def update_eset(): + _path = global_vars['BinDir'] + _name = 'ESET.exe' + _url = 'http://download.eset.com/special/eos/esetsmartinstaller_enu.exe' + download_file(_path, _name, _url) + +def update_jrt(): + _path = global_vars['BinDir'] + _name = 'JRT.exe' + _url = 'http://downloads.malwarebytes.org/file/jrt' + download_file(_path, _name, _url) + +def update_kvrt(): + _path = global_vars['BinDir'] + _name = 'KVRT.exe' + _url = 'http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe' + download_file(_path, _name, _url) + +def update_hitmanpro(): + _path = '{BinDir}/HitmanPro'.format(**global_vars) + _name = 'HitmanPro.exe' + _url = 'http://dl.surfright.nl/HitmanPro.exe' + download_file(_path, _name, _url) + + _name = 'HitmanPro64.exe' + _url = 'http://dl.surfright.nl/HitmanPro_x64.exe' + download_file(_path, _name, _url) + +def update_intel_driver_utility(): + _path = '{BinDir}/_Drivers'.format(**global_vars) + _name = 'Intel Driver Update Utility.exe' + _dl_page = 'http://www.intel.com/content/www/us/en/support/detect.html' + _regex = r'a href.*http(s|)://downloadmirror\.intel\.com/[a-zA-Z0-9]+/[a-zA-Z0-9]+/Intel%20Driver%20Update%20Utility%20Installer.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + _url = resolve_dynamic_url(_dl_page, _regex) + download_file(_path, _name, _url) + +def update_intel_ssd_toolbox(): + _path = '{BinDir}/_Drivers'.format(**global_vars) + _name = 'Intel SSD Toolbox.exe' + _dl_page = 'https://downloadcenter.intel.com/download/26085/Intel-Solid-State-Drive-Toolbox' + _regex = r'href=./downloads/eula/[0-9]+/Intel-Solid-State-Drive-Toolbox.httpDown=https\%3A\%2F\%2Fdownloadmirror\.intel\.com\%2F[0-9]+\%2Feng\%2FIntel\%20SSD\%20Toolbox\%20-\%20v[0-9\.]+.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + _url = re.sub(r'.*httpDown=(.*)', r'\1', _url, re.IGNORECASE) + _url = _url.replace('%3A', ':') + _url = _url.replace('%2F', '/') + download_file(_path, _name, _url) + +def update_rkill(): + _path = '{BinDir}/RKill'.format(**global_vars) + _name = 'RKill.exe' + _dl_page = 'http://www.bleepingcomputer.com/download/rkill/dl/10/' + _regex = r'href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/r/rkill/rkill\.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + download_file(_path, _name, _url) + +def update_samsung_magician(): + print_warning('Disabled.') + #~Broken~# _path = '{BinDir}/_Drivers'.format(**global_vars) + #~Broken~# _name = 'Samsung Magician.zip' + #~Broken~# _dl_page = 'http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html' + #~Broken~# _regex = r'href=./semiconductor/minisite/ssd/downloads/software/Samsung_Magician_Setup_v[0-9]+.zip' + #~Broken~# _url = resolve_dynamic_url(_dl_page, _regex) + #~Broken~# # Convert relative url to absolute + #~Broken~# _url = 'http://www.samsung.com' + _url + #~Broken~# download_file(_path, _name, _url) + #~Broken~# # Extract and replace old copy + #~Broken~# _args = [ + #~Broken~# 'e', '"{BinDir}/_Drivers/Samsung Magician.zip"'.format(**global_vars), + #~Broken~# '-aoa', '-bso0', '-bsp0', + #~Broken~# '-o"{BinDir}/_Drivers"'.format(**global_vars) + #~Broken~# ] + #~Broken~# run_program(seven_zip, _args) + #~Broken~# try: + #~Broken~# os.remove('{BinDir}/_Drivers/Samsung Magician.zip'.format(**global_vars)) + #~Broken~# #~PoSH~# Move-Item "$bin\_Drivers\Samsung*exe" "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null + #~Broken~# except Exception: + #~Broken~# pass + pass + +def update_sysinternalssuite(): + _path = '{BinDir}/tmp'.format(**global_vars) + _name = 'SysinternalsSuite.zip' + _url = 'https://download.sysinternals.com/files/SysinternalsSuite.zip' + download_file(_path, _name, _url) + # Extract + _args = [ + 'e', '"{BinDir}/tmp/SysinternalsSuite.zip"'.format(**global_vars), + '-aoa', '-bso0', '-bsp0', + '-o"{BinDir}/SysinternalsSuite"'.format(**global_vars)] + run_program(seven_zip, _args) + try: + os.remove('{BinDir}/tmp/SysinternalsSuite.zip'.format(**global_vars)) + except Exception: + pass + +def update_tdsskiller(): + _path = global_vars['BinDir'] + _name = 'TDSSKiller.exe' + _url = 'http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe' + download_file(_path, _name, _url) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/cleanup.py b/.bin/Scripts/functions/cleanup.py new file mode 100644 index 00000000..1bac4c6c --- /dev/null +++ b/.bin/Scripts/functions/cleanup.py @@ -0,0 +1,91 @@ +# Wizard Kit: Functions - Cleanup + +from functions.common import * + +def cleanup_adwcleaner(): + """Move AdwCleaner folders into the ClientDir.""" + source_path = r'{SYSTEMDRIVE}\AdwCleaner'.format(**global_vars['Env']) + source_quarantine = r'{}\Quarantine'.format(source_path) + + # Quarantine + if os.path.exists(source_quarantine): + os.makedirs(global_vars['QuarantineDir'], exist_ok=True) + dest_name = r'{QuarantineDir}\AdwCleaner_{Date-Time}'.format( + **global_vars) + dest_name = non_clobber_rename(dest_name) + shutil.move(source_quarantine, dest_name) + + # Delete source folder if empty + try: + os.rmdir(source_path) + except OSError: + pass + + # Main folder + if os.path.exists(source_path): + os.makedirs(global_vars['ProgBackupDir'], exist_ok=True) + dest_name = r'{ProgBackupDir}\AdwCleaner_{Date-Time}'.format( + **global_vars) + dest_name = non_clobber_rename(dest_name) + shutil.move(source_path, dest_name) + +def cleanup_cbs(dest_folder): + """Safely cleanup a known CBS archive bug under Windows 7. + + If a CbsPersist file is larger than 2 Gb then the auto archive feature + continually fails and will fill up the system drive with temp files. + + This function moves the temp files and CbsPersist file to a temp folder, + compresses the CbsPersist files with 7-Zip, and then opens the temp folder + for the user to manually save the backup files and delete the temp files. + """ + backup_folder = r'{dest_folder}\CbsFix'.format(dest_folder=dest_folder) + temp_folder = r'{backup_folder}\Temp'.format(backup_folder=backup_folder) + os.makedirs(backup_folder, exist_ok=True) + os.makedirs(temp_folder, exist_ok=True) + + # Move files into temp folder + cbs_path = r'{SYSTEMROOT}\Logs\CBS'.format(**global_vars['Env']) + for entry in os.scandir(cbs_path): + # CbsPersist files + if entry.name.lower().startswith('cbspersist'): + dest_name = r'{}\{}'.format(temp_folder, entry.name) + dest_name = non_clobber_rename(dest_name) + shutil.move(entry.path, dest_name) + temp_path = r'{SYSTEMROOT}\Temp'.format(**global_vars['Env']) + for entry in os.scandir(temp_path): + # cab_ files + if entry.name.lower().startswith('cab_'): + dest_name = r'{}\{}'.format(temp_folder, entry.name) + dest_name = non_clobber_rename(dest_name) + shutil.move(entry.path, dest_name) + + # Compress CbsPersist files with 7-Zip + cmd = [ + global_vars['Tools']['SevenZip'], + 'a', '-t7z', '-mx=3', '-bso0', '-bse0', + r'{}\CbsPersists.7z'.format(backup_folder), + r'{}\CbsPersist*'.format(temp_folder)] + run_program(cmd) + +def cleanup_desktop(): + """Move known backup files and reports into the ClientDir.""" + dest_folder = r'{ProgBackupDir}\Desktop_{Date-Time}'.format(**global_vars) + os.makedirs(dest_folder, exist_ok=True) + + desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env']) + for entry in os.scandir(desktop_path): + # JRT, RKill, Shortcut cleaner + if re.search(r'^(JRT|RKill|sc-cleaner)', entry.name, re.IGNORECASE): + dest_name = r'{}\{}'.format(dest_folder, entry.name) + dest_name = non_clobber_rename(dest_name) + shutil.move(entry.path, dest_name) + + # Remove dir if empty + try: + os.rmdir(dest_folder) + except OSError: + pass + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py new file mode 100644 index 00000000..c0e95452 --- /dev/null +++ b/.bin/Scripts/functions/common.py @@ -0,0 +1,731 @@ +# Wizard Kit: Functions - Common + +import os +import psutil +import re +import shutil +import subprocess +import sys +import time +import traceback +import winreg + +from subprocess import CalledProcessError + +from settings.main import * + +# Global variables +global_vars = {} + +# STATIC VARIABLES +COLORS = { + 'CLEAR': '\033[0m', + 'RED': '\033[31m', + 'GREEN': '\033[32m', + 'YELLOW': '\033[33m', + 'BLUE': '\033[34m' +} +HKU = winreg.HKEY_USERS +HKCU = winreg.HKEY_CURRENT_USER +HKLM = winreg.HKEY_LOCAL_MACHINE +TOOLS = { + # NOTE: BinDir will be prepended to these paths at runtime + 'AIDA64': { + '32': r'AIDA64\aida64.exe'}, + 'AutoRuns': { + '32': r'Autoruns\autoruns.exe', + '64': r'Autoruns\autoruns64.exe'}, + 'BleachBit': { + '32': r'BleachBit\bleachbit_console.exe'}, + 'Caffeine': { + '32': r'caffeine\caffeine.exe'}, + 'curl': { + '32': r'curl\curl.exe'}, + 'Du': { + '32': r'du\du.exe', + '64': r'du\du64.exe'}, + 'ERUNT': { + '32': r'erunt\ERUNT.EXE'}, + 'Everything': { + '32': r'Everything\Everything.exe', + '64': r'Everything\Everything64.exe'}, + 'FastCopy': { + '32': r'FastCopy\FastCopy.exe', + '64': r'FastCopy\FastCopy64.exe'}, + 'HitmanPro': { + '32': r'HitmanPro\HitmanPro.exe', + '64': r'HitmanPro\HitmanPro64.exe'}, + 'HWiNFO': { + '32': r'HWiNFO\HWiNFO.exe', + '64': r'HWiNFO\HWiNFO64.exe'}, + 'KVRT': { + '32': r'KVRT\KVRT.exe'}, + 'NotepadPlusPlus': { + '32': r'notepadplusplus\notepadplusplus.exe'}, + 'ProduKey': { + '32': r'ProduKey\ProduKey.exe', + '64': r'ProduKey\ProduKey64.exe'}, + 'PuTTY-PSFTP': { + '32': r'PuTTY\PSFTP.EXE'}, + 'RKill': { + '32': r'RKill\RKill.exe'}, + 'SevenZip': { + '32': r'7-Zip\7za.exe', + '64': r'7-Zip\7za64.exe'}, + 'TDSSKille': { + '32': r'TDSSKiller\TDSSKiller.exe'}, + 'wimlib-imagex': { + '32': r'wimlib\x32\wimlib-imagex.exe', + '64': r'wimlib\x64\wimlib-imagex.exe'}, + 'XMPlay': { + '32': r'XMPlay\xmplay.exe'}, +} + +# Error Classes +class BinNotFoundError(Exception): + pass + +class GenericError(Exception): + pass + +class GenericRepair(Exception): + pass + +class MultipleInstallationsError(Exception): + pass + +class NotInstalledError(Exception): + pass + +class NoProfilesError(Exception): + pass + +class PathNotFoundException(Exception): + pass + +class UnsupportedOSError(Exception): + pass + +# General functions +def abort(): + """Abort script.""" + print_warning('Aborted.') + exit_script() + +def ask(prompt='Kotaero!'): + """Prompt the user with a Y/N question, log answer, and return a bool.""" + answer = None + prompt = '{} [Y/N]: '.format(prompt) + while answer is None: + tmp = input(prompt) + if re.search(r'^y(es|)$', tmp, re.IGNORECASE): + answer = True + elif re.search(r'^n(o|ope|)$', tmp, re.IGNORECASE): + answer = False + message = '{prompt}{answer_text}'.format( + prompt = prompt, + answer_text = 'Yes' if answer else 'No') + print_log(message=message) + return answer + +def convert_to_bytes(size): + """Convert human-readable size str to bytes and return an int.""" + size = str(size) + tmp = re.search(r'(\d+)\s+([KMGT]B)', size.upper()) + if tmp: + size = int(tmp.group(1)) + units = tmp.group(2) + if units == 'TB': + size *= 1099511627776 + elif units == 'GB': + size *= 1073741824 + elif units == 'MB': + size *= 1048576 + elif units == 'KB': + size *= 1024 + else: + return -1 + + return size + +def exit_script(return_value=0): + """Exits the script after some cleanup and opens the log (if set).""" + # Remove dirs (if empty) + for dir in ['BackupDir', 'LogDir', 'TmpDir']: + try: + dir = global_vars[dir] + os.rmdir(dir) + except Exception: + pass + + # Open Log (if it exists) + log = global_vars.get('LogFile', '') + if log and os.path.exists(log): + try: + extract_item('NotepadPlusPlus', silent=True) + popen_program( + [global_vars['Tools']['NotepadPlusPlus'], + global_vars['LogFile']]) + except Exception: + print_error('ERROR: Failed to extract Notepad++ and open log.') + + # Kill Caffeine if still running + kill_process('caffeine.exe') + + # Exit + sys.exit(return_value) + +def extract_item(item, filter='', silent=False): + """Extract item from .cbin into .bin.""" + cmd = [ + global_vars['Tools']['SevenZip'], 'x', '-aos', '-bso0', '-bse0', + '-p{ArchivePassword}'.format(**global_vars), + r'-o{BinDir}\{item}'.format(item=item, **global_vars), + r'{CBinDir}\{item}.7z'.format(item=item, **global_vars), + filter] + if not silent: + print_standard('Extracting "{item}"...'.format(item=item)) + try: + run_program(cmd) + except subprocess.CalledProcessError: + if not silent: + print_warning('WARNING: Errors encountered while exctracting data') + +def get_ticket_number(): + """Get TicketNumber from user, save in LogDir, and return as str.""" + ticket_number = None + while ticket_number is None: + _input = input('Enter ticket number: ') + if re.match(r'^([0-9]+([-_]?\w+|))$', _input): + ticket_number = _input + with open(r'{LogDir}\TicketNumber'.format(**global_vars), 'w') as f: + f.write(ticket_number) + return ticket_number + +def human_readable_size(size, decimals=0): + """Convert size in bytes to a human-readable format and return a str.""" + # Prep string formatting + width = 3+decimals + if decimals > 0: + width += 1 + + # Convert size to int + try: + size = int(size) + except ValueError: + size = convert_to_bytes(size) + + # Verify we have a valid size + if size <= 0: + return '{size:>{width}} b'.format(size='???', width=width) + + # Convert to sensible units + if size >= 1099511627776: + size /= 1099511627776 + units = 'Tb' + elif size >= 1073741824: + size /= 1073741824 + units = 'Gb' + elif size >= 1048576: + size /= 1048576 + units = 'Mb' + elif size >= 1024: + size /= 1024 + units = 'Kb' + else: + units = ' b' + + # Return + return '{size:>{width}.{decimals}f} {units}'.format( + size=size, width=width, decimals=decimals, units=units) + +def kill_process(name): + """Kill any running caffeine.exe processes.""" + for proc in psutil.process_iter(): + if proc.name() == name: + proc.kill() + +def major_exception(): + """Display traceback and exit""" + print_error('Major exception') + print_warning( + " Please let {tech} know and they'll look into it" + " (include the details below).".format(tech=SUPPORT_TECH)) + print(traceback.format_exc()) + print_log(traceback.format_exc()) + sleep(30) + pause('Press Enter to exit...') + # sys.exit(1) + exit_script(1) + +def menu_select(title='~ Untitled Menu ~', + prompt='Please make a selection', secret_exit=False, + main_entries=[], action_entries=[], disabled_label='DISABLED'): + """Display options in a menu and return selected option as a str.""" + # Bail early + if not main_entries and not action_entries: + raise Exception("MenuError: No items given") + + # Build menu + menu_splash = '{}\n\n'.format(title) + width = len(str(len(main_entries))) + valid_answers = [] + if (secret_exit): + valid_answers.append('Q') + + # Add main entries + for i in range(len(main_entries)): + entry = main_entries[i] + # Add Spacer + if ('CRLF' in entry): + menu_splash += '\n' + entry_str = '{number:>{width}}: {name}'.format( + number = i+1, + width = width, + name = entry.get('Display Name', entry['Name'])) + if entry.get('Disabled', False): + entry_str = '{YELLOW}{entry_str} ({disabled}){CLEAR}\n'.format( + entry_str = entry_str, + disabled = disabled_label, + **COLORS) + else: + valid_answers.append(str(i+1)) + menu_splash += '{}\n'.format(entry_str) + menu_splash += '\n' + + # Add action entries + for entry in action_entries: + # Add Spacer + if ('CRLF' in entry): + menu_splash += '\n' + valid_answers.append(entry['Letter']) + menu_splash += '{letter:>{width}}: {name}\n'.format( + letter = entry['Letter'].upper(), + width = len(str(len(action_entries))), + name = entry['Name']) + menu_splash += '\n' + + answer = '' + + while (answer.upper() not in valid_answers): + os.system('cls') + print(menu_splash) + answer = input('{}: '.format(prompt)) + + return answer.upper() + +def non_clobber_rename(full_path): + """Append suffix to path, if necessary, to avoid clobbering path""" + new_path = full_path + _i = 1; + while os.path.exists(new_path): + new_path = '{path}_{i}'.format(i=_i, path=full_path) + _i += 1 + + return new_path + +def pause(prompt='Press Enter to continue... '): + """Simple pause implementation.""" + input(prompt) + +def ping(addr='google.com'): + """Attempt to ping addr.""" + cmd = ['ping', '-n', '2', addr] + run_program(cmd) + +def popen_program(cmd, pipe=False, minimized=False, shell=False, **kwargs): + """Run program and return a subprocess.Popen object.""" + startupinfo=None + if minimized: + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags = subprocess.STARTF_USESHOWWINDOW + startupinfo.wShowWindow = 6 + + if pipe: + popen_obj = subprocess.Popen(cmd, shell=shell, startupinfo=startupinfo, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + popen_obj = subprocess.Popen(cmd, shell=shell, startupinfo=startupinfo) + + return popen_obj + +def print_error(*args, **kwargs): + """Prints message to screen in RED.""" + print_standard(*args, color=COLORS['RED'], **kwargs) + +def print_info(*args, **kwargs): + """Prints message to screen in BLUE.""" + print_standard(*args, color=COLORS['BLUE'], **kwargs) + +def print_warning(*args, **kwargs): + """Prints message to screen in YELLOW.""" + print_standard(*args, color=COLORS['YELLOW'], **kwargs) + +def print_standard(message='Generic info', + color=None, end='\n', timestamp=True, **kwargs): + """Prints message to screen and log (if set).""" + display_message = message + if color: + display_message = color + message + COLORS['CLEAR'] + # **COLORS is used below to support non-"standard" color printing + print(display_message.format(**COLORS), end=end, **kwargs) + print_log(message, end, timestamp) + +def print_success(*args, **kwargs): + """Prints message to screen in GREEN.""" + print_standard(*args, color=COLORS['GREEN'], **kwargs) + +def print_log(message='', end='\n', timestamp=True): + time_str = time.strftime("%Y-%m-%d %H%M%z: ") if timestamp else '' + if 'LogFile' in global_vars and global_vars['LogFile'] is not None: + with open(global_vars['LogFile'], 'a') as f: + for line in message.splitlines(): + f.write('{timestamp}{line}{end}'.format( + timestamp = time_str, + line = line, + end = end)) + +def run_program(cmd, args=[], check=True, pipe=True, shell=False): + """Run program and return a subprocess.CompletedProcess object.""" + if args: + # Deprecated so let's raise an exception to find & fix all occurances + print_error('ERROR: Using args is no longer supported.') + raise Exception + cmd = [c for c in cmd if c] + if shell: + cmd = ' '.join(cmd) + + if pipe: + process_return = subprocess.run(cmd, check=check, shell=shell, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + process_return = subprocess.run(cmd, check=check, shell=shell) + + return process_return + +def show_info(message='~Some message~', info='~Some info~', indent=8, width=32): + """Display info with formatting.""" + print_standard('{indent}{message:<{width}}{info}'.format( + indent=' '*indent, width=width, message=message, info=info)) + +def sleep(seconds=2): + """Wait for a while.""" + time.sleep(seconds) + +def stay_awake(): + """Prevent the system from sleeping or hibernating.""" + # Bail if caffeine is already running + for proc in psutil.process_iter(): + if proc.name() == 'caffeine.exe': + return + # Extract and run + extract_item('caffeine', silent=True) + try: + popen_program(global_vars['Tools']['Caffeine']) + except Exception: + print_error('ERROR: No caffeine available.') + print_warning('Please set the power setting to High Performance.') + +def get_exception(s): + """Get exception by name, returns Exception object.""" + return getattr(sys.modules[__name__], s) + +def try_and_print(message='Trying...', + function, cs='CS', ns='NS', other_results={}, + catch_all=True, print_return=False, silent_function=True, + indent=8, width=32, *args, **kwargs): + """Run function, print if successful or not, and return dict. + + other_results is in the form of + { + 'Warning': {'ExceptionClassName': 'Result Message'}, + 'Error': {'ExceptionClassName': 'Result Message'} + } + The the ExceptionClassNames will be excepted conditions + and the result string will be printed in the correct color. + catch_all=False will result in unspecified exceptions being re-raised.""" + err = None + w_exceptions = other_results.get('Warning', {}).keys() + w_exceptions = tuple(get_exception(e) for e in w_exceptions) + e_exceptions = other_results.get('Error', {}).keys() + e_exceptions = tuple(get_exception(e) for e in e_exceptions) + w_results = other_results.get('Warning', {}) + e_results = other_results.get('Error', {}) + + # Run function and catch errors + print_standard('{indent}{message:<{width}}'.format( + indent=' '*indent, message=message, width=width), end='', flush=True) + try: + out = function(*args, **kwargs) + if print_return: + print_standard(out[0], timestamp=False) + for item in out[1:]: + print_standard('{indent}{item}'.format( + indent=' '*(indent+width), item=item)) + elif silent_function: + print_success(cs, timestamp=False) + except w_exceptions as e: + _result = w_results.get(e.__class__.__name__, 'Warning') + print_warning(_result, timestamp=False) + err = e + except e_exceptions as e: + _result = e_results.get(e.__class__.__name__, 'Error') + print_error(_result, timestamp=False) + err = e + except Exception: + print_error(ns, timestamp=False) + err = traceback.format_exc() + + # Return or raise? + if bool(err) and not catch_all: + raise + else: + return {'CS': not bool(err), 'Error': err} + +def upload_data(path, file): + """Add CLIENT_INFO_SERVER to authorized connections and upload file.""" + if not ENABLED_UPLOAD_DATA: + raise GenericError('Feature disabled.') + + extract_item('PuTTY', filter='wizkit.ppk psftp.exe', silent=True) + + # Authorize connection to the server + winreg.CreateKey(HKCU, r'Software\SimonTatham\PuTTY\SshHostKeys') + with winreg.OpenKey(HKCU, r'Software\SimonTatham\PuTTY\SshHostKeys', + access=winreg.KEY_WRITE) as key: + winreg.SetValueEx(key, + 'rsa2@22:{IP}'.format(**CLIENT_INFO_SERVER), 0, + winreg.REG_SZ, CLIENT_INFO_SERVER['RegEntry']) + + # Write batch file + with open(r'{TmpDir}\psftp.batch'.format(**global_vars), + 'w', encoding='ascii') as f: + f.write('lcd "{path}"\n'.format(path=path)) + f.write('cd "{Share}"\n'.format(**CLIENT_INFO_SERVER)) + f.write('mkdir {TicketNumber}\n'.format(**global_vars)) + f.write('cd {TicketNumber}\n'.format(**global_vars)) + f.write('put "{file}"\n'.format(file=file)) + + # Upload Info + cmd = [ + global_vars['Tools']['PuTTY-PSFTP'], + '-noagent', + '-i', r'{BinDir}\PuTTY\wizkit.ppk'.format(**global_vars), + '{User}@{IP}'.format(**CLIENT_INFO_SERVER), + '-b', r'{TmpDir}\psftp.batch'.format(**global_vars)] + run_program(cmd) + +def upload_info(): + """Upload compressed Info file to the NAS as set in settings.main.py.""" + if not ENABLED_UPLOAD_DATA: + raise GenericError('Feature disabled.') + + path = '{ClientDir}'.format(**global_vars) + file = 'Info_{Date-Time}.7z'.format(**global_vars) + upload_data(path, file) + +def compress_info(): + """Compress ClientDir info folders with 7-Zip for upload_info().""" + path = '{ClientDir}'.format(**global_vars) + file = 'Info_{Date-Time}.7z'.format(**global_vars) + _cmd = [ + global_vars['Tools']['SevenZip'], + 'a', '-t7z', '-mx=9', '-bso0', '-bse0', + r'{}\{}'.format(path, file), + r'{ClientDir}\Info'.format(**global_vars)] + run_program(_cmd) + +def wait_for_process(name, poll_rate=3): + """Wait for process by name.""" + running = True + while running: + sleep(poll_rate) + running = False + for proc in psutil.process_iter(): + if re.search(r'^{}'.format(name), proc.name(), re.IGNORECASE): + running = True + sleep(1) + +# global_vars functions +def init_global_vars(): + """Sets global variables based on system info.""" + print_info('Initializing') + os.system('title Wizard Kit') + init_functions = [ + ['Checking .bin...', find_bin], + ['Checking environment...', set_common_vars], + ['Checking OS...', check_os], + ['Checking tools...', check_tools], + ['Creating folders...', make_tmp_dirs], + ['Clearing collisions...', clean_env_vars], + ] + try: + for f in init_functions: + try_and_print( + message=f[0], function=f[1], + cs='Done', ns='Error', catch_all=False) + except: + major_exception() + +def check_os(): + """Set OS specific variables.""" + tmp = {} + + # Query registry + _reg_path = winreg.OpenKey( + HKLM, r'SOFTWARE\Microsoft\Windows NT\CurrentVersion') + for key in ['CSDVersion', 'CurrentBuild', 'CurrentBuildNumber', + 'CurrentVersion', 'ProductName']: + try: + tmp[key] = winreg.QueryValueEx(_reg_path, key)[0] + if key in ['CurrentBuild', 'CurrentBuildNumber']: + tmp[key] = int(tmp[key]) + except ValueError: + # Couldn't convert Build to int so this should be interesting... + tmp[key] = 0 + except Exception: + tmp[key] = 'Unknown' + + # Determine OS bit depth + tmp['Arch'] = 32 + if 'PROGRAMFILES(X86)' in global_vars['Env']: + tmp['Arch'] = 64 + + # Determine OS Name + tmp['Name'] = '{ProductName} {CSDVersion}'.format(**tmp) + if tmp['CurrentBuild'] == 9600: + tmp['Name'] += ' Update' # Win 8.1u + if tmp['CurrentBuild'] == 10240: + tmp['Name'] += ' Release 1507 "Threshold 1"' + if tmp['CurrentBuild'] == 10586: + tmp['Name'] += ' Release 1511 "Threshold 2"' + if tmp['CurrentBuild'] == 14393: + tmp['Name'] += ' Release 1607 "Redstone 1" / "Anniversary Update"' + if tmp['CurrentBuild'] == 15063: + tmp['Name'] += ' Release 1703 "Redstone 2" / "Creators Update"' + if tmp['CurrentBuild'] == 16299: + tmp['Name'] += ' Release 1709 "Redstone 3" / "Fall Creators Update"' + tmp['Name'] = tmp['Name'].replace('Service Pack ', 'SP') + tmp['Name'] = tmp['Name'].replace('Unknown Release', 'Release') + tmp['Name'] = re.sub(r'\s+', ' ', tmp['Name']) + + # Determine OS version + name = '{Name} x{Arch}'.format(**tmp) + if tmp['CurrentVersion'] == '6.0': + tmp['Version'] = 'Vista' + name += ' (very outdated)' + elif tmp['CurrentVersion'] == '6.1': + tmp['Version'] = '7' + if tmp['CSDVersion'] == 'Service Pack 1': + name += ' (outdated)' + else: + name += ' (very outdated)' + elif tmp['CurrentVersion'] in ['6.2', '6.3']: + if int(tmp['CurrentBuildNumber']) <= 9600: + tmp['Version'] = '8' + elif int(tmp['CurrentBuildNumber']) >= 10240: + tmp['Version'] = '10' + if tmp['CurrentBuild'] in [9200, 10240, 10586]: + name += ' (very outdated)' + elif tmp['CurrentBuild'] in [9600, 14393, 15063]: + name += ' (outdated)' + elif tmp['CurrentBuild'] == 16299: + pass # Current Win10 + else: + name += ' (unrecognized)' + tmp['DisplayName'] = name + + # == vista == + # 6.0.6000 + # 6.0.6001 + # 6.0.6002 + # ==== 7 ==== + # 6.1.7600 + # 6.1.7601 + # 6.1.7602 + # ==== 8 ==== + # 6.2.9200 + # === 8.1 === + # 6.3.9200 + # === 8.1u == + # 6.3.9600 + # === 10 v1507 "Threshold 1" == + # 6.3.10240 + # === 10 v1511 "Threshold 2" == + # 6.3.10586 + # === 10 v1607 "Redstone 1" "Anniversary Update" == + # 6.3.14393 + # === 10 v1703 "Redstone 2" "Creators Update" == + # 6.3.15063 + # === 10 v1709 "Redstone 3" "Fall Creators Update" == + # 6.3.16299 + global_vars['OS'] = tmp + +def check_tools(): + """Set tool variables based on OS bit-depth and tool availability.""" + if global_vars['OS'].get('Arch', 32) == 64: + global_vars['Tools'] = {k: v.get('64', v.get('32')) + for (k, v) in TOOLS.items()} + else: + global_vars['Tools'] = {k: v.get('32') for (k, v) in TOOLS.items()} + + # Fix paths + global_vars['Tools'] = {k: os.path.join(global_vars['BinDir'], v) + for (k, v) in global_vars['Tools'].items()} + +def clean_env_vars(): + """Remove conflicting global_vars and env variables. + + This fixes an issue where both global_vars and + global_vars['Env'] are expanded at the same time.""" + for key in global_vars.keys(): + global_vars['Env'].pop(key, None) + +def find_bin(): + """Find .bin folder in the cwd or it's parents.""" + wd = os.getcwd() + base = None + while base is None: + if os.path.exists('.bin'): + base = os.getcwd() + break + if re.fullmatch(r'\w:\\', os.getcwd()): + break + os.chdir('..') + os.chdir(wd) + if base is None: + raise BinNotFoundError + global_vars['BaseDir'] = base + +def make_tmp_dirs(): + """Make temp directories.""" + os.makedirs(global_vars['BackupDir'], exist_ok=True) + os.makedirs(global_vars['LogDir'], exist_ok=True) + os.makedirs(global_vars['TmpDir'], exist_ok=True) + +def set_common_vars(): + """Set common variables.""" + global_vars['Date'] = time.strftime("%Y-%m-%d") + global_vars['Date-Time'] = time.strftime("%Y-%m-%d_%H%M_%z") + global_vars['Env'] = os.environ.copy() + + global_vars['ArchivePassword'] = ARCHIVE_PASSWORD + global_vars['BinDir'] = r'{BaseDir}\.bin'.format( + **global_vars) + global_vars['CBinDir'] = r'{BaseDir}\.cbin'.format( + **global_vars) + global_vars['ClientDir'] = r'{SYSTEMDRIVE}\{prefix}'.format( + prefix=KIT_NAME_SHORT, **global_vars['Env']) + global_vars['BackupDir'] = r'{ClientDir}\Backups\{Date}'.format( + **global_vars) + global_vars['LogDir'] = r'{ClientDir}\Info\{Date}'.format( + **global_vars) + global_vars['ProgBackupDir'] = r'{ClientDir}\Backups'.format( + **global_vars) + global_vars['QuarantineDir'] = r'{ClientDir}\Quarantine'.format( + **global_vars) + global_vars['TmpDir'] = r'{BinDir}\tmp'.format( + **global_vars) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/data.py b/.bin/Scripts/functions/data.py new file mode 100644 index 00000000..aa2ae35c --- /dev/null +++ b/.bin/Scripts/functions/data.py @@ -0,0 +1,586 @@ +# Wizard Kit: Functions - Data + +import ctypes + +from operator import itemgetter + +from functions.common import * + +# Classes +class LocalDisk(): + def __init__(self, disk): + self.disk = disk + self.name = disk.mountpoint.upper() + self.path = self.name + def is_dir(self): + # Should always be true + return True + +# Regex +REGEX_EXCL_ITEMS = re.compile( + r'^(\.(AppleDB|AppleDesktop|AppleDouble' + r'|com\.apple\.timemachine\.supported|dbfseventsd' + r'|DocumentRevisions-V100.*|DS_Store|fseventsd|PKInstallSandboxManager' + r'|Spotlight.*|SymAV.*|symSchedScanLockxz|TemporaryItems|Trash.*' + r'|vol|VolumeIcon\.icns)|desktop\.(ini|.*DB|.*DF)' + r'|(hiberfil|pagefile)\.sys|lost\+found|Network\.*Trash\.*Folder' + r'|Recycle[dr]|System\.*Volume\.*Information|Temporary\.*Items' + r'|Thumbs\.db)$', + re.IGNORECASE) +REGEX_EXCL_ROOT_ITEMS = re.compile( + r'^\\?(boot(mgr|nxt)$|Config.msi' + r'|(eula|globdata|install|vc_?red)' + r'|.*.sys$|System Volume Information|RECYCLER?|\$Recycle\.bin' + r'|\$?Win(dows(.old.*|\.~BT|)$|RE_)|\$GetCurrent|Windows10Upgrade' + r'|PerfLogs|Program Files|SYSTEM.SAV' + r'|.*\.(esd|swm|wim|dd|map|dmg|image)$)', + re.IGNORECASE) +REGEX_INCL_ROOT_ITEMS = re.compile( + r'^\\?(AdwCleaner|(My\s*|)(Doc(uments?( and Settings|)|s?)|Downloads' + r'|{prefix}(-?Info|-?Transfer|)'.format(prefix=KIT_NAME_SHORT) + r'|Media|Music|Pic(ture|)s?|Vid(eo|)s?)' + r'|(ProgramData|Recovery|Temp.*|Users)$' + r'|.*\.(log|txt|rtf|qb\w*|avi|m4a|m4v|mp4|mkv|jpg|png|tiff?)$)', + re.IGNORECASE) +REGEX_WIM_FILE = re.compile( + r'\.wim$', + re.IGNORECASE) +REGEX_WINDOWS_OLD = re.compile( + r'^\\Win(dows|)\.old', + re.IGNORECASE) + +# STATIC VARIABLES +FAST_COPY_EXCLUDES = [ + r'\*.esd', + r'\*.swm', + r'\*.wim', + r'\*.dd', + r'\*.dd.tgz', + r'\*.dd.txz', + r'\*.map', + r'\*.dmg', + r'\*.image', + r'$RECYCLE.BIN', + r'$Recycle.Bin', + r'.AppleDB', + r'.AppleDesktop', + r'.AppleDouble', + r'.com.apple.timemachine.supported', + r'.dbfseventsd', + r'.DocumentRevisions-V100*', + r'.DS_Store', + r'.fseventsd', + r'.PKInstallSandboxManager', + r'.Spotlight*', + r'.SymAV*', + r'.symSchedScanLockxz', + r'.TemporaryItems', + r'.Trash*', + r'.vol', + r'.VolumeIcon.icns', + r'desktop.ini', + r'Desktop?DB', + r'Desktop?DF', + r'hiberfil.sys', + r'lost+found', + r'Network?Trash?Folder', + r'pagefile.sys', + r'Recycled', + r'RECYCLER', + r'System?Volume?Information', + r'Temporary?Items', + r'Thumbs.db', + ] +FAST_COPY_ARGS = [ + '/cmd=noexist_only', + '/utf8', + '/skip_empty_dir', + '/linkdest', + '/no_ui', + '/auto_close', + '/exclude='+';'.join(FAST_COPY_EXCLUDES), + ] +# Code borrowed from: https://stackoverflow.com/a/29075319 +SEM_NORMAL = ctypes.c_uint() +SEM_FAILCRITICALERRORS = 1 +SEM_NOOPENFILEERRORBOX = 0x8000 +SEM_FAIL = SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS + +def cleanup_transfer(dest_path): + """Fix attributes and move extraneous items outside the Transfer folder.""" + try: + # Remove dest_path if empty + os.rmdir(dest_path) + except OSError: + pass + if not os.path.exists(dest_path): + # Bail if dest_path was empty and removed + raise Exception + + # Fix attributes + cmd = ['attrib', '-a', '-h', '-r', '-s', dest_path] + run_program(cmd, check=False) + + for root, dirs, files in os.walk(dest_path, topdown=False): + for name in dirs: + # Remove empty directories and junction points + try: + os.rmdir(os.path.join(root, name)) + except OSError: + pass + for name in files: + # "Remove" files based on exclusion regex + if REGEX_EXCL_ITEMS.search(name): + # Make dest folder + dest_name = root.replace(dest_path, dest_path+'.Removed') + os.makedirs(dest_name, exist_ok=True) + # Set dest filename + dest_name = os.path.join(dest_name, name) + dest_name = non_clobber_rename(dest_name) + source_name = os.path.join(root, name) + try: + shutil.move(source_name, dest_name) + except Exception: + pass + +def is_valid_wim_file(item): + """Checks if the provided os.DirEntry is a valid WIM file, returns bool.""" + valid = bool(item.is_file() and REGEX_WIM_FILE.search(item.name)) + if valid: + extract_item('wimlib', silent=True) + cmd = [global_vars['Tools']['wimlib-imagex'], 'info', item.path] + try: + run_program(cmd) + except subprocess.CalledProcessError: + valid = False + print_log('WARNING: Image "{}" damaged.'.format(item.name)) + return valid + +def mount_backup_shares(): + """Mount the backup shares unless labeled as already mounted.""" + for server in BACKUP_SERVERS: + # Blindly skip if we mounted earlier + if server['Mounted']: + continue + + # Else, test connection + try: + ping(server['IP']) + except subprocess.CalledProcessError: + print_error( + r'Failed to mount \\{Name}\{Share}, {IP} unreachable.'.format( + **server)) + sleep(1) + continue # Continue to next server + + # Mount + cmd = r'net use \\{IP}\{Share} /user:{User} {Pass}'.format(**server) + cmd = cmd.split(' ') + try: + run_program(cmd) + except Exception: + print_warning(r'Failed to mount \\{Name}\{Share} ({IP})'.format( + **server)) + sleep(1) + else: + print_info('Mounted {Name}'.format(**server)) + server['Mounted'] = True + +def run_fast_copy(items, dest): + """Copy items to dest using FastCopy.""" + if not items: + raise Exception + + cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS] + if 'LogFile' in global_vars: + cmd.append('/logfile={LogFile}'.format(**global_vars)) + cmd.extend(items) + cmd.append('/to={}\\'.format(dest)) + + run_program(cmd) + +def run_wimextract(source, items, dest): + """Extract items from source WIM to dest folder.""" + if not items: + raise Exception + extract_item('wimlib', silent=True) + + # Write files.txt + with open(r'{TmpDir}\wim_files.txt'.format(**global_vars), 'w') as f: + # Defaults + for item in items: + f.write('{item}\n'.format(item=item)) + sleep(1) # For safety? + + # Extract files + cmd = [ + global_vars['Tools']['wimlib-imagex'], + 'extract', + source, '1', + r'@{TmpDir}\wim_files.txt'.format(**global_vars), + '--dest-dir={}\\'.format(dest), + '--no-acls', + '--nullglob'] + run_program(cmd) + +def scan_source(source_obj, dest_path): + """Scan source for files/folders to transfer.""" + selected_items = [] + + if source_obj.is_dir(): + # File-Based + print_standard('Scanning source (folder): {}'.format(source_obj.path)) + selected_items = scan_source_path(source_obj.path, dest_path) + else: + # Image-Based + if REGEX_WIM_FILE.search(source_obj.name): + print_standard('Scanning source (image): {}'.format( + source_obj.path)) + selected_items = scan_source_wim(source_obj.path, dest_path) + else: + print_error('ERROR: Unsupported image: {}'.format( + source_obj.path)) + raise GenericError + + return selected_items + +def scan_source_path(source_path, dest_path, rel_path=None, interactive=True): + """Scan source folder for files/folders to transfer. + + This will scan the root and (recursively) any Windows.old folders.""" + rel_path = '\\' + rel_path if rel_path else '' + if rel_path: + dest_path = dest_path + rel_path + selected_items = [] + win_olds = [] + + # Root items + root_items = [] + for item in os.scandir(source_path): + if REGEX_INCL_ROOT_ITEMS.search(item.name): + root_items.append(item.path) + elif not REGEX_EXCL_ROOT_ITEMS.search(item.name): + if (not interactive + or ask('Copy: "{}{}" ?'.format(rel_path, item.name))): + root_items.append(item.path) + if REGEX_WINDOWS_OLD.search(item.name): + win_olds.append(item) + if root_items: + selected_items.append({ + 'Message': '{}Root Items...'.format(rel_path), + 'Items': root_items.copy(), + 'Destination': dest_path}) + + # Fonts + if os.path.exists(r'{}\Windows\Fonts'.format(source_path)): + selected_items.append({ + 'Message': '{}Fonts...'.format(rel_path), + 'Items': [r'{}\Windows\Fonts'.format(rel_path)], + 'Destination': r'{}\Windows'.format(dest_path)}) + + # Registry + registry_items = [] + for folder in ['config', 'OEM']: + folder = r'Windows\System32\{}'.format(folder) + folder = os.path.join(source_path, folder) + if os.path.exists(folder): + registry_items.append(folder) + if registry_items: + selected_items.append({ + 'Message': '{}Registry...'.format(rel_path), + 'Items': registry_items.copy(), + 'Destination': r'{}\Windows\System32'.format(dest_path)}) + + # Windows.old(s) + for old in win_olds: + selected_items.append( + scan_source_path( + old.path, dest_path, rel_path=old.name, interactive=False)) + + # Done + return selected_items + +def scan_source_wim(source_wim, dest_path, rel_path=None, interactive=True): + """Scan source WIM file for files/folders to transfer. + + This will scan the root and (recursively) any Windows.old folders.""" + rel_path = '\\' + rel_path if rel_path else '' + selected_items = [] + win_olds = [] + + # Scan source + extract_item('wimlib', silent=True) + cmd = [ + global_vars['Tools']['wimlib-imagex'], 'dir', + source_wim, '1'] + try: + file_list = run_program(cmd) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to get file list.') + raise + + # Root Items + file_list = [i.strip() + for i in file_list.stdout.decode('utf-8', 'ignore').splitlines() + if i.count('\\') == 1 and i.strip() != '\\'] + root_items = [] + if rel_path: + file_list = [i.replace(rel_path, '') for i in file_list] + for item in file_list: + if REGEX_INCL_ROOT_ITEMS.search(item): + root_items.append(item) + elif not REGEX_EXCL_ROOT_ITEMS.search(item): + if (not interactive + or ask('Extract: "{}{}" ?'.format(rel_path, item))): + root_items.append('{}{}'.format(rel_path, item)) + if REGEX_WINDOWS_OLD.search(item): + win_olds.append(item) + if root_items: + selected_items.append({ + 'Message': '{}Root Items...'.format(rel_path), + 'Items': root_items.copy(), + 'Destination': dest_path}) + + # Fonts + if wim_contains(source_wim, r'{}Windows\Fonts'.format(rel_path)): + selected_items.append({ + 'Message': '{}Fonts...'.format(rel_path), + 'Items': [r'{}\Windows\Fonts'.format(rel_path)], + 'Destination': dest_path}) + + # Registry + registry_items = [] + for folder in ['config', 'OEM']: + folder = r'{}Windows\System32\{}'.format(rel_path, folder) + if wim_contains(source_wim, folder): + registry_items.append(folder) + if registry_items: + selected_items.append({ + 'Message': '{}Registry...'.format(rel_path), + 'Items': registry_items.copy(), + 'Destination': dest_path}) + + # Windows.old(s) + for old in win_olds: + scan_source_wim(source_wim, dest_path, rel_path=old, interactive=False) + + # Done + return selected_items + +def select_destination(folder_path, prompt='Select destination'): + """Select destination drive, returns path as string.""" + disk = select_disk(prompt) + if 'fixed' not in disk['Disk'].opts: + folder_path = folder_path.replace('\\', '-') + path = '{disk}{folder_path}_{Date}'.format( + disk = disk['Disk'].mountpoint, + folder_path = folder_path, + **global_vars) + + # Avoid merging with existing folder + path = non_clobber_rename(path) + os.makedirs(path, exist_ok=True) + + return path + +def select_disk(prompt='Select disk'): + """Select disk from attached disks. returns dict.""" + actions = [{'Name': 'Quit', 'Letter': 'Q'}] + disks = [] + set_thread_error_mode(silent=True) # Prevents "No disk" popups + for d in psutil.disk_partitions(): + info = { + 'Disk': d, + 'Name': d.mountpoint} + try: + usage = psutil.disk_usage(d.device) + free = '{free} / {total} available'.format( + free = human_readable_size(usage.free, 2), + total = human_readable_size(usage.total, 2)) + except Exception: + # Meh, leaving unsupported destinations out + pass + # free = 'Unknown' + # info['Disabled'] = True + else: + info['Display Name'] = '{} ({})'.format(info['Name'], free) + disks.append(info) + set_thread_error_mode(silent=False) # Return to normal + + selection = menu_select(prompt, disks, actions) + if selection == 'Q': + exit_script() + else: + return disks[int(selection)-1] + +def select_source(ticket_number): + """Select backup from those found on the BACKUP_SERVERS for the ticket.""" + selected_source = None + sources = [] + mount_backup_shares() + + # Check for ticket folders on servers + for server in BACKUP_SERVERS: + if server['Mounted']: + print_standard('Scanning {}...'.format(server['Name'])) + for d in os.scandir(r'\\{IP}\{Share}'.format(**server)): + if (d.is_dir() + and d.name.lower().startswith(ticket_number.lower())): + # Add folder to sources + sources.append({ + 'Name': '{:9}| File-Based: [DIR] {}'.format( + server['Name'], d.name), + 'Server': server, + 'Source': d}) + + # Check for images and subfolders + for ticket_path in sources.copy(): + for item in os.scandir(ticket_path['Source'].path): + if item.is_dir(): + # Add folder to sources + sources.append({ + 'Name': r'{:9}| File-Based: [DIR] {}\{}'.format( + ticket_path['Server']['Name'], # Server + ticket_path['Source'].name, # Ticket folder + item.name, # Sub-folder + ), + 'Server': ticket_path['Server'], + 'Source': item}) + + # Check for images in folder + for subitem in os.scandir(item.path): + if REGEX_WIM_FILE.search(item.name): + # Add image to sources + try: + size = human_readable_size(item.stat().st_size) + except Exception: + size = ' ? ?' # unknown + sources.append({ + 'Disabled': bool(not is_valid_wim_file(subitem)), + 'Name': r'{:9}| Image-Based: {:>7} {}\{}\{}'.format( + ticket_path['Server']['Name'], # Server + size, # Size (duh) + ticket_path['Source'].name, # Ticket folder + item.name, # Sub-folder + subitem.name, # Image file + ), + 'Server': ticket_path['Server'], + 'Source': subitem}) + elif REGEX_WIM_FILE.search(item.name): + # Add image to sources + try: + size = human_readable_size(item.stat().st_size) + except Exception: + size = ' ? ?' # unknown + sources.append({ + 'Disabled': bool(not is_valid_wim_file(item)), + 'Name': r'{:9}| Image-Based: {:>7} {}\{}'.format( + ticket_path['Server']['Name'], # Server + size, # Size (duh) + ticket_path['Source'].name, # Ticket folder + item.name, # Image file + ), + 'Server': ticket_path['Server'], + 'Source': item}) + # Check for local sources + print_standard('Scanning for local sources...') + set_thread_error_mode(silent=True) # Prevents "No disk" popups + sys_drive = global_vars['Env']['SYSTEMDRIVE'] + for d in psutil.disk_partitions(): + if re.search(r'^{}'.format(sys_drive), d.mountpoint, re.IGNORECASE): + # Skip current OS drive + continue + if 'fixed' in d.opts: + # Skip DVD, etc + sources.append({ + 'Name': '{:9}| File-Based: [DISK] {}'.format( + ' Local', d.mountpoint), + 'Source': LocalDisk(d)}) + set_thread_error_mode(silent=False) # Return to normal + + # Build Menu + sources.sort(key=itemgetter('Name')) + actions = [{'Name': 'Quit', 'Letter': 'Q'}] + + # Select backup from sources + if len(sources) > 0: + selection = menu_select('Which backup are we using?', + sources, actions, disabled_label='DAMAGED') + if selection == 'Q': + umount_backup_shares() + exit_script() + else: + selected_source = sources[int(selection)-1]['Source'] + else: + print_error('ERROR: No backups found for ticket: {}.'.format( + ticket_number)) + umount_backup_shares() + pause("Press Enter to exit...") + exit_script() + + # Done + return selected_source + +def set_thread_error_mode(silent=True): + """Disable or Enable Windows error message dialogs. + + Disable when scanning for disks to avoid popups for empty cardreaders, etc + """ + # Code borrowed from: https://stackoverflow.com/a/29075319 + kernel32 = ctypes.WinDLL('kernel32') + + if silent: + kernel32.SetThreadErrorMode(SEM_FAIL, ctypes.byref(SEM_NORMAL)) + else: + kernel32.SetThreadErrorMode(SEM_NORMAL, ctypes.byref(SEM_NORMAL)) + +def transfer_source(source_obj, dest_path, selected_items): + """Transfer, or extract, files/folders from source to destination.""" + if source_obj.is_dir(): + # Run FastCopy for each selection "group" + for group in selected_items: + try_and_print(message=group['Message'], + function=run_fast_copy, cs='Done', + items=group['Items'], + dest=group['Destination']) + else: + if REGEX_WIM_FILE.search(source_obj.name): + # Extract files from WIM + for group in selected_items: + try_and_print(message=group['Message'], + function=run_wimextract, cs='Done', + source=source_obj.path, + items=group['Items'], + dest=group['Destination']) + else: + print_error('ERROR: Unsupported image: {}'.format(source_obj.path)) + raise GenericError + +def umount_backup_shares(): + """Unnount the backup shares regardless of current status.""" + for server in BACKUP_SERVERS: + try: + # Umount + run_program(r'net use \\{IP}\{Share} /delete'.format(**server)) + print_info('Umounted {Name}'.format(**server)) + server['Mounted'] = False + except Exception: + print_error(r'Failed to umount \\{Name}\{Share}.'.format(**server)) + sleep(1) + +def wim_contains(source_path, file_path): + """Check if the WIM contains a file or folder.""" + _cmd = [ + global_vars['Tools']['wimlib-imagex'], 'dir', + source_path, '1', + '--path={}'.format(file_path), + '--one-file-only'] + try: + run_program(_cmd) + except subprocess.CalledProcessError: + return False + else: + return True + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/diags.py b/.bin/Scripts/functions/diags.py new file mode 100644 index 00000000..220eaff3 --- /dev/null +++ b/.bin/Scripts/functions/diags.py @@ -0,0 +1,114 @@ +# Wizard Kit: Functions - Diagnostics + +from functions.common import * + +# STATIC VARIABLES +AUTORUNS_SETTINGS = { + r'Software\Sysinternals\AutoRuns': { + 'checkvirustotal': 1, + 'EulaAccepted': 1, + 'shownomicrosoft': 1, + 'shownowindows': 1, + 'showonlyvirustotal': 1, + 'submitvirustotal': 0, + 'verifysignatures': 1, + }, + r'Software\Sysinternals\AutoRuns\SigCheck': { + 'EulaAccepted': 1, + }, + r'Software\Sysinternals\AutoRuns\Streams': { + 'EulaAccepted': 1, + }, + r'Software\Sysinternals\AutoRuns\VirusTotal': { + 'VirusTotalTermsAccepted': 1, + }, + } + +def check_connection(): + """Check if the system is online and optionally abort the script.""" + while True: + result = try_and_print(message='Ping test...', function=ping, cs='OK') + if result['CS']: + break + else: + if not ask('ERROR: System appears offline, try again?'): + if ask('Continue anyway?'): + break + else: + abort() + +def run_autoruns(): + """Run AutoRuns in the background with VirusTotal checks enabled.""" + extract_item('Autoruns', filter='autoruns*', silent=True) + # Update AutoRuns settings before running + for path, settings in AUTORUNS_SETTINGS.items(): + winreg.CreateKey(HKCU, path) + with winreg.OpenKey(HKCU, path, access=winreg.KEY_WRITE) as key: + for name, value in settings.items(): + winreg.SetValueEx(key, name, 0, winreg.REG_DWORD, value) + popen_program(global_vars['Tools']['AutoRuns'], minimized=True) + +def run_hwinfo_sensors(): + """Run HWiNFO sensors.""" + path = r'{BinDir}\HWiNFO'.format(**global_vars) + for bit in [32, 64]: + # Configure + source = r'{}\general.ini'.format(path) + dest = r'{}\HWiNFO{}.ini'.format(path, bit) + shutil.copy(source, dest) + with open(dest, 'a') as f: + f.write('SensorsOnly=1\n') + f.write('SummaryOnly=0\n') + popen_program(global_vars['Tools']['HWiNFO']) + +def run_xmplay(): + """Run XMPlay to test audio.""" + extract_item('XMPlay', silent=True) + cmd = [global_vars['Tools']['XMPlay'], + r'{BinDir}\XMPlay\music.7z'.format(**global_vars)] + popen_program(cmd) + +def run_hitmanpro(): + """Run HitmanPro in the background.""" + extract_item('HitmanPro', silent=True) + cmd = [ + global_vars['Tools']['HitmanPro'], + '/quiet', '/noinstall', '/noupload', + r'/log={LogDir}\hitman.xml'.format(**global_vars)] + popen_program(cmd) + +def run_process_killer(): + """Kill most running processes skipping those in the whitelist.txt.""" + # borrowed from TronScript (reddit.com/r/TronScript) + # credit to /u/cuddlychops06 + prev_dir = os.getcwd() + extract_item('ProcessKiller', silent=True) + os.chdir(r'{BinDir}\ProcessKiller'.format(**global_vars)) + run_program(['ProcessKiller.exe', '/silent'], check=False) + os.chdir(prev_dir) + +def run_rkill(): + """Run RKill and cleanup afterwards.""" + extract_item('RKill', silent=True) + cmd = [ + global_vars['Tools']['RKill'], + '-l', r'{LogDir}\RKill.log'.format(**global_vars), + '-new_console:n', '-new_console:s33V'] + run_program(cmd, check=False) + wait_for_process('RKill') + kill_process('notepad.exe') + + # RKill cleanup + desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env']) + if os.path.exists(desktop_path): + for item in os.scandir(desktop_path): + if re.search(r'^RKill', item.name, re.IGNORECASE): + dest = re.sub(r'^(.*)\.', '\1_{Date-Time}.'.format( + **global_vars), item.name) + dest = r'{ClientDir}\Info\{name}'.format( + name=dest, **global_vars) + dest = non_clobber_rename(dest) + shutil.move(item.path, dest) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/info.py b/.bin/Scripts/functions/info.py new file mode 100644 index 00000000..a96ec4a1 --- /dev/null +++ b/.bin/Scripts/functions/info.py @@ -0,0 +1,465 @@ +# Wizard Kit: Functions - Information + +from borrowed import knownpaths +from operator import itemgetter + +from functions.common import * +from functions.activation import * + +# Regex +REGEX_OFFICE = re.compile( + r'(Microsoft (Office\s+' + r'(365|Enterprise|Home|Pro(\s|fessional)' + r'|Single|Small|Standard|Starter|Ultimate|system)' + r'|Works[-\s\d]+\d)' + r'|(Libre|Open|Star)\s*Office' + r'|WordPerfect|Gnumeric|Abiword)', + re.IGNORECASE) + +# STATIC VARIABLES +REG_PROFILE_LIST = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' +REG_SHELL_FOLDERS = r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders' +TMP_HIVE_PATH = 'TEMP_HIVE_MOUNT' +EXTRA_FOLDERS = [ + 'Dropbox', + 'Google Drive', + 'OneDrive', + 'SkyDrive', +] +SHELL_FOLDERS = { + #GUIDs from: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx + 'Desktop': ( + '{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}', + ), + 'Documents': ( + 'Personal', + '{FDD39AD0-238F-46AF-ADB4-6C85480369C7}', + ), + 'Downloads': ( + '{374DE290-123F-4565-9164-39C4925E467B}', + ), + 'Favorites': ( + '{1777F761-68AD-4D8A-87BD-30B759FA33DD}', + ), + 'Music': ( + 'My Music', + '{4BD8D571-6D19-48D3-BE97-422220080E43}', + ), + 'Pictures': ( + 'My Pictures', + '{33E28130-4E1E-4676-835A-98395C3BC3BB}', + ), + 'Videos': ( + 'My Video', + '{18989B1D-99B5-455B-841C-AB7C74E4DDFC}', + ), +} + +def backup_file_list(): + """Export current file listing for the system.""" + extract_item('Everything', silent=True) + cmd = [ + global_vars['Tools']['Everything'], + '-nodb', + '-create-filelist', + r'{LogDir}\File List.txt'.format(**global_vars), + global_vars['Env']['SYSTEMDRIVE']] + run_program(cmd) + +def backup_power_plans(): + """Export current power plans.""" + os.makedirs(r'{BackupDir}\Power Plans'.format(**global_vars), exist_ok=True) + plans = run_program(['powercfg', '/L']) + plans = plans.stdout.decode().splitlines() + plans = [p for p in plans if re.search(r'^Power Scheme', p)] + for p in plans: + guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p) + name = re.sub( + r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p) + out = r'{BackupDir}\Power Plans\{name}.pow'.format( + name=name, **global_vars) + if not os.path.exists(out): + cmd = ['powercfg', '-export', out, guid] + run_program(cmd, check=False) + +def backup_registry(): + """Backup registry including user hives.""" + extract_item('erunt', silent=True) + cmd = [ + global_vars['Tools']['ERUNT'], + r'{LogDir}\Registry'.format(**global_vars), + 'sysreg', + 'curuser', + 'otherusers', + '/noprogresswindow'] + run_program(cmd) + +def get_folder_size(path): + """Get (human-readable) size of folder passed, returns str.""" + size = 'Unknown' + cmd = [global_vars['Tools']['Du'], '-nobanner', '-q', path] + try: + out = run_program(cmd) + except FileNotFoundError: + # Failed to find folder + pass + except subprocess.CalledProcessError: + # Failed to get folder size + pass + else: + size = out.stdout.decode().splitlines()[4] + size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) + size = size.replace(',', '') + size = human_readable_size(size) + return size + +def get_installed_office(): + """Get list of installed Office programs.""" + programs = [] + log_file = r'{LogDir}\Installed Program List (AIDA64).txt'.format( + **global_vars) + with open (log_file, 'r') as f: + for line in sorted(f.readlines()): + if REGEX_OFFICE.search(line): + programs.append(line[4:82].strip()) + + if len(programs) == 0: + programs = ['No programs found'] + return programs + +def get_shell_path(folder, user='current'): + """Get shell path using SHGetKnownFolderPath via knownpaths, returns str. + + NOTE: Only works for the current user. + Code based on https://gist.github.com/mkropat/7550097 + """ + path = None + folderid = None + if user.lower() == 'public': + user = 'common' + try: + folderid = getattr(knownpaths.FOLDERID, folder) + except AttributeError: + # Unknown folder ID, ignore and return None + pass + + if folderid: + try: + path = knownpaths.get_path(folderid, getattr(knownpaths.UserHandle, user)) + except PathNotFoundException: + # Folder not found, ignore and return None + pass + + return path + +def get_user_data_paths(user): + """Get user data paths for provided user, returns dict.""" + hive_path = user['SID'] + paths = { + 'Profile': { + 'Path': None, + }, + 'Shell Folders': {}, + 'Extra Folders': {}, + } + unload_hive = False + + if user['Name'] == global_vars['Env']['USERNAME']: + # We can use SHGetKnownFolderPath for the current user + paths['Profile']['Path'] = get_shell_path('Profile') + paths['Shell Folders'] = {f: {'Path': get_shell_path(f)} + for f in SHELL_FOLDERS.keys()} + else: + # We have to use the NTUSER.dat hives which isn't recommended by MS + try: + key_path = r'{}\{}'.format(REG_PROFILE_LIST, user['SID']) + with winreg.OpenKey(HKLM, key_path) as key: + paths['Profile']['Path'] = winreg.QueryValueEx( + key, 'ProfileImagePath')[0] + except Exception: + # Profile path not found, leaving as None. + pass + + # Shell folders (Prep) + if not reg_path_exists(HKU, hive_path) and paths['Profile']['Path']: + # User not logged-in, loading hive + # Also setting unload_hive so it will be unloaded later. + hive_path = TMP_HIVE_PATH + cmd = ['reg', 'load', r'HKU\{}'.format(TMP_HIVE_PATH), + r'{}\NTUSER.DAT'.format(paths['Profile']['Path'])] + unload_hive = True + try: + run_program(cmd) + except subprocess.CalledProcessError: + # Failed to load user hive + pass + + # Shell folders + shell_folders = r'{}\{}'.format(hive_path, REG_SHELL_FOLDERS) + if (reg_path_exists(HKU, hive_path) + and reg_path_exists(HKU, shell_folders)): + with winreg.OpenKey(HKU, shell_folders) as key: + for folder, values in SHELL_FOLDERS.items(): + for value in values: + try: + path = winreg.QueryValueEx(key, value)[0] + except FileNotFoundError: + # Skip missing values + pass + else: + paths['Shell Folders'][folder] = {'Path': path} + # Stop checking values for this folder + break + + # Shell folder (extra check) + if paths['Profile']['Path']: + for folder in SHELL_FOLDERS.keys(): + folder_path = r'{Path}\{folder}'.format( + folder=folder, **paths['Profile']) + if (folder not in paths['Shell Folders'] + and os.path.exists(folder_path)): + paths['Shell Folders'][folder] = {'Path': folder_path} + + # Extra folders + if paths['Profile']['Path']: + for folder in EXTRA_FOLDERS: + folder_path = r'{Path}\{folder}'.format( + folder=folder, **paths['Profile']) + if os.path.exists(folder_path): + paths['Extra Folders'][folder] = {'Path': folder_path} + + # Shell folders (cleanup) + if unload_hive: + cmd = ['reg', 'unload', r'HKU\{}'.format(TMP_HIVE_PATH)] + run_program(cmd, check=False) + + # Done + return paths + +def get_user_folder_sizes(users): + """Update list(users) to include folder paths and sizes.""" + extract_item('du', filter='du*', silent=True) + # Configure Du + winreg.CreateKey(HKCU, r'Software\Sysinternals\Du') + with winreg.OpenKey(HKCU, + r'Software\Sysinternals\Du', access=winreg.KEY_WRITE) as key: + winreg.SetValueEx(key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) + + for u in users: + u.update(get_user_data_paths(u)) + if u['Profile']['Path']: + u['Profile']['Size'] = get_folder_size(u['Profile']['Path']) + for folder in u['Shell Folders'].keys(): + u['Shell Folders'][folder]['Size'] = get_folder_size( + u['Shell Folders'][folder]['Path']) + for folder in u['Extra Folders'].keys(): + u['Extra Folders'][folder]['Size'] = get_folder_size( + u['Extra Folders'][folder]['Path']) + +def get_user_list(): + """Get user list via WMIC, returns list of dicts.""" + users = [] + + # Get user info from WMI + cmd = ['wmic', 'useraccount', 'get', '/format:csv'] + try: + out = run_program(cmd) + except subprocess.CalledProcessError: + # Meh, return empty list to avoid a full crash + return users + + entries = out.stdout.decode().splitlines() + entries = [e.strip().split(',') for e in entries if e.strip()] + + # Add user(s) to dict + keys = entries[0] + for e in entries[1:]: + # Create dict using 1st line (keys) + e = dict(zip(keys, e)) + # Set Active status via 'Disabled' TRUE/FALSE str + e['Active'] = bool(e['Disabled'].upper() == 'FALSE') + # Assume SIDs ending with 1000+ are "Standard" and others are "System" + e['Type'] = 'Standard' if re.search(r'-1\d+$', e['SID']) else 'System' + users.append(e) + + # Sort list + users.sort(key=itemgetter('Name')) + + # Done + return users + +def reg_path_exists(hive, path): + """Test if specified path exists, returns bool.""" + try: + winreg.QueryValue(hive, path) + except FileNotFoundError: + return False + else: + return True + +def run_aida64(): + """Run AIDA64 to save system reports.""" + extract_item('AIDA64', silent=True) + # All system info + config = r'{BinDir}\AIDA64\full.rpf'.format(**global_vars) + report_file = r'{LogDir}\System Information (AIDA64).html'.format( + **global_vars) + if not os.path.exists(report_file): + cmd = [ + global_vars['Tools']['AIDA64'], + '/R', report_file, + '/CUSTOM', config, + '/HTML', '/SILENT', '/SAFEST'] + run_program(cmd, check=False) + + # Installed Programs + config = r'{BinDir}\AIDA64\installed_programs.rpf'.format(**global_vars) + report_file = r'{LogDir}\Installed Program List (AIDA64).txt'.format( + **global_vars) + if not os.path.exists(report_file): + cmd = [ + global_vars['Tools']['AIDA64'], + '/R', report_file, + '/CUSTOM', config, + '/TEXT', '/SILENT', '/SAFEST'] + run_program(cmd, check=False) + + # Product Keys + config = r'{BinDir}\AIDA64\licenses.rpf'.format(**global_vars) + report_file = r'{LogDir}\Product Keys (AIDA64).txt'.format(**global_vars) + if not os.path.exists(report_file): + cmd = [ + global_vars['Tools']['AIDA64'], + '/R', report_file, + '/CUSTOM', config, + '/TEXT', '/SILENT', '/SAFEST'] + run_program(cmd, check=False) + +def run_bleachbit(): + """Run BleachBit preview and save log. + + This is a preview so no files should be deleted.""" + if not os.path.exists(global_vars['LogDir']+r'\BleachBit.log'): + extract_item('BleachBit', silent=True) + cmd = [global_vars['Tools']['BleachBit'], '--preview', '--preset'] + out = run_program(cmd, check=False) + # Save stderr + if out.stderr.decode().splitlines(): + with open(global_vars['LogDir']+r'\BleachBit.err', 'a') as f: + for line in out.stderr.decode().splitlines(): + f.write(line.strip() + '\n') + # Save stdout + with open(global_vars['LogDir']+r'\BleachBit.log', 'a') as f: + for line in out.stdout.decode().splitlines(): + f.write(line.strip() + '\n') + +def show_disk_usage(disk): + """Show free and used space for a specified disk.""" + print_standard(disk.device.replace('/', ' '), + end='', flush=True, timestamp=False) + try: + usage = psutil.disk_usage(disk.device) + display_string = '{percent:>5.2f}% Free ({free} / {total})'.format( + percent = 100 - usage.percent, + free = human_readable_size(usage.free, 2), + total = human_readable_size(usage.total, 2)) + if usage.percent > 85: + print_error(display_string, timestamp=False) + elif usage.percent > 75: + print_warning(display_string, timestamp=False) + else: + print_standard(display_string, timestamp=False) + except Exception: + print_warning('Unknown', timestamp=False) + +def show_free_space(indent=8, width=32): + """Show free space info for all fixed disks.""" + message = 'Free Space:' + for disk in psutil.disk_partitions(): + try: + if 'fixed' in disk.opts: + try_and_print(message=message, function=show_disk_usage, + ns='Unknown', silent_function=False, + indent=indent, width=width, disk=disk) + message = '' + except Exception: + pass + +def show_installed_ram(): + """Show installed RAM.""" + mem = psutil.virtual_memory() + if mem.total > 5905580032: + # > 5.5 Gb so 6Gb or greater + print_standard(human_readable_size(mem.total).strip()) + elif mem.total > 3758096384: + # > 3.5 Gb so 4Gb or greater + print_warning(human_readable_size(mem.total).strip()) + else: + print_error(human_readable_size(mem.total).strip()) + +def show_os_activation(): + """Show OS activation info.""" + act_str = get_activation_string() + if windows_is_activated(): + print_standard(act_str, timestamp=False) + elif re.search(r'unavailable', act_str, re.IGNORECASE): + print_warning(act_str, timestamp=False) + else: + print_error(act_str, timestamp=False) + +def show_os_name(): + """Show extended OS name (including warnings).""" + os_name = global_vars['OS']['DisplayName'] + if global_vars['OS']['Arch'] == 32: + # Show all 32-bit installs as an error message + print_error(os_name, timestamp=False) + else: + if re.search(r'(unrecognized|very outdated)', os_name, re.IGNORECASE): + print_error(os_name, timestamp=False) + elif re.search(r'outdated', os_name, re.IGNORECASE): + print_warning(os_name, timestamp=False) + else: + print_standard(os_name, timestamp=False) + +def show_temp_files_size(): + """Show total size of temp files identified by BleachBit.""" + size = None + with open(r'{LogDir}\BleachBit.log'.format(**global_vars), 'r') as f: + for line in f.readlines(): + if re.search(r'^disk space to be recovered:', line, re.IGNORECASE): + size = re.sub(r'.*: ', '', line.strip()) + size = re.sub(r'(\w)iB$', r' \1b', size) + if size is None: + print_warning(size, timestamp=False) + else: + print_standard(size, timestamp=False) + +def show_user_data_summary(indent=8, width=32): + """Print user data folder sizes for all users.""" + users = get_user_list() + users = [u for u in users if u['Active']] + get_user_folder_sizes(users) + for user in users: + print_success('{indent}User: {user}'.format( + indent = ' '*int(indent/2), + user = user['Name'])) + for section in ['Profile', None, 'Shell Folders', 'Extra Folders']: + folders = [] + if section is None: + # Divider + print_standard('{}{}'.format(' '*indent, '-'*(width+6))) + elif section == 'Profile': + folders = {'Profile': user['Profile']} + else: + folders = user[section] + for folder in folders: + print_standard( + '{indent}{folder:<{width}}{size:>6} ({path})'.format( + indent = ' ' * indent, + width = width, + folder = folder, + size = folders[folder]['Size'], + path = folders[folder]['Path'])) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/partition_uids.py b/.bin/Scripts/functions/partition_uids.py similarity index 99% rename from .bin/Scripts/partition_uids.py rename to .bin/Scripts/functions/partition_uids.py index a536a010..92d1c0d1 100644 --- a/.bin/Scripts/partition_uids.py +++ b/.bin/Scripts/functions/partition_uids.py @@ -1,4 +1,4 @@ -# Wizard Kit: - PARTITION UIDs +# Wizard Kit: Functions - PARTITION UIDs # sources: https://en.wikipedia.org/wiki/GUID_Partition_Table # https://en.wikipedia.org/wiki/Partition_type diff --git a/.bin/Scripts/functions/product_keys.py b/.bin/Scripts/functions/product_keys.py new file mode 100644 index 00000000..705f46e9 --- /dev/null +++ b/.bin/Scripts/functions/product_keys.py @@ -0,0 +1,111 @@ +# Wizard Kit: Functions - Product Keys + +from functions.common import * + +# Regex +REGEX_REGISTRY_DIRS = re.compile( + r'^(config$|RegBack$|System32$|Transfer|Win)', + re.IGNORECASE) +REGEX_SOFTWARE_HIVE = re.compile(r'^Software$', re.IGNORECASE) + +def extract_keys(): + """Extract keys from provided hives and return a dict.""" + keys = {} + + # Extract keys + extract_item('ProduKey', silent=True) + for hive in find_software_hives(): + cmd = [ + global_vars['Tools']['ProduKey'], + '/IEKeys', '0', + '/WindowsKeys', '1', + '/OfficeKeys', '1', + '/ExtractEdition', '1', + '/nosavereg', + '/regfile', hive, + '/scomma', ''] + try: + out = run_program(cmd) + except subprocess.CalledProcessError: + # Ignore and return empty dict + pass + else: + for line in out.stdout.decode().splitlines(): + # Add key to keys under product only if unique + tmp = line.split(',') + product = tmp[0] + key = tmp[2] + if product not in keys: + keys[product] = [] + if key not in keys[product]: + keys[product].append(key) + + # Done + return keys + +def list_clientdir_keys(): + """List product keys found in hives inside the ClientDir.""" + keys = extract_keys() + key_list = [] + if keys: + for product in sorted(keys): + key_list.append(product) + for key in sorted(keys[product]): + key_list.append(' {key}'.format(key=key)) + else: + key_list.append('No keys found.') + + return key_list + +def find_software_hives(): + """Search for transferred SW hives and return a list.""" + hives = [] + search_paths = [global_vars['ClientDir']] + + while len(search_paths) > 0: + for item in os.scandir(search_paths.pop(0)): + if item.is_dir() and REGEX_REGISTRY_DIRS.search(item.name): + search_paths.append(item.path) + if item.is_file() and REGEX_SOFTWARE_HIVE.search(item.name): + hives.append(item.path) + + return hives + +def get_product_keys(): + """List product keys from saved report.""" + keys = [] + log_file = r'{LogDir}\Product Keys (ProduKey).txt'.format(**global_vars) + with open (log_file, 'r') as f: + for line in f.readlines(): + if re.search(r'^Product Name', line): + line = re.sub(r'^Product Name\s+:\s+(.*)', r'\1', line.strip()) + keys.append(line) + + if keys: + return keys + else: + return ['No product keys found'] + +def run_produkey(): + """Run ProduKey and save report in the ClientDir.""" + extract_item('ProduKey', silent=True) + log_file = r'{LogDir}\Product Keys (ProduKey).txt'.format(**global_vars) + if not os.path.exists(log_file): + # Clear current configuration + for config in ['ProduKey.cfg', 'ProduKey64.cfg']: + config = r'{BinDir}\ProduKey\{config}'.format( + config=config, **global_vars) + try: + if os.path.exists(config): + os.remove(config) + except Exception: + pass + cmd = [ + global_vars['Tools']['ProduKey'], + '/nosavereg', + '/stext', + log_file] + run_program(cmd, check=False) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/repairs.py b/.bin/Scripts/functions/repairs.py new file mode 100644 index 00000000..bf9c3cdd --- /dev/null +++ b/.bin/Scripts/functions/repairs.py @@ -0,0 +1,126 @@ +# Wizard Kit: Functions - Repairs + +from functions.common import * + +def run_chkdsk(repair=False): + """Run CHKDSK scan or schedule offline repairs.""" + if repair: + run_chkdsk_offline() + else: + run_chkdsk_scan() + +def run_chkdsk_scan(): + """Run CHKDSK in a "split window" and report errors.""" + if global_vars['OS']['Version'] in ['8', '10']: + cmd = ['chkdsk', global_vars['Env']['SYSTEMDRIVE'], '/scan', '/perf'] + else: + cmd = ['chkdsk', global_vars['Env']['SYSTEMDRIVE']] + out = run_program(cmd, check=False) + # retcode == 0: no issues + # retcode == 1: fixed issues (also happens when chkdsk.exe is killed?) + # retcode == 2: issues + if int(out.returncode) > 0: + # print_error(' ERROR: CHKDSK encountered errors') + raise GenericError + + # Save stderr + with open(r'{LogDir}\CHKDSK.err'.format(**global_vars), 'a') as f: + for line in out.stderr.decode().splitlines(): + f.write(line.strip() + '\n') + # Save stdout + with open(r'{LogDir}\CHKDSK.log'.format(**global_vars), 'a') as f: + for line in out.stdout.decode().splitlines(): + f.write(line.strip() + '\n') + +def run_chkdsk_offline(): + """Set filesystem 'dirty bit' to force a chkdsk during next boot.""" + cmd = [ + 'fsutil', 'dirty', + 'set', + global_vars['Env']['SYSTEMDRIVE']] + out = run_program(cmd, check=False) + if int(out.returncode) > 0: + raise GenericError + +def run_dism(repair=False): + """Run DISM /RestoreHealth, then /CheckHealth, and then report errors.""" + if global_vars['OS']['Version'] in ['8', '10']: + if repair: + # Restore Health + cmd = [ + 'DISM', '/Online', + '/Cleanup-Image', '/RestoreHealth', + r'/LogPath:"{LogDir}\DISM_RestoreHealth.log"'.format( + **global_vars), + '-new_console:n', '-new_console:s33V'] + else: + # Scan Health + cmd = [ + 'DISM', '/Online', + '/Cleanup-Image', '/ScanHealth', + r'/LogPath:"{LogDir}\DISM_ScanHealth.log"'.format( + **global_vars), + '-new_console:n', '-new_console:s33V'] + run_program(cmd, pipe=False, check=False, shell=True) + wait_for_process('dism') + # Now check health + cmd = [ + 'DISM', '/Online', + '/Cleanup-Image', '/CheckHealth', + r'/LogPath:"{LogDir}\DISM_CheckHealth.log"'.format(**global_vars)] + result = run_program(cmd, shell=True).stdout.decode() + # Check result + if 'no component store corruption detected' not in result.lower(): + raise GenericError + else: + raise UnsupportedOSError + +def run_kvrt(): + """Run KVRT.""" + extract_item('KVRT', silent=True) + os.makedirs(global_vars['QuarantineDir'], exist_ok=True) + cmd = [ + global_vars['Tools']['KVRT'], + '-accepteula', '-dontcryptsupportinfo', '-fixednames', + '-d', global_vars['QuarantineDir'], + '-processlevel', '3'] + popen_program(cmd, pipe=False) + +def run_sfc_scan(): + """Run SFC in a "split window" and report errors.""" + cmd = [ + r'{SYSTEMROOT}\System32\sfc.exe'.format(**global_vars['Env']), + '/scannow'] + out = run_program(cmd, check=False) + # Save stderr + with open(r'{LogDir}\SFC.err'.format(**global_vars), 'a') as f: + for line in out.stderr.decode('utf-8', 'ignore').splitlines(): + f.write(line.strip() + '\n') + # Save stdout + with open(r'{LogDir}\SFC.log'.format(**global_vars), 'a') as f: + for line in out.stdout.decode('utf-8', 'ignore').splitlines(): + f.write(line.strip() + '\n') + # Check result + log_text = out.stdout.decode('utf-8', 'ignore').replace('\0', '') + if re.findall(r'did\s+not\s+find\s+any\s+integrity\s+violations', log_text): + pass + elif re.findall(r'successfully\s+repaired\s+them', log_text): + raise GenericRepair + else: + raise GenericError + +def run_tdsskiller(): + """Run TDSSKiller.""" + extract_item('TDSSKiller', silent=True) + os.makedirs(r'{QuarantineDir}\TDSSKiller'.format( + **global_vars), exist_ok=True) + cmd = [ + global_vars['Tools']['TDSSKiller'], + '-l', r'{LogDir}\TDSSKiller.log'.format(**global_vars), + '-qpath', r'{QuarantineDir}\TDSSKiller'.format(**global_vars), + '-accepteula', '-accepteulaksn', + '-dcexact', '-tdlfs'] + run_program(cmd, pipe=False) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py new file mode 100644 index 00000000..cc81e892 --- /dev/null +++ b/.bin/Scripts/functions/setup.py @@ -0,0 +1,277 @@ +# Wizard Kit: Functions - Setup + +from functions.common import * + +# STATIC VARIABLES +HKCU = winreg.HKEY_CURRENT_USER +HKLM = winreg.HKEY_LOCAL_MACHINE +SETTINGS_CLASSIC_START = { + r'Software\IvoSoft\ClassicShell\Settings': {}, + r'Software\IvoSoft\ClassicStartMenu': { + 'DWORD Items': {'ShowedStyle2': 1}, + }, + r'Software\IvoSoft\ClassicStartMenu\MRU': {}, + r'Software\IvoSoft\ClassicStartMenu\Settings': { + 'DWORD Items': {'SkipMetro': 1}, + 'SZ Items': { + 'MenuStyle': 'Win7', + 'RecentPrograms': 'Recent', + }, + }, + } +SETTINGS_EXPLORER_SYSTEM = { + # Disable Telemetry + r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection': { + 'DWORD Items': {'AllowTelemetry': 0}, + }, + r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection': { + 'DWORD Items': {'AllowTelemetry': 0}, + 'WOW64_32': True, + }, + r'SOFTWARE\Policies\Microsoft\Windows\DataCollection': { + 'DWORD Items': {'AllowTelemetry': 0}, + }, + # Disable Wi-Fi Sense + r'Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting': { + 'DWORD Items': {'Value': 0}, + }, + r'Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots': { + 'DWORD Items': {'Value': 0}, + }, + # Disable Location Tracking + r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}': { + 'DWORD Items': {'SensorPermissionState': 0}, + }, + r'System\CurrentControlSet\Services\lfsvc\Service\Configuration': { + 'Status': {'Value': 0}, + }, + } +SETTINGS_EXPLORER_USER = { + # Disable Cortana + r'Software\Microsoft\Personalization\Settings': { + 'DWORD Items': {'AcceptedPrivacyPolicy': 0}, + }, + r'Software\Microsoft\InputPersonalization': { + 'DWORD Items': { + 'RestrictImplicitTextCollection': 1, + 'RestrictImplicitInkCollection': 1 + }, + }, + r'Software\Microsoft\InputPersonalization\TrainedDataStore': { + 'DWORD Items': {'HarvestContacts': 1}, + }, + # Hide Search button / box + r'Software\Microsoft\Windows\CurrentVersion\Search': { + 'DWORD Items': {'SearchboxTaskbarMode': 0}, + }, + # Change default Explorer view to "Computer" + r'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced': { + 'DWORD Items': {'LaunchTo': 1}, + }, + } +SETTINGS_GOOGLE_CHROME = { + r'Software\Google\Chrome\Extensions': { + 'WOW64_32': True, + }, + r'Software\Google\Chrome\Extensions\cjpalhdlnbpafiamejdnhcphjbkeiagm': { + 'SZ Items': { + 'update_url': 'https://clients2.google.com/service/update2/crx'}, + 'WOW64_32': True, + }, + r'Software\Google\Chrome\Extensions\pgdnlhfefecpicbbihgmbmffkjpaplco': { + 'SZ Items': { + 'update_url': 'https://clients2.google.com/service/update2/crx'}, + 'WOW64_32': True, + }, + } +VCR_REDISTS = [ + {'Name': 'Visual C++ 2005 SP1 x32...', + 'Cmd': ['msiexec', '/i', r'2005sp1\x86\vcredist.msi', + '/qb!', '/norestart']}, + {'Name': 'Visual C++ 2005 SP1 x64...', + 'Cmd': ['msiexec', '/i', r'2005sp1\x64\vcredist.msi', + '/qb!', '/norestart']}, + {'Name': 'Visual C++ 2008 SP1 x32...', + 'Cmd': [r'2008sp1\vcredist_x86.exe', '/qb! /norestart']}, + {'Name': 'Visual C++ 2008 SP1 x64...', + 'Cmd': [r'2008sp1\vcredist_x64.exe', '/qb! /norestart']}, + {'Name': 'Visual C++ 2010 x32...', + 'Cmd': [r'2010\vcredist_x86.exe', '/passive', '/norestart']}, + {'Name': 'Visual C++ 2010 x64...', + 'Cmd': [r'2010\vcredist_x64.exe', '/passive', '/norestart']}, + {'Name': 'Visual C++ 2012 Update 4 x32...', + 'Cmd': [r'2012u4\vcredist_x86.exe', '/passive', '/norestart']}, + {'Name': 'Visual C++ 2012 Update 4 x64...', + 'Cmd': [r'2012u4\vcredist_x64.exe', '/passive', '/norestart']}, + {'Name': 'Visual C++ 2013 x32...', + 'Cmd': [r'2013\vcredist_x86.exe', '/install', + '/passive', '/norestart']}, + {'Name': 'Visual C++ 2013 x64...', + 'Cmd': [r'2013\vcredist_x64.exe', '/install', + '/passive', '/norestart']}, + {'Name': 'Visual C++ 2015 Update 3 x32...', + 'Cmd': [r'2015u3\vc_redist.x86.exe', '/install', + '/passive', '/norestart']}, + {'Name': 'Visual C++ 2015 Update 3 x64...', + 'Cmd': [r'2015u3\vc_redist.x64.exe', '/install', + '/passive', '/norestart']}] + +def config_classicstart(): + """Configure ClassicStart.""" + # User level, not system level + cs_exe = r'{PROGRAMFILES}\Classic Shell\ClassicStartMenu.exe'.format( + **global_vars['Env']) + skin = r'{PROGRAMFILES}\Classic Shell\Skins\Metro-Win10-Black.skin7'.format( + **global_vars['Env']) + extract_item('ClassicStartSkin', silent=True) + + # Stop Classic Start + run_program([cs_exe, '-exit'], check=False) + sleep(1) + kill_process('ClassicStartMenu.exe') + + # Configure + write_registry_settings(SETTINGS_CLASSIC_START, all_users=False) + if global_vars['OS']['Version'] == '10' and os.path.exists(skin): + # Enable Win10 theme if on Win10 + key_path = r'Software\IvoSoft\ClassicStartMenu\Settings' + with winreg.OpenKey(HKCU, key_path, access=winreg.KEY_WRITE) as key: + winreg.SetValueEx( + key, 'SkinW7', 0, winreg.REG_SZ, 'Metro-Win10-Black') + winreg.SetValueEx(key, 'SkinVariationW7', 0, winreg.REG_SZ, '') + + # Pin Browser to Start Menu (Classic) + firefox = r'{PROGRAMDATA}\Start Menu\Programs\Mozilla Firefox.lnk'.format( + **global_vars['Env']) + chrome = r'{PROGRAMDATA}\Start Menu\Programs\Google Chrome.lnk'.format( + **global_vars['Env']) + dest_path = r'{APPDATA}\ClassicShell\Pinned'.format(**global_vars['Env']) + source = None + dest = None + if os.path.exists(firefox): + source = firefox + dest = r'{}\Mozilla Firefox.lnk'.format(dest_path) + elif os.path.exists(chrome): + source = chrome + dest = r'{}\Google Chrome.lnk'.format(dest_path) + if source: + try: + os.makedirs(dest_path, exist_ok=True) + shutil.copy(source, dest) + except Exception: + pass # Meh, it's fine without + + # (Re)start Classic Start + run_program([cs_exe, '-exit'], check=False) + sleep(1) + kill_process('ClassicStartMenu.exe') + sleep(1) + popen_program(cs_exe) + +def write_registry_settings(settings, all_users=False): + """Write registry values from custom dict of dicts.""" + hive = HKCU + if all_users: + hive = HKLM + for k, v in settings.items(): + # CreateKey + access = winreg.KEY_WRITE + if 'WOW64_32' in v: + access = access | winreg.KEY_WOW64_32KEY + winreg.CreateKeyEx(hive, k, 0, access) + + # Create values + with winreg.OpenKeyEx(hive, k, 0, access) as key: + for name, value in v.get('DWORD Items', {}).items(): + winreg.SetValueEx(key, name, 0, winreg.REG_DWORD, value) + for name, value in v.get('SZ Items', {}).items(): + winreg.SetValueEx(key, name, 0, winreg.REG_SZ, value) + +def config_explorer_system(): + """Configure Windows Explorer for all users via Registry settings.""" + write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True) + +def config_explorer_user(): + """Configure Windows Explorer for current user via Registry settings.""" + write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False) + +def update_clock(): + """Set Timezone and sync clock.""" + run_program(['tzutil' ,'/s', TIME_ZONE], check=False) + run_program(['net', 'stop', 'w32ime'], check=False) + run_program( + ['w32tm', '/config', '/syncfromflags:manual', + '/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"', + ], + check=False) + run_program(['net', 'start', 'w32ime'], check=False) + run_program(['w32tm', '/resync', '/nowait'], check=False) + +# Installations +def install_adobe_reader(): + """Install Adobe Reader.""" + cmd = [ + r'{BaseDir}\Installers\Extras\Office\Adobe Reader DC.exe'.format( + **global_vars), + '/sAll', + '/msi', '/norestart', '/quiet', + 'ALLUSERS=1', + 'EULA_ACCEPT=YES'] + try_and_print(message='Adobe Reader DC...', function=run_program, cmd=cmd) + +def install_chrome_extensions(): + """Update registry to 'install' Google Chrome extensions for all users.""" + write_registry_settings(SETTINGS_GOOGLE_CHROME, all_users=True) + +def install_classicstart_skin(): + """Extract ClassicStart skin to installation folder.""" + if global_vars['OS']['Version'] not in ['8', '10']: + raise UnsupportedOSError + extract_item('ClassicStartSkin', silent=True) + source = r'{BinDir}\ClassicStartSkin\Metro-Win10-Black.skin7'.format( + **global_vars) + dest_path = r'{PROGRAMFILES}\Classic Shell\Skins'.format( + **global_vars['Env']) + dest = r'{}\Metro-Win10-Black.skin7'.format(dest_path) + os.makedirs(dest_path, exist_ok=True) + shutil.copy(source, dest) + +def install_firefox_extensions(): + """Extract Firefox extensions to installation folder.""" + dist_path = r'{PROGRAMFILES}\Mozilla Firefox\distribution\extensions'.format( + **global_vars['Env']) + # Extract extension(s) to distribution folder + cmd = [ + global_vars['Tools']['SevenZip'], 'x', '-aos', '-bso0', '-bse0', + '-p{ArchivePassword}'.format(**global_vars), + '-o{dist_path}'.format(dist_path=dist_path), + r'{CBinDir}\FirefoxExtensions.7z'.format(**global_vars)] + run_program(cmd, check=False) + +def install_ninite_bundle(mse=False): + """Run Ninite file(s) based on OS version.""" + if global_vars['OS']['Version'] in ['8', '10']: + # Modern selection + popen_program(r'{BaseDir}\Installers\Extras\Bundles\Modern.exe'.format( + **global_vars)) + else: + # Legacy selection + if mse: + cmd = r'{BaseDir}\Installers\Extras\Security'.format(**global_vars) + cmd += r'\Microsoft Security Essentials.exe' + popen_program(cmd) + popen_program(r'{BaseDir}\Installers\Extras\Bundles\Legacy.exe'.format( + **global_vars)) + +def install_vcredists(): + """Install all supported Visual C++ runtimes.""" + extract_item('_vcredists', silent=True) + prev_dir = os.getcwd() + os.chdir(r'{BinDir}\_vcredists'.format(**global_vars)) + for vcr in VCR_REDISTS: + try_and_print(message=vcr['Name'], function=run_program, cmd=vcr['Cmd']) + + os.chdir(prev_dir) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/gen_office.bash b/.bin/Scripts/gen_office.bash deleted file mode 100644 index 2edf109f..00000000 --- a/.bin/Scripts/gen_office.bash +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -cd ../../ -mkdir Installers/Extras/Office -p -pushd Installers/Extras/Office -mkdir 2010 -mkdir 2013 -mkdir 2016 - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Outlook 2010 (SP2) (x32).cmd" -sed -ir 's/__TYPE__/Office/' "2010/Outlook 2010 (SP2) (x32).cmd" -sed -ir 's/__PATH__/2010/' "2010/Outlook 2010 (SP2) (x32).cmd" -sed -ir 's/__ITEM__/Outlook 2010 (SP2) (x32)/' "2010/Outlook 2010 (SP2) (x32).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Outlook 2010 (SP2) (x64).cmd" -sed -ir 's/__TYPE__/Office/' "2010/Outlook 2010 (SP2) (x64).cmd" -sed -ir 's/__PATH__/2010/' "2010/Outlook 2010 (SP2) (x64).cmd" -sed -ir 's/__ITEM__/Outlook 2010 (SP2) (x64)/' "2010/Outlook 2010 (SP2) (x64).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Professional Plus 2010 (SP2).cmd" -sed -ir 's/__TYPE__/Office/' "2010/Professional Plus 2010 (SP2).cmd" -sed -ir 's/__PATH__/2010/' "2010/Professional Plus 2010 (SP2).cmd" -sed -ir 's/__ITEM__/Professional Plus 2010 (SP2)/' "2010/Professional Plus 2010 (SP2).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Publisher 2010 (SP2).cmd" -sed -ir 's/__TYPE__/Office/' "2010/Publisher 2010 (SP2).cmd" -sed -ir 's/__PATH__/2010/' "2010/Publisher 2010 (SP2).cmd" -sed -ir 's/__ITEM__/Publisher 2010 (SP2)/' "2010/Publisher 2010 (SP2).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Single Image 2010 (SP2).cmd" -sed -ir 's/__TYPE__/Office/' "2010/Single Image 2010 (SP2).cmd" -sed -ir 's/__PATH__/2010/' "2010/Single Image 2010 (SP2).cmd" -sed -ir 's/__ITEM__/Single Image 2010 (SP2)/' "2010/Single Image 2010 (SP2).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Business 2013 (x64).cmd" -sed -ir 's/__TYPE__/Office/' "2013/Home and Business 2013 (x64).cmd" -sed -ir 's/__PATH__/2013/' "2013/Home and Business 2013 (x64).cmd" -sed -ir 's/__ITEM__/hb_64.xml/' "2013/Home and Business 2013 (x64).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Student 2013 (x64).cmd" -sed -ir 's/__TYPE__/Office/' "2013/Home and Student 2013 (x64).cmd" -sed -ir 's/__PATH__/2013/' "2013/Home and Student 2013 (x64).cmd" -sed -ir 's/__ITEM__/hs_64.xml/' "2013/Home and Student 2013 (x64).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Business 2013 (x32).cmd" -sed -ir 's/__TYPE__/Office/' "2013/Home and Business 2013 (x32).cmd" -sed -ir 's/__PATH__/2013/' "2013/Home and Business 2013 (x32).cmd" -sed -ir 's/__ITEM__/hb_32.xml/' "2013/Home and Business 2013 (x32).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Student 2013 (x32).cmd" -sed -ir 's/__TYPE__/Office/' "2013/Home and Student 2013 (x32).cmd" -sed -ir 's/__PATH__/2013/' "2013/Home and Student 2013 (x32).cmd" -sed -ir 's/__ITEM__/hs_32.xml/' "2013/Home and Student 2013 (x32).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Business 2016 (x64).cmd" -sed -ir 's/__TYPE__/Office/' "2016/Home and Business 2016 (x64).cmd" -sed -ir 's/__PATH__/2016/' "2016/Home and Business 2016 (x64).cmd" -sed -ir 's/__ITEM__/hb_64.xml/' "2016/Home and Business 2016 (x64).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Student 2016 (x64).cmd" -sed -ir 's/__TYPE__/Office/' "2016/Home and Student 2016 (x64).cmd" -sed -ir 's/__PATH__/2016/' "2016/Home and Student 2016 (x64).cmd" -sed -ir 's/__ITEM__/hs_64.xml/' "2016/Home and Student 2016 (x64).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Office 365 2016 (x64).cmd" -sed -ir 's/__TYPE__/Office/' "2016/Office 365 2016 (x64).cmd" -sed -ir 's/__PATH__/2016/' "2016/Office 365 2016 (x64).cmd" -sed -ir 's/__ITEM__/365_64.xml/' "2016/Office 365 2016 (x64).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Business 2016 (x32).cmd" -sed -ir 's/__TYPE__/Office/' "2016/Home and Business 2016 (x32).cmd" -sed -ir 's/__PATH__/2016/' "2016/Home and Business 2016 (x32).cmd" -sed -ir 's/__ITEM__/hb_32.xml/' "2016/Home and Business 2016 (x32).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Student 2016 (x32).cmd" -sed -ir 's/__TYPE__/Office/' "2016/Home and Student 2016 (x32).cmd" -sed -ir 's/__PATH__/2016/' "2016/Home and Student 2016 (x32).cmd" -sed -ir 's/__ITEM__/hs_32.xml/' "2016/Home and Student 2016 (x32).cmd" - -cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Office 365 2016 (x32).cmd" -sed -ir 's/__TYPE__/Office/' "2016/Office 365 2016 (x32).cmd" -sed -ir 's/__PATH__/2016/' "2016/Office 365 2016 (x32).cmd" -sed -ir 's/__ITEM__/365_32.xml/' "2016/Office 365 2016 (x32).cmd" -popd diff --git a/.bin/Scripts/init_client_dir.cmd b/.bin/Scripts/init_client_dir.cmd index e3225415..0cc973cf 100644 --- a/.bin/Scripts/init_client_dir.cmd +++ b/.bin/Scripts/init_client_dir.cmd @@ -3,19 +3,33 @@ @echo off if defined DEBUG (@echo on) +:SafetyCheck +if not defined bin (goto Abort) + +:Init +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_SHORT %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_SHORT=!_v:~0,-1!" +) +set "client_dir=%systemdrive%\%KIT_NAME_SHORT%" +set "log_dir=%client_dir%\Info\%iso_date%" + :Flags set _backups= set _info= set _office= set _quarantine= +set _quickbooks= set _transfer= for %%f in (%*) do ( if /i "%%f" == "/DEBUG" (@echo on) if /i "%%f" == "/Backups" set _backups=True if /i "%%f" == "/Info" set _info=True if /i "%%f" == "/Office" set _office=True - if /i "%%f" == "/QuickBooks" set _quickbooks=True if /i "%%f" == "/Quarantine" set _quarantine=True + if /i "%%f" == "/QuickBooks" set _quickbooks=True if /i "%%f" == "/Transfer" set _transfer=True ) @@ -38,17 +52,25 @@ set _hour=%_hour:~-2% set _minute=%_minute:~-2% set iso_date=%_yyyy%-%_mm%-%_dd% -:SetVariables -set "client_dir=%systemdrive%\WK" -set "log_dir=%client_dir%\Info\%iso_date%" - :CreateDirs if defined _backups mkdir "%client_dir%\Backups">nul 2>&1 if defined _info mkdir "%client_dir%\Info">nul 2>&1 if defined _office mkdir "%client_dir%\Office">nul 2>&1 -if defined _quickbooks mkdir "%client_dir%\QuickBooks">nul 2>&1 if defined _quarantine mkdir "%client_dir%\Quarantine">nul 2>&1 +if defined _quickbooks mkdir "%client_dir%\QuickBooks">nul 2>&1 if defined _transfer mkdir "%client_dir%\Transfer_%iso_date%">nul 2>&1 +goto Done + +:Abort +color 4e +echo Aborted. +echo. +echo Press any key to exit... +pause>nul +color +rem Set errorlevel to 1 by calling color incorrectly +color 00 +goto Exit :Done goto Exit diff --git a/.bin/Scripts/install_sw_bundle.py b/.bin/Scripts/install_sw_bundle.py index 0a75c2d5..9eefe056 100644 --- a/.bin/Scripts/install_sw_bundle.py +++ b/.bin/Scripts/install_sw_bundle.py @@ -5,11 +5,11 @@ import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: SW Bundle Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.setup import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\Install SW Bundle.log'.format(**global_vars) +os.system('title {}: SW Bundle Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\Install SW Bundle.log'.format(**global_vars) if __name__ == '__main__': try: @@ -23,7 +23,7 @@ if __name__ == '__main__': 'GenericRepair': 'Repaired', 'UnsupportedOSError': 'Unsupported OS', }} - answer_wk_extensions = ask('Install WK Extensions?') + answer_extensions = ask('Install Extensions?') answer_adobe_reader = ask('Install Adobe Reader?') answer_vcr = ask('Install Visual C++ Runtimes?') if global_vars['OS']['Version'] in ['7']: @@ -32,17 +32,22 @@ if __name__ == '__main__': else: answer_mse = False - if answer_wk_extensions: - print_info('Installing WK Extensions') - try_and_print(message='Classic Shell skin...', function=install_classicstart_skin, other_results=other_results) - try_and_print(message='Google Chrome extensions...', function=install_chrome_extensions) - try_and_print(message='Mozilla Firefox extensions...', function=install_firefox_extensions) + if answer_extensions: + print_info('Installing Extensions') + try_and_print(message='Classic Shell skin...', + function=install_classicstart_skin, + other_results=other_results) + try_and_print(message='Google Chrome extensions...', + function=install_chrome_extensions) + try_and_print(message='Mozilla Firefox extensions...', + function=install_firefox_extensions) print_info('Installing Programs') if answer_adobe_reader: install_adobe_reader() if answer_vcr: install_vcredists() - try_and_print(message='Ninite bundle...', cs='Started', function=install_ninite_bundle, mse=answer_mse) + try_and_print(message='Ninite bundle...', + function=install_ninite_bundle, cs='Started', mse=answer_mse) print_standard('\nDone.') exit_script() except SystemExit: diff --git a/.bin/Scripts/safemode_enter.py b/.bin/Scripts/safemode_enter.py index c745f0b3..48fe4cc2 100644 --- a/.bin/Scripts/safemode_enter.py +++ b/.bin/Scripts/safemode_enter.py @@ -3,25 +3,34 @@ import os import sys +# STATIC VARIABLES +REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' + # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: SafeMode Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.common import * +init_global_vars() +os.system('title {}: SafeMode Tool'.format(KIT_NAME_FULL)) if __name__ == '__main__': try: if ask('Enable booting to SafeMode (with Networking)?'): # Edit BCD to set safeboot as default - run_program('bcdedit /set {default} safeboot network', check=False) + cmd = ['bcdedit', '/set', '{default}', 'safeboot', 'network'] + run_program(cmd, check=False) # Enable MSI access under safemode - run_program(r'reg add HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer /f', check=False) - run_program(r'reg add HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer /ve /t REG_SZ /d "Service" /f', check=False) + cmd = ['reg', 'add', REG_MSISERVER, '/f'] + run_program(cmd, check=False) + cmd = ['reg', 'add', REG_MSISERVER, '/ve', + '/t', 'REG_SZ', '/d', 'Service', '/f'] + run_program(cmd, check=False) ## Done ## pause('Press Enter to reboot...') - run_program('shutdown -r -t 3', check=False) + cmd = ['shutdown', '-r', '-t', '3'] + run_program(cmd, check=False) # Done exit_script() diff --git a/.bin/Scripts/safemode_exit.py b/.bin/Scripts/safemode_exit.py index 23431f06..579fa98a 100644 --- a/.bin/Scripts/safemode_exit.py +++ b/.bin/Scripts/safemode_exit.py @@ -3,25 +3,32 @@ import os import sys +# STATIC VARIABLES +REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' + # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: SafeMode Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.common import * +init_global_vars() +os.system('title {}: SafeMode Tool'.format(KIT_NAME_FULL)) if __name__ == '__main__': try: if ask('Disable booting to SafeMode?'): # Edit BCD to remove safeboot value - run_program('bcdedit /deletevalue {current} safeboot', check=False) - run_program('bcdedit /deletevalue {default} safeboot', check=False) + for boot in ['{current}', '{default}']: + cmd = ['bcdedit', '/deletevalue', boot, 'safeboot'] + run_program(cmd, check=False) # Disable MSI access under safemode - run_program(r'reg delete HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer /f', check=False) + cmd = ['reg', 'delete', REG_MSISERVER, '/f'] + run_program(cmd, check=False) ## Done ## pause('Press Enter to reboot...') - run_program('shutdown -r -t 3', check=False) + cmd = ['shutdown', '-r', '-t', '3'] + run_program(cmd, check=False) # Done exit_script() diff --git a/.bin/Scripts/settings/main.py b/.bin/Scripts/settings/main.py new file mode 100644 index 00000000..d797f9c1 --- /dev/null +++ b/.bin/Scripts/settings/main.py @@ -0,0 +1,68 @@ +# Wizard Kit: Settings - Main / Branding + +# Features +ENABLED_UPLOAD_DATA = False + +# STATIC VARIABLES (also used by .cmd files) +## Not using spaces aroung '=' for easier .cmd substrings +ARCHIVE_PASSWORD='Abracadabra' +KIT_NAME_FULL='Wizard Kit' +KIT_NAME_SHORT='WK' +OFFICE_SERVER_IP='10.0.0.10' +QUICKBOOKS_SERVER_IP='10.0.0.10' +SUPPORT_TECH='2Shirt' +TIME_ZONE='Pacific Standard Time' # Always use "Standard Time" (DST is applied correctly) + +# SERVER VARIABLES +## NOTE: Windows can only use one user per server. This means that if +## one server serves multiple shares then you have to use the same +## user/password for all of those shares. +BACKUP_SERVERS = [ + { 'IP': '10.0.0.10', + 'Name': 'ServerOne', + 'Mounted': False, + 'Share': 'Backups', + 'User': 'restore', + 'Pass': 'Abracadabra', + }, + { 'IP': '10.0.0.11', + 'Name': 'ServerTwo', + 'Mounted': False, + 'Share': 'Backups', + 'User': 'restore', + 'Pass': 'Abracadabra', + }, +] +CLIENT_INFO_SERVER = { + 'IP': '10.0.0.10', + 'RegEntry': r'0x10001,0xcc674aebbd889f5fd553564adcf3cab550791eca12542033d52134db893c95aabb6b318a4621d8116f6838d873edfe9db4509e1dfc9177ee7484808a62cbc42b913387f694fd67e81950f85198acf721c5767b54db7b864d69cce65e12c78c87d0fb4fc54996609c9b9274b1de7bae2f95000c9ca8d7e3f9b3f2cdb21cd578adf9ba98d10400a8203bb1a879a4cd2fad99baeb12738b9b4b99fec821f881acb62598a43c059f74af287bc8dceeb4821317aa44e2e0ee66d346927a654c702854a71a2eaed6a53f6be9360c7049974a2597a548361da42ac982ae55f993700a8b1fc9f3b4458314fbd41f239de0a29716cdcefbbb2c8d02b4c2effa4163cfeac9', + 'Share': '/srv/ClientInfo', + 'User': 'upload', +} +QUICKBOOKS_SERVER = { + 'IP': QUICKBOOKS_SERVER_IP, + 'Name': 'ServerOne', + 'Mounted': False, + 'Share': 'QuickBooks', + 'User': 'restore', + 'Pass': 'Abracadabra', +} +OFFICE_SERVER = { + 'IP': OFFICE_SERVER_IP, + 'Name': 'ServerOne', + 'Mounted': False, + 'Share': 'Office', + 'User': 'restore', + 'Pass': 'Abracadabra', +} +WINDOWS_SERVER = { + 'IP': '10.0.0.10', + 'Name': 'ServerOne', + 'Mounted': False, + 'Share': 'Windows', + 'User': 'restore', + 'Pass': 'Abracadabra', +} + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/sfc_scan.py b/.bin/Scripts/sfc_scan.py index 78b4d123..e3288c09 100644 --- a/.bin/Scripts/sfc_scan.py +++ b/.bin/Scripts/sfc_scan.py @@ -1,19 +1,15 @@ -# Wizard Kit: SFC Tool +# Wizard Kit: Check, and possibly repair, system file health via SFC import os import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: SFC Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.repairs import * init_global_vars() - -def abort(): - print_warning('Aborted.') - pause("Press Enter to exit...") - exit_script() +os.system('title {}: SFC Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\SFC Tool.log'.format(**global_vars) if __name__ == '__main__': try: @@ -25,7 +21,8 @@ if __name__ == '__main__': 'GenericRepair': 'Repaired', }} stay_awake() - try_and_print(message='SFC scan...', function=run_sfc_scan, other_results=other_results) + try_and_print(message='SFC scan...', + function=run_sfc_scan, other_results=other_results) # Done print_standard('\nDone.') diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index 2a267d7f..d87e6e82 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -5,20 +5,20 @@ import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: System Checklist Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.cleanup import * +from functions.diags import * +from functions.info import * +from functions.product_keys import * +from functions.setup import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\System Checklist.log'.format(**global_vars) - -def abort(): - print_warning('Aborted.') - exit_script() +os.system('title {}: System Checklist Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\System Checklist.log'.format(**global_vars) if __name__ == '__main__': try: stay_awake() - get_ticket_number() + ticket_number = get_ticket_number() os.system('cls') other_results = { 'Error': { @@ -26,30 +26,36 @@ if __name__ == '__main__': 'BIOSKeyNotFoundError': 'BIOS key not found', }, 'Warning': {}} - print_info('Starting System Checklist for Ticket #{TicketNumber}\n'.format(**global_vars)) + print_info('Starting System Checklist for Ticket #{}\n'.format( + ticket_number)) # Configure print_info('Configure') if global_vars['OS']['Version'] == '10': - try_and_print(message='Explorer...', function=config_explorer_system, cs='Done') - try_and_print(message='Updating Clock...', function=update_clock, cs='Done') + try_and_print(message='Explorer...', + function=config_explorer_system, cs='Done') + try_and_print(message='Updating Clock...', + function=update_clock, cs='Done') # Cleanup print_info('Cleanup') - try_and_print(message='Desktop...', function=cleanup_desktop, cs='Done') - try_and_print(message='AdwCleaner...', function=cleanup_adwcleaner, cs='Done') - try_and_print(message='ESET...', function=uninstall_eset, cs='Done') - # try_and_print(message='MBAM...', function=uninstall_mbam, cs='Done') - try_and_print(message='Super Anti-Spyware...', function=uninstall_sas, cs='Done') + try_and_print(message='Desktop...', + function=cleanup_desktop, cs='Done') + try_and_print(message='AdwCleaner...', + function=cleanup_adwcleaner, cs='Done') # Export system info print_info('Backup System Information') - try_and_print(message='AIDA64 reports...', function=run_aida64, cs='Done') - # try_and_print(message='Browsers...', function=backup_browsers, cs='Done') - try_and_print(message='File listing...', function=backup_file_list, cs='Done') - try_and_print(message='Power plans...', function=backup_power_plans, cs='Done') - try_and_print(message='Product Keys...', function=run_produkey, cs='Done') - try_and_print(message='Registry...', function=backup_registry, cs='Done') + try_and_print(message='AIDA64 reports...', + function=run_aida64, cs='Done') + try_and_print(message='File listing...', + function=backup_file_list, cs='Done') + try_and_print(message='Power plans...', + function=backup_power_plans, cs='Done') + try_and_print(message='Product Keys...', + function=run_produkey, cs='Done') + try_and_print(message='Registry...', + function=backup_registry, cs='Done') # User data print_info('User Data') @@ -57,20 +63,30 @@ if __name__ == '__main__': # Summary print_info('Summary') - try_and_print(message='Operating System:', function=show_os_name, ns='Unknown', silent_function=False) - try_and_print(message='Activation:', function=show_os_activation, ns='Unknown', silent_function=False) - if not windows_is_activated() and global_vars['OS']['Version'] in ('8', '10'): - try_and_print(message='BIOS Activation:', function=activate_windows_with_bios, other_results=other_results) - try_and_print(message='Installed Office:', function=get_installed_office, ns='Unknown', print_return=True) + try_and_print(message='Operating System:', + function=show_os_name, ns='Unknown', silent_function=False) + try_and_print(message='Activation:', + function=show_os_activation, ns='Unknown', silent_function=False) + if (not windows_is_activated() + and global_vars['OS']['Version'] in ('8', '10')): + try_and_print(message='BIOS Activation:', + function=activate_windows_with_bios, + other_results=other_results) + try_and_print(message='Installed Office:', + function=get_installed_office, ns='Unknown', print_return=True) show_free_space() - try_and_print(message='Installed RAM:', function=show_installed_ram, ns='Unknown', silent_function=False) + try_and_print(message='Installed RAM:', + function=show_installed_ram, ns='Unknown', silent_function=False) # Upload info - print_info('Finalizing') - try_and_print(message='Compressing Info...', function=compress_info, cs='Done') - try_and_print(message='Uploading to NAS...', function=upload_info, cs='Done') + if ENABLED_UPLOAD_DATA: + print_info('Finalizing') + try_and_print(message='Compressing Info...', + function=compress_info, cs='Done') + try_and_print(message='Uploading to NAS...', + function=upload_info, cs='Done') - # Play audio, show devices, open Windows updates, and open Activation if necessary + # Play audio, show devices, open Windows updates, and open Activation popen_program(['mmc', 'devmgmt.msc']) run_hwinfo_sensors() popen_program(['control', '/name', 'Microsoft.WindowsUpdate']) diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index e9d9ae02..e3d2e41e 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -5,21 +5,21 @@ import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: System Diagnostics Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.browsers import * +from functions.diags import * +from functions.info import * +from functions.product_keys import * +from functions.repairs import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\System Diagnostics.log'.format(**global_vars) - -def abort(): - print_warning('Aborted.') - pause("Press Enter to exit...") - exit_script() +os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format( + **global_vars) if __name__ == '__main__': try: stay_awake() - get_ticket_number() + ticket_number = get_ticket_number() os.system('cls') other_results = { 'Error': { @@ -29,13 +29,17 @@ if __name__ == '__main__': 'GenericRepair': 'Repaired', 'UnsupportedOSError': 'Unsupported OS', }} - print_info('Starting System Diagnostics for Ticket #{TicketNumber}\n'.format(**global_vars)) + print_info('Starting System Diagnostics for Ticket #{}\n'.format( + ticket_number)) # Sanitize Environment print_info('Sanitizing Environment') - try_and_print(message='Killing processes...', function=run_process_killer, cs='Done') - try_and_print(message='Running RKill...', function=run_rkill, cs='Done') - try_and_print(message='Running TDSSKiller...', function=run_tdsskiller, cs='Done') + try_and_print(message='Killing processes...', + function=run_process_killer, cs='Done') + try_and_print(message='Running RKill...', + function=run_rkill, cs='Done') + try_and_print(message='Running TDSSKiller...', + function=run_tdsskiller, cs='Done') # Re-run if earlier process was stopped. stay_awake() @@ -43,43 +47,70 @@ if __name__ == '__main__': # Start diags print_info('Starting Background Scans') check_connection() - try_and_print(message='Running HitmanPro...', function=run_hitmanpro, cs='Started') - try_and_print(message='Running Autoruns...', function=run_autoruns, cs='Started') + try_and_print(message='Running HitmanPro...', + function=run_hitmanpro, cs='Started') + try_and_print(message='Running Autoruns...', + function=run_autoruns, cs='Started') # OS Health Checks print_info('OS Health Checks') - try_and_print(message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']), function=run_chkdsk, other_results=other_results) - try_and_print(message='SFC scan...', function=run_sfc_scan, other_results=other_results) - try_and_print(message='DISM CheckHealth...', function=run_dism_scan_health, other_results=other_results) + try_and_print( + message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']), + function=run_chkdsk, other_results=other_results) + try_and_print(message='SFC scan...', + function=run_sfc_scan, other_results=other_results) + try_and_print(message='DISM CheckHealth...', + function=run_dism, other_results=other_results, repair=False) + + # Scan for supported browsers + print_info('Scanning for browsers') + scan_for_browsers() # Export system info print_info('Backup System Information') - try_and_print(message='AIDA64 reports...', function=run_aida64, cs='Done') - try_and_print(message='BleachBit report...', function=run_bleachbit, cs='Done') - try_and_print(message='Browsers...', function=backup_browsers, cs='Done') - try_and_print(message='File listing...', function=backup_file_list, cs='Done') - try_and_print(message='Power plans...', function=backup_power_plans, cs='Done') - try_and_print(message='Product Keys...', function=run_produkey, cs='Done') - try_and_print(message='Registry...', function=backup_registry, cs='Done') + try_and_print(message='AIDA64 reports...', + function=run_aida64, cs='Done') + try_and_print(message='BleachBit report...', + function=run_bleachbit, cs='Done') + backup_browsers() + try_and_print(message='File listing...', + function=backup_file_list, cs='Done') + try_and_print(message='Power plans...', + function=backup_power_plans, cs='Done') + try_and_print(message='Product Keys...', + function=run_produkey, cs='Done') + try_and_print(message='Registry...', + function=backup_registry, cs='Done') # Summary print_info('Summary') - try_and_print(message='Temp Size:', function=show_temp_files_size, silent_function=False) + try_and_print(message='Temp Size:', + function=show_temp_files_size, silent_function=False) show_free_space() - try_and_print(message='Installed RAM:', function=show_installed_ram, ns='Unknown', silent_function=False) - try_and_print(message='Installed Office:', function=get_installed_office, ns='Unknown', print_return=True) - try_and_print(message='Product Keys:', function=get_product_keys, ns='Unknown', print_return=True) - try_and_print(message='Operating System:', function=show_os_name, ns='Unknown', silent_function=False) - try_and_print(message='', function=show_os_activation, ns='Unknown', silent_function=False) + try_and_print(message='Installed RAM:', + function=show_installed_ram, ns='Unknown', silent_function=False) + try_and_print(message='Installed Office:', + function=get_installed_office, ns='Unknown', print_return=True) + try_and_print(message='Product Keys:', + function=get_product_keys, ns='Unknown', print_return=True) + try_and_print(message='Operating System:', + function=show_os_name, ns='Unknown', silent_function=False) + try_and_print(message='', + function=show_os_activation, ns='Unknown', silent_function=False) # User data print_info('User Data') - show_user_data_summary() + try: + show_user_data_summary() + except Exception: + print_error(' Unknown error.') # Upload info print_info('Finalizing') - try_and_print(message='Compressing Info...', function=compress_info, cs='Done') - try_and_print(message='Uploading to NAS...', function=upload_info, cs='Done') + try_and_print(message='Compressing Info...', + function=compress_info, cs='Done') + try_and_print(message='Uploading to NAS...', + function=upload_info, cs='Done') # Done print_standard('\nDone.') diff --git a/.bin/Scripts/transferred_keys.py b/.bin/Scripts/transferred_keys.py index 51e8666b..0f0422db 100644 --- a/.bin/Scripts/transferred_keys.py +++ b/.bin/Scripts/transferred_keys.py @@ -1,33 +1,21 @@ -# Wizard Kit: Transferred Keys +# Wizard Kit: Search for product keys in the transfer folder via ProduKey & SW hives import os import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: ProductKey Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.product_keys import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\Transferred Keys.log'.format(**global_vars) - -def abort(): - print_warning('Aborted.') - pause("Press Enter to exit...") - exit_script() +os.system('title {}: ProductKey Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\Transferred Keys.log'.format(**global_vars) if __name__ == '__main__': try: - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - }, - 'Warning': { - 'GenericError': 'No keys found', - }} stay_awake() - try_and_print(message='Extracting keys...', function=extract_keys, other_results=other_results) - try_and_print(message='Displaying keys...', function=save_keys, print_return=True) + try_and_print(message='Searching for keys...', + function=list_clientdir_keys, print_return=True) # Done print_standard('\nDone.') diff --git a/.bin/Scripts/update_kit.py b/.bin/Scripts/update_kit.py index 12d40fbf..ea2da6db 100644 --- a/.bin/Scripts/update_kit.py +++ b/.bin/Scripts/update_kit.py @@ -5,10 +5,10 @@ import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: Kit Update Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.build import * init_global_vars() +os.system('title {}: Kit Update Tool'.format(KIT_NAME_FULL)) if __name__ == '__main__': try: @@ -19,44 +19,44 @@ if __name__ == '__main__': stay_awake() # Diagnostics - print_info('Diagnostics') - try_and_print(message='HitmanPro...', function=update_hitmanpro, other_results=other_results) + # print_info('Diagnostics') + # try_and_print(message='HitmanPro...', function=update_hitmanpro, other_results=other_results) # VR/OSR - print_info('VR/OSR') - try_and_print(message='AdwCleaner...', function=update_adwcleaner, other_results=other_results) - try_and_print(message='ESET...', function=update_eset, other_results=other_results) - try_and_print(message='JRT...', function=update_jrt, other_results=other_results) - try_and_print(message='KVRT...', function=update_kvrt, other_results=other_results) - try_and_print(message='RKill...', function=update_rkill, other_results=other_results) - try_and_print(message='TDSSKiller...', function=update_tdsskiller, other_results=other_results) + # print_info('VR/OSR') + # try_and_print(message='AdwCleaner...', function=update_adwcleaner, other_results=other_results) + # try_and_print(message='ESET...', function=update_eset, other_results=other_results) + # try_and_print(message='JRT...', function=update_jrt, other_results=other_results) + # try_and_print(message='KVRT...', function=update_kvrt, other_results=other_results) + # try_and_print(message='RKill...', function=update_rkill, other_results=other_results) + # try_and_print(message='TDSSKiller...', function=update_tdsskiller, other_results=other_results) # Driver Tools print_info('Driver Tools') - try_and_print(message='Intel Driver Update Utility...', function=update_intel_driver_utility, other_results=other_results) - try_and_print(message='Intel SSD Toolbox...', function=update_intel_ssd_toolbox, other_results=other_results) + # try_and_print(message='Intel Driver Update Utility...', function=update_intel_driver_utility, other_results=other_results) + # try_and_print(message='Intel SSD Toolbox...', function=update_intel_ssd_toolbox, other_results=other_results) # try_and_print(message='Samsung Magician...', function=update_samsung_magician, other_results=other_results) try_and_print(message='Samsung Magician...', function=update_samsung_magician, silent_function=False) # Ninite - Bundles print_info('Installers') print_success(' '*4 + 'Ninite Bundles') - _path = '{BaseDir}\\Installers\\Extras\\Bundles'.format(**global_vars) - try_and_print(message='Runtimes.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Runtimes.exe', source_url='https://ninite.com/.net4.6.2-air-java8-silverlight/ninite.exe') - try_and_print(message='Legacy.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Legacy.exe', source_url='https://ninite.com/.net4.6.2-7zip-air-chrome-firefox-java8-silverlight-vlc/ninite.exe') - try_and_print(message='Modern.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Modern.exe', source_url='https://ninite.com/.net4.6.2-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\Bundles'.format(**global_vars) + try_and_print(message='Runtimes.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Runtimes.exe', source_url='https://ninite.com/.net4.7-air-java8-silverlight/ninite.exe') + try_and_print(message='Legacy.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Legacy.exe', source_url='https://ninite.com/.net4.7-7zip-air-chrome-firefox-java8-silverlight-vlc/ninite.exe') + try_and_print(message='Modern.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Modern.exe', source_url='https://ninite.com/.net4.7-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe') # Ninite - Audio-Video print_success(' '*4 + 'Audio-Video') - _path = '{BaseDir}\\Installers\\Extras\\Audio-Video'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Audio-Video'.format(**global_vars) try_and_print(message='AIMP.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='AIMP.exe', source_url='https://ninite.com/aimp/ninite.exe') try_and_print(message='Audacity.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Audacity.exe', source_url='https://ninite.com/audacity/ninite.exe') try_and_print(message='CCCP.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='CCCP.exe', source_url='https://ninite.com/cccp/ninite.exe') try_and_print(message='Foobar2000.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Foobar2000.exe', source_url='https://ninite.com/foobar/ninite.exe') try_and_print(message='GOM.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='GOM.exe', source_url='https://ninite.com/gom/ninite.exe') + try_and_print(message='iTunes.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='HandBrake.exe', source_url='https://ninite.com/handbrake/ninite.exe') try_and_print(message='iTunes.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='iTunes.exe', source_url='https://ninite.com/itunes/ninite.exe') try_and_print(message='K-Lite Codecs.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='K-Lite Codecs.exe', source_url='https://ninite.com/klitecodecs/ninite.exe') - try_and_print(message='KMPlayer.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='KMPlayer.exe', source_url='https://ninite.com/kmplayer/ninite.exe') try_and_print(message='MediaMonkey.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='MediaMonkey.exe', source_url='https://ninite.com/mediamonkey/ninite.exe') try_and_print(message='MusicBee.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='MusicBee.exe', source_url='https://ninite.com/musicbee/ninite.exe') try_and_print(message='Spotify.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Spotify.exe', source_url='https://ninite.com/spotify/ninite.exe') @@ -65,74 +65,73 @@ if __name__ == '__main__': # Ninite - Cloud Storage print_success(' '*4 + 'Cloud Storage') - _path = '{BaseDir}\\Installers\\Extras\\Cloud Storage'.format(**global_vars) - try_and_print(message='BitTorrent Sync.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='BitTorrent Sync.exe', source_url='https://ninite.com/bittorrentsync/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\Cloud Storage'.format(**global_vars) try_and_print(message='Dropbox.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Dropbox.exe', source_url='https://ninite.com/dropbox/ninite.exe') - try_and_print(message='Google Drive.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Google Drive.exe', source_url='https://ninite.com/googledrive/ninite.exe') + try_and_print(message='Google Backup & Sync.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Google Backup & Sync.exe', source_url='https://ninite.com/googlebackupandsync/ninite.exe') try_and_print(message='Mozy.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Mozy.exe', source_url='https://ninite.com/mozy/ninite.exe') try_and_print(message='OneDrive.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='OneDrive.exe', source_url='https://ninite.com/onedrive/ninite.exe') try_and_print(message='SugarSync.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='SugarSync.exe', source_url='https://ninite.com/sugarsync/ninite.exe') # Ninite - Communication print_success(' '*4 + 'Communication') - _path = '{BaseDir}\\Installers\\Extras\\Communication'.format(**global_vars) - try_and_print(message='AIM.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='AIM.exe', source_url='https://ninite.com/aim/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\Communication'.format(**global_vars) try_and_print(message='Pidgin.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Pidgin.exe', source_url='https://ninite.com/pidgin/ninite.exe') try_and_print(message='Skype.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Skype.exe', source_url='https://ninite.com/skype/ninite.exe') try_and_print(message='Trillian.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Trillian.exe', source_url='https://ninite.com/trillian/ninite.exe') # Ninite - Compression print_success(' '*4 + 'Compression') - _path = '{BaseDir}\\Installers\\Extras\\Compression'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Compression'.format(**global_vars) try_and_print(message='7-Zip.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='7-Zip.exe', source_url='https://ninite.com/7zip/ninite.exe') try_and_print(message='PeaZip.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='PeaZip.exe', source_url='https://ninite.com/peazip/ninite.exe') try_and_print(message='WinRAR.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='WinRAR.exe', source_url='https://ninite.com/winrar/ninite.exe') # Ninite - Developer print_success(' '*4 + 'Developer') - _path = '{BaseDir}\\Installers\\Extras\\Developer'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Developer'.format(**global_vars) try_and_print(message='Eclipse.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Eclipse.exe', source_url='https://ninite.com/eclipse/ninite.exe') try_and_print(message='FileZilla.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='FileZilla.exe', source_url='https://ninite.com/filezilla/ninite.exe') try_and_print(message='JDK 8.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='JDK 8.exe', source_url='https://ninite.com/jdk8/ninite.exe') try_and_print(message='JDK 8 (x64).exe', function=download_file, other_results=other_results, out_dir=_path, out_name='JDK 8 (x64).exe', source_url='https://ninite.com/jdkx8/ninite.exe') try_and_print(message='Notepad++.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Notepad++.exe', source_url='https://ninite.com/notepadplusplus/ninite.exe') try_and_print(message='PuTTY.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='PuTTY.exe', source_url='https://ninite.com/putty/ninite.exe') - try_and_print(message='Python 2.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Python 2.exe', source_url='https://ninite.com/python/ninite.exe') + try_and_print(message='Python 2.7.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Python 2.exe', source_url='https://ninite.com/python/ninite.exe') try_and_print(message='Visual Studio Code.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Visual Studio Code.exe', source_url='https://ninite.com/vscode/ninite.exe') try_and_print(message='WinMerge.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='WinMerge.exe', source_url='https://ninite.com/winmerge/ninite.exe') try_and_print(message='WinSCP.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='WinSCP.exe', source_url='https://ninite.com/winscp/ninite.exe') # Ninite - File Sharing print_success(' '*4 + 'File Sharing') - _path = '{BaseDir}\\Installers\\Extras\\File Sharing'.format(**global_vars) - try_and_print(message='eMule.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='eMule.exe', source_url='https://ninite.com/emule/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\File Sharing'.format(**global_vars) try_and_print(message='qBittorrent.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='qBittorrent.exe', source_url='https://ninite.com/qbittorrent/ninite.exe') # Ninite - Image-Photo print_success(' '*4 + 'Image-Photo') - _path = '{BaseDir}\\Installers\\Extras\\Image-Photo'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Image-Photo'.format(**global_vars) + try_and_print(message='Blender.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Blender.exe', source_url='https://ninite.com/blender/ninite.exe') try_and_print(message='FastStone.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='FastStone.exe', source_url='https://ninite.com/faststone/ninite.exe') try_and_print(message='GIMP.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='GIMP.exe', source_url='https://ninite.com/gimp/ninite.exe') try_and_print(message='Greenshot.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Greenshot.exe', source_url='https://ninite.com/greenshot/ninite.exe') try_and_print(message='Inkscape.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Inkscape.exe', source_url='https://ninite.com/inkscape/ninite.exe') try_and_print(message='IrfanView.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='IrfanView.exe', source_url='https://ninite.com/irfanview/ninite.exe') + try_and_print(message='Krita.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Krita.exe', source_url='https://ninite.com/krita/ninite.exe') try_and_print(message='Paint.NET.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Paint.NET.exe', source_url='https://ninite.com/paint.net/ninite.exe') try_and_print(message='ShareX.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='ShareX.exe', source_url='https://ninite.com/sharex/ninite.exe') try_and_print(message='XnView.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='XnView.exe', source_url='https://ninite.com/xnview/ninite.exe') # Ninite - Misc print_success(' '*4 + 'Misc') - _path = '{BaseDir}\\Installers\\Extras\\Misc'.format(**global_vars) - try_and_print(message='Classic Start.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Classic Start.exe', source_url='https://ninite.com/classicstart/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\Misc'.format(**global_vars) try_and_print(message='Evernote.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Evernote.exe', source_url='https://ninite.com/evernote/ninite.exe') try_and_print(message='Everything.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Everything.exe', source_url='https://ninite.com/everything/ninite.exe') + try_and_print(message='KeePass 2.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='KeePass 2.exe', source_url='https://ninite.com/keepass2/ninite.exe') try_and_print(message='Google Earth.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Google Earth.exe', source_url='https://ninite.com/googleearth/ninite.exe') try_and_print(message='NV Access.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='NV Access.exe', source_url='https://ninite.com/nvda/ninite.exe') try_and_print(message='Steam.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Steam.exe', source_url='https://ninite.com/steam/ninite.exe') # Ninite - Office print_success(' '*4 + 'Office') - _path = '{BaseDir}\\Installers\\Extras\\Office'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Office'.format(**global_vars) try_and_print(message='CutePDF.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='CutePDF.exe', source_url='https://ninite.com/cutepdf/ninite.exe') try_and_print(message='Foxit Reader.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Foxit Reader.exe', source_url='https://ninite.com/foxit/ninite.exe') try_and_print(message='LibreOffice.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='LibreOffice.exe', source_url='https://ninite.com/libreoffice/ninite.exe') @@ -143,17 +142,16 @@ if __name__ == '__main__': # Ninite - Runtimes print_success(' '*4 + 'Runtimes') - _path = '{BaseDir}\\Installers\\Extras\\Runtimes'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Runtimes'.format(**global_vars) try_and_print(message='Adobe Air.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Adobe Air.exe', source_url='https://ninite.com/air/ninite.exe') - try_and_print(message='dotNET.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='dotNET.exe', source_url='https://ninite.com/.net4.6.2/ninite.exe') + try_and_print(message='dotNET.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='dotNET.exe', source_url='https://ninite.com/.net4.7/ninite.exe') try_and_print(message='Java 8.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Java 8.exe', source_url='https://ninite.com/java8/ninite.exe') try_and_print(message='Shockwave.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Shockwave.exe', source_url='https://ninite.com/shockwave/ninite.exe') try_and_print(message='Silverlight.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Silverlight.exe', source_url='https://ninite.com/silverlight/ninite.exe') # Ninite - Security print_success(' '*4 + 'Security') - _path = '{BaseDir}\\Installers\\Extras\\Security'.format(**global_vars) - try_and_print(message='Ad-Aware.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Ad-Aware.exe', source_url='https://ninite.com/adaware/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\Security'.format(**global_vars) try_and_print(message='Avast.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Avast.exe', source_url='https://ninite.com/avast/ninite.exe') try_and_print(message='AVG.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='AVG.exe', source_url='https://ninite.com/avg/ninite.exe') try_and_print(message='Avira.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Avira.exe', source_url='https://ninite.com/avira/ninite.exe') @@ -164,30 +162,29 @@ if __name__ == '__main__': # Ninite - Utilities print_success(' '*4 + 'Utilities') - _path = '{BaseDir}\\Installers\\Extras\\Utilities'.format(**global_vars) - try_and_print(message='Auslogics DiskDefrag.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Auslogics DiskDefrag.exe', source_url='https://ninite.com/auslogics/ninite.exe') + _path = r'{BaseDir}\Installers\Extras\Utilities'.format(**global_vars) try_and_print(message='CDBurnerXP.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='CDBurnerXP.exe', source_url='https://ninite.com/cdburnerxp/ninite.exe') + try_and_print(message='Classic Start.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Classic Start.exe', source_url='https://ninite.com/classicstart/ninite.exe') try_and_print(message='Glary Utilities.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Glary Utilities.exe', source_url='https://ninite.com/glary/ninite.exe') try_and_print(message='ImgBurn.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='ImgBurn.exe', source_url='https://ninite.com/imgburn/ninite.exe') try_and_print(message='InfraRecorder.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='InfraRecorder.exe', source_url='https://ninite.com/infrarecorder/ninite.exe') - try_and_print(message='KeePass 2.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='KeePass 2.exe', source_url='https://ninite.com/keepass2/ninite.exe') try_and_print(message='Launchy.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Launchy.exe', source_url='https://ninite.com/launchy/ninite.exe') try_and_print(message='RealVNC.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='RealVNC.exe', source_url='https://ninite.com/realvnc/ninite.exe') try_and_print(message='Revo Uninstaller.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Revo Uninstaller.exe', source_url='https://ninite.com/revo/ninite.exe') - try_and_print(message='TeamViewer 11.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='TeamViewer 11.exe', source_url='https://ninite.com/teamviewer11/ninite.exe') + try_and_print(message='TeamViewer 12.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='TeamViewer 12.exe', source_url='https://ninite.com/teamviewer12/ninite.exe') try_and_print(message='TeraCopy.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='TeraCopy.exe', source_url='https://ninite.com/teracopy/ninite.exe') try_and_print(message='WinDirStat.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='WinDirStat.exe', source_url='https://ninite.com/windirstat/ninite.exe') # Ninite - Web Browsers print_success(' '*4 + 'Web Browsers') - _path = '{BaseDir}\\Installers\\Extras\\Web Browsers'.format(**global_vars) + _path = r'{BaseDir}\Installers\Extras\Web Browsers'.format(**global_vars) try_and_print(message='Google Chrome.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Google Chrome.exe', source_url='https://ninite.com/chrome/ninite.exe') try_and_print(message='Mozilla Firefox.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Mozilla Firefox.exe', source_url='https://ninite.com/firefox/ninite.exe') try_and_print(message='Opera Chromium.exe', function=download_file, other_results=other_results, out_dir=_path, out_name='Opera Chromium.exe', source_url='https://ninite.com/operaChromium/ninite.exe') # Misc - print_info('Misc') - try_and_print(message='SysinternalsSuite...', function=update_sysinternalssuite, other_results=other_results) + # print_info('Misc') + # try_and_print(message='SysinternalsSuite...', function=update_sysinternalssuite, other_results=other_results) # Done print_standard('\nDone.') diff --git a/.bin/Scripts/user_checklist.py b/.bin/Scripts/user_checklist.py index 88a9cfb8..9e488e4b 100644 --- a/.bin/Scripts/user_checklist.py +++ b/.bin/Scripts/user_checklist.py @@ -5,15 +5,14 @@ import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: User Checklist Tool') sys.path.append(os.getcwd()) -from functions import * +from functions.browsers import * +from functions.cleanup import * +from functions.setup import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\User Checklist ({USERNAME}).log'.format(**global_vars, **global_vars['Env']) - -def abort(): - print_warning('Aborted.') - exit_script() +os.system('title {}: User Checklist Tool'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\User Checklist ({USERNAME}).log'.format( + **global_vars, **global_vars['Env']) if __name__ == '__main__': try: @@ -24,16 +23,22 @@ if __name__ == '__main__': 'NotInstalledError': 'Not installed', 'NoProfilesError': 'No profiles found', }} - answer_config_browsers = ask('Configure Browsers to WK Standards?') + answer_config_browsers = ask('Install adblock?') if answer_config_browsers: - answer_reset_browsers = ask('Reset browsers to safe defaults first?') + answer_reset_browsers = ask( + 'Reset browsers to safe defaults first?') if global_vars['OS']['Version'] == '10': - answer_config_classicshell = ask('Configure ClassicShell to WK Standards?') - answer_config_explorer_user = ask('Configure Explorer to WK Standards?') + answer_config_classicshell = ask('Configure ClassicShell?') + answer_config_explorer_user = ask('Configure Explorer?') # Cleanup print_info('Cleanup') - try_and_print(message='Desktop...', function=cleanup_desktop, cs='Done') + try_and_print(message='Desktop...', + function=cleanup_desktop, cs='Done') + + # Scan for supported browsers + print_info('Scanning for browsers') + scan_for_browsers() # Homepages print_info('Current homepages') @@ -41,44 +46,27 @@ if __name__ == '__main__': # Backup print_info('Backing up browsers') - try_and_print(message='Chromium...', function=backup_chromium, other_results=other_results) - try_and_print(message='Google Chrome...', function=backup_chrome, other_results=other_results) - try_and_print(message='Google Chrome Canary...', function=backup_chrome_canary, other_results=other_results) - try_and_print(message='Internet Explorer...', function=backup_internet_explorer, other_results=other_results) - try_and_print(message='Mozilla Firefox (All)...', function=backup_firefox, other_results=other_results) - try_and_print(message='Opera...', function=backup_opera, other_results=other_results) - try_and_print(message='Opera Beta...', function=backup_opera_beta, other_results=other_results) - try_and_print(message='Opera Dev...', function=backup_opera_dev, other_results=other_results) + backup_browsers() # Reset if answer_config_browsers and answer_reset_browsers: print_info('Resetting browsers') - try_and_print(message='Internet Explorer...', function=clean_internet_explorer, cs='Done') - try_and_print(message='Google Chrome...', function=reset_google_chrome, other_results=other_results) - try_and_print(message='Google Chrome Canary...', function=reset_google_chrome_canary, other_results=other_results) - try_and_print(message='Mozilla Firefox...', function=reset_mozilla_firefox, other_results=other_results) - try_and_print(message='Opera...', function=reset_opera, other_results=other_results) - try_and_print(message='Opera Beta...', function=reset_opera_beta, other_results=other_results) - try_and_print(message='Opera Dev...', function=reset_opera_dev, other_results=other_results) + reset_browsers() # Configure print_info('Configuring programs') if answer_config_browsers: - try_and_print(message='Internet Explorer...', function=config_internet_explorer, cs='Done') - try_and_print(message='Google Chrome...', function=config_google_chrome, cs='Done', other_results=other_results) - try_and_print(message='Google Chrome Canary...', function=config_google_chrome_canary, cs='Done', other_results=other_results) - try_and_print(message='Mozilla Firefox...', function=config_mozilla_firefox, cs='Done', other_results=other_results) - try_and_print(message='Mozilla Firefox Dev...', function=config_mozilla_firefox_dev, cs='Done', other_results=other_results) - try_and_print(message='Opera...', function=config_opera, cs='Done', other_results=other_results) - try_and_print(message='Opera Beta...', function=config_opera_beta, cs='Done', other_results=other_results) - try_and_print(message='Opera Dev...', function=config_opera_dev, cs='Done', other_results=other_results) - try_and_print(message='Set default browser...', function=set_chrome_as_default, cs='Done', other_results=other_results) + install_adblock() if global_vars['OS']['Version'] == '10': if answer_config_classicshell: - try_and_print(message='ClassicStart...', function=config_classicstart, cs='Done') + try_and_print(message='ClassicStart...', + function=config_classicstart, cs='Done') if answer_config_explorer_user: - try_and_print(message='Explorer...', function=config_explorer_user, cs='Done') - if not answer_config_browsers and not answer_config_classicshell and not answer_config_explorer_user: + try_and_print(message='Explorer...', + function=config_explorer_user, cs='Done') + if (not answer_config_browsers + and not answer_config_classicshell + and not answer_config_explorer_user): print_warning(' Skipped') else: if not answer_config_browsers: diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index 35b00bc3..e0df19a6 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -1,46 +1,44 @@ -# Wizard Kit: Copy user data to the system over the network +# Wizard Kit: Copy user data to the system from a local or network source import os import sys # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) -os.system('title Wizard Kit: Data 1') sys.path.append(os.getcwd()) -from functions import * +from functions.data import * +from functions.repairs import * init_global_vars() -global_vars['LogFile'] = '{LogDir}\\Data 1.log'.format(**global_vars) -global_vars['Data'] = {} - -def abort(): - umount_backup_shares() - print_warning('Aborted.') - pause("Press Enter to exit...") - exit_script() +os.system('title {}: Data 1'.format(KIT_NAME_FULL)) +global_vars['LogFile'] = r'{LogDir}\Data 1.log'.format(**global_vars) if __name__ == '__main__': try: # Prep stay_awake() - get_ticket_number() + ticket_number = get_ticket_number() os.system('cls') - select_destination() - select_backup() - scan_backup() + folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT) + dest = select_destination(folder_path=folder_path, + prompt='Which disk are we transferring to?') + source = select_source(ticket_number) + items = scan_source(source, dest) # Transfer os.system('cls') print_info('Transfer Details:\n') - show_info('Ticket:', global_vars['TicketNumber']) - show_info('Source:', global_vars['Data']['Source'].path) - show_info('Destination:', global_vars['Data']['Destination']) + show_info('Ticket:', ticket_number) + show_info('Source:', source.path) + show_info('Destination:', dest) if (not ask('Proceed with transfer?')): + umount_backup_shares() abort() print_info('Transferring Data') - transfer_backup() - try_and_print(message='Removing extra files...', function=cleanup_transfer, cs='Done') + transfer_source(source, dest, items) + try_and_print(message='Removing extra files...', + function=cleanup_transfer, cs='Done') umount_backup_shares() # Done diff --git a/.bin/XYplorerFree/Data/XYplorer.ini b/.bin/XYplorerFree/Data/XYplorer.ini new file mode 100644 index 0000000000000000000000000000000000000000..58a3c0893deaf5b69964ed25c9d0cf9e832094b3 GIT binary patch literal 80190 zcmeI5YjagcmZtT2BIXCoH?=2b+T8^<7h}L>yF&=D)dhwE?7G+$6yyS<~~Ql)g3cY<4{OCXXowBl`GdRFZ+N0uU~I%Z~cDj4_hy{o^5@%wZHW^ zey_Lxk0a&m*2S%Nw%*%16MxUdw=?mxz4b71zSw%Q^>pj&t?wi6{jJ0J%(LzG^jXyM zpSS+g7IptFQeJF5iquzI2d&04Tc_gx`%&xZtp|~Mc$D{CYvW=(KN~-%+cz+r-})f_ zz8`TdaU$o~RMY*{LloqbLkrVWfw?5iB*UFF2 zZ#P=}Fr?p#cJH;GzmAkMt)%MOkJ@gxI=_jOdt2W`59#;qt=%=bu5JAo)W6@T^f)L5 zW)R+sXAh$6oM2jz@K2ggh`TrnNo=qvPZG8@~%-FvO z6wttQbW1!xh(5t9)cvfD`+nqmD}L@pj~_+a>#d)*Znn=)8!s~=+a>j__(rRbBi9G< z`B9XG#(P0W_>OTrjIsVM>SsR9EuA#CaSI=%ZbXfYADs6%eoV`qXzylxKZqY;GhZ`; zj5@tE-MKmoQiLfvybC5T=OjcQ|tGE4rza?(L$ei{v=Ak6Fo-8 zVLxaGk67x}KHQD=_M^6E@sm{S>-b&dxF5A=I(p|`^x<(l|F+H2zeXM3MUT->&;&~E zw{QCYJf1>>?Us@>+}?US#`~SE3z2dW^Aa}r-D?IQIyvRQ0MuefFv;LC|WPYW+lD!jm9ABcgcp=(57x*s3kLek8`41QV-N}|K%-}oO$SF zVEVf046Fxq-}lkxVdyZt!@mTAuiK{w(Hkt5?f8yG&L`pJ2YvV< zxaZ^c>3JYVyCx?w_RFZwhyHsJy+YSuOL%0EdT23gRoa#MoGyK%DRodgz~Se{j;d^FnER$`!;G{Uu&OJ^}%o05mnjr@eA)U z8q99wB(^v;A2we8GDf;ei9baN`0(rIZM}?dBj+>zl1o2r*><#KqD`TheYNf2C#+lA zm(30zNmkLKXEiv<^L#bKkT#k@=n_61ghUVxH3yxe*3$QC-7EsDv?}zF^dn}%%)%-L zN2P|W6wMIQm_0}s@+4iD6Ik*{qaMe0jP-WNmhF&3{HGVS{@Md!LlV{8^XQK@d99Pq7@{yOWdBK5_iJBhO09c!ILUaWJ&OJDeiD1 z=FpAkQH^x)tgn+NbDcb0SLa?EQ!IH?&o1%q{YCsm0wGi#az>mvY~Y z=zGDAwBJD)3X_+o-d)i-Xt24ZQ1GfLJA`(J?>7w9na8Y(qlUz#lQ_>tRcsA z(w1>K@Hx(hm2o%b2KLKXzavr1Mr>86K_pJ`8`s82p*fzl$S5|R{N0n}s#LLG>U!-J zpr`R??*?jO?qmCXUy+DVfY@ap{e=!arkkO6zKD9iiJD)nc%ZLsEWup-Ca~apJNAq3 zi#O!FUj+4cV!V*Q(w?^B;3O=VTuC7B$wyJ>DYJeAGY^pf>D1julN?`asBz4z(Hk_V zdi69u^}P{(X&K8=Y0BE?^|_$hy=Z|o4)YioJ_%ZU7f*?orG-1DU=w1$DaRjz`bhHS z*uB?aoC{r5WB9LEI?gl7-oU}cU1+lH=xY>Q#(q3rdln|fCH|&nhh@EQ_;-x&xh_woV{eBpnAPV&s-JGN6m^pps zpE=JGH_f@m*@N`L&aXL>eom$R7Zb1dseK>r#OPoZNFzXtl+O1WFF%WRk=y%0CHPvt z2589nVSH!QzG+?st0^DGcQhhi#)nOQ?#JhK5u-=Z2J4%Ou(Pw^R{Rnf*1REI^T+eW zK3d&tuziH;N#l0SzPBUxcPmhP28wT(N$?}S)2r6QZ{pLF_(V_bscLP;D}Dd4T7^k; z=+VTD)ifjZd?XdU$12}J8^`C(^S8uDa$`p+g6}y^|6GIS6jlyVN3@*F&TyF|e5E6Ah>#tGC8lvluM(X^8#2}zJyKiPQECaPL_5Yk zqr>Zzy@p1-8SN6udb*Nl*-ukpeN7L7n(&_b<<+Z$CVik(_4(-`f@gKd$YF&=nL6g8*`$Njnj&!fg?)`_vg zSjA-YWf@5}LkH2PU$u96r!TE;8He*Q-*XLatYNg(TxvJ4q1hiCVRi~*p1Ul1yhs{2 z1g;bBjP1=it~44QHY&h5vTEJhXHg&fbo!_E7slt(AW#yoXQYIE>g5#?x40Lh!Q8>S zV8tZ&u#)6Rmq+#<_?+Dp%i!tPyL{tGs=lUNb6|31vMJ zXFL0hsO+USvz&hJnDn!QB}er2;!s16q2@pf{SZC%PAqt%@0EK#Q@O8I^x2&2U)$`< z_|!O}$e=n$Ri|VR_B__)(hCOtuiBV9@+?Jf?HBn(jAX17;KRs!qocusMn+P>+ z)*QAkh_HK{J-56|2#w*G1s)Z;1_?la`UOnpa9VE~#kww+n05ojk4HYNx#A>w6|oWLQjXmxTH88FX=~!X7FOw4 zHIqE6$l$eH%O1ywu}A);Z!3;lw(8A)%qIMhH!q2AzZYdk8skw@XFk{HII^pjw4MbI zncnkEAR3@(B9^k&-ic8VOQ40cqu*})h;PUmAhr_n5C6h7kROX19@CoD>#+N=ozbV- z+qMoNQ4Qhn4uC6BrpI7sCsY*=lDiR)*| zo(&qX3U|NRyp)1(a!f2wdb?h0ruZgMGb1Wc^z-m>cjN!d*8Vp^W%zd;Vt7|2OgFCu z+X|2dV?UYpq@_kCLW9qOH1R1iy%d2BhkH6!PJ~b9Lt6n6Jy6{J05r#HDF7kU+`5K zS?Lz)b>uJo&AnA=$(FJG)POSr>c{$c74@Uz%KE{6l-Er2&QbOwYIMBfq;&>LGr~mZzAO4%_?eN1M^EuLwGXwfGsxyp{!gMF zuxCz>Tc%)lK3(;>-yMj*tG>;n%qlChli84a+`Ny0wavcGx^1(f*!B z_ve(&70!=V_7Sys&kXZDbrRn)=0QH}SL}n_-&ISy&tQk|kXALFG5tKaASJE(A+4bp znRF6zxt27Iv6^3n#e@zbF3cRc*7(6~Te8*hO|)2lXgbQ@3XIm6E?wJ{_JjxNM~y+% zTyBqN;#4?nFEB|PF#B>>liQi+le7u^Y_3+M+ar^n4BXixuzbg#XEz?T;O`;1d!K4< z_eJ!Kx@8HxYU2iVutJ!NSTxA+IjZz()u|7eUW%zmd}pH2d&mD@Jb{n**h)lXl%u{(}TYqyni+N>T%O}_4t(M z+ECxUquSP^#CsI2iHZ|B_P)q!k->i%V}zQ0`)P~q1x_f9CWF5A<}LGPt|3;9v|+#C z{bmb#$B}5_e#0x`c=!XY=@n~5ySIaKa24FG&j(SjJpprp+Heb4^0aO4H=TYPbzzZx z8=6zI#U<3YT%}syuSA=*Z6DRQeYCF%KERh0X82JnRz_@WMsN^XN9zEY&$u}Q12xvq z+L{Bd&gj-y$K9w2{{YJ%R}?fmTnkZV#>8c>1v1CM()JS#nf0tYm}05BmvdTboHRd{ z5u@q+%e5XKIg%D%E)Ab!!B?AS=IA_?c0I=XTKp1iX7@GU{f$rTkmmoXmg8#se7#94 zqzq?46Gz=E&I|;LtPD65J&Tp_FrG0t(k44DpJp=tfzOY6G>O8i%aygehq2xTz`W_uEV}a$$hU@F| z?Lu-S(VIXP7cBw~6=e#|koX z^4CF2JZ15W5cam!@1ocEbh1F}4EZQ(m}|lA%&4RL#ZxHrQS6bRtxDyTR9Y8I8`hQ5Yo4{y(1>ixuO59Gtz#`p#$d6^4o|7+7Vbp~voa-B#{HEhTRC^*!Izqcrn~ZG z6}e^0#`g z^Y}WX|JRkDXCU($ALB3(bDM}i;e9aXd}lrqnb8<2Myg0PG|C)1K~4EQ)QZIeb@BY! z?aOE~j$k<58lh5BbPJvcV&#^gqFJ44@^Z_j>YYbF>Y?$fq=TZA^{I}J1xay;< zRwDuR-9W|JY9zmr+W&OKMYB%5B?iV`!n(38UYXHD8P^4`620l`vUQU*U`0`WnJo!q z&p5k?BA~^Xaq#<mbKChaM9?x_z9kHF+ zUFDh;6~tPq>nO4Z<(pBTa~lVe2^oOIC7y-!fR{NPzmz}mT@Q-=(8|e6l@uB4m&C@V z;f4cb1b$uW?WO)L&o%mBI~4o+osgvOL|+y8Kt3sohwnoyB)u(8$}IKei>L*e{UmzM zxL3*LQ9U`njJ*>Fz-sf!?u;JeEsEas1}X4vqhg-?M>0Xr*DJX$``4WPAB7khUe8!+ zF31oTJjVg8&0p|ernnz>+Zbg8^i8NN3pu0fU;xd2)Jg2t znD88rTT!n_GfF}&_+xWvbA{y)dP&ky^2oh*zLWP08@1My`r&X`HJR8cRAFoTU`~0uxg2Rn$!^iZfW~o7|OnTt3QqCyDz%b1yfyv7%ge z>dYrU-wvM9oYYBtuS27)bpz0Ltaqs<=Y(60ommB+!1?zhrefHIXCZWV%8%Km=ASV(B@L6Cq6Cn z1kO%LQc+MZ{-ah{jEOy&@cq2IRQ!u2Mf6M76+BLEc1uVKFkbn-ZF18F7yJa$({skWnwH&B&Ryv#@%QYxy{r&VhP(_~6gFvyp z^^c9SkZ#+d(P;l4TRYtGcq*Q8lT6xJ2i>^%IW4hw6O5_@-b@U)0|$ClwyFAhuOXB! zM9%AO0_GobN%kB3Cx2hNcjo@nqF0HC=A-AC1N4#gJ@f)SwnwnJ2J8~32gM(*X2YYX zjeRGnh2}bFZOMbBF3$sYY$%EWMl39BYW6ba>XTv*+i@e>2aT3@ONqN}Jn?yyTB|>vj3E1mXhyw z$oiyit)KBA2XsVZE!DIWyd~{y?})jB|EhTTQW+!!8X5T{FBU9mHO(W8g?fMcJS6a;DPN@qH%6KGNrtWw&#cDJtJqTn((wM!v zn+}eeZOGm(bX48^)|YnueHru{XPwd-bw1=X@fO88)B8Z~f8As;k_ImXq$wY&)j0+c7>hs(V zDzTdjUb3|Ab5vPK3|;<9+D_T~&E?GN-fd>g>uClRL?wHBc&53F067LVM=OJohd+Bf zX*=yjDMo*jPvLP>d{l8F#wAba*`C2NWUk6;VLv4{0W#2jj$(CvK6FCe$*U6QqZB^Y zgGgnL(u1SoF=C^~>~WqcPkTh>iONGI>{Fz>#|nEO zg?{yvJJKNS z2qY^zQ$$rC0wlJi*IL|97MfKb~7A= zHT5jKk81zHlZ=Ay&y)3)xELp6g3nX~ntQY#PmY8*7_DL1v4hkrjM|@s4JGcv7Q_zI zn!Kz-@`4@>L}|(Ait^@B39sr(TO@jOrTZn0mAyNTaL#Jyb_5N+H`SmAwqxFL+v_Hm z?JfC{H>d@vq*Yl)+-q#0==lRJxwn!%%tZOKZ^{!dTMroj?fChJ__iH${!aXT(4I(B zk@9wzrgJIom23-i9=z(Yqc?Dic3KFTOMo8R73AWiN2?j5zHmwhOP-m+Xm2{t-}5{1 zKJ0f^R??&6govzo#!PY*WV#1|z38$nk*Ro!m7iP^%@*QtbtJaD#Vnl)JED)SUM@m^>h)JP_+p$Mlq zk6g?AYu!;LKfS?U^jzDN2Trjbdei)9sLvX1-?ur|u-E#;?Wie1MWIcYAqDpKtTct}=Ht|FPz&`(^wj5*VD47`rzI%YZhQ@iJubx`CHEy$`vvN9WO z^UcKfERh*Ut+h?oK zaBlXHaS>JX8FoL?ulkc%EFROj@BQq@&hqT1@1`9#x5njk)L+;4=r8hsr{ei6gN0_l ziyDwr*zJ@!9kQv)dqwSXml=Ka3WnAp?}lZM$4WieR>%_~9IWLs+UPaQ&h`DJUUDaI zdHsf&AgxndSzpr<9i)Mgg=mE2A5cQs`8l2p`W$L77TV?9BlO$`VISEho_aS*A$hP) zDZdw=pm0jaw3)_;NzE%M^-0u$SEEQ&P1l@Xm)_6E5$U>8lCP4)mipQ^mgr}mwS~j& z&J}I05Syx4K=g(=tl3Kn98~vtIqvE4Vg5kN{TLZZDY#~HANu~^Xd{XwQOxq+uQ!Y( zaY1^cbFUyp4~6*_>~gy%-A%{%)|p&ZR?(PzuM8vDdfV@}Q` zW?E4GZ;j$+JGN7#8IT3JBv^d|Ww1mf!KIKx5N6NH%(u2O@T_e@WQFp>% z6F&?pEpaX5g#0>emX>57Q3Ff7+%dY$yPMD>1&OjL8VgUY(>y}wo9wh(31p70ph20* zj%lA13+=(1igUbs^vU+}%(q^2 zkRt!#cO)bunpoUA``P{84Czp>!%82{G)qeee5^`Y%F`lxenytF#%Rz&^`w;NoYv#S zxw7L#Q(0v{L~EQjq%WQ$ccRr-D^JB7tMw|?vfl3fIXz*GN_&&wZprGuwI{Z~j_--i zC(mPY@{u?WKhZ=Yr*IY=Woee2EgOzICN!3e#ZnK(z0dua$eNma!kDuniJuK0A$ezt zlMC8orx;m1y}`-dW85`oSsB8{dlDLzIggYvPm1dld4a;~C4=;WB+I8! zGdBInxNto#_&{D3_SnzEQZYay_(gS^17=FqnFwb>CuWDEiIV<~_c3eGy;TxdnQ2Yr z(s!dS>ci?Y29Gk{ASv8d$vcs1Ug-*Uw81}fNos|Ium_1S>YfBFvY9*FUdr&ql;z#V zOd&>BCrwVb*_t!ZdPx?M_u*H1^!$z|W=gX5r@61$>^p1b_ALqiBU?{dvTpCqv!DWW z#!lcfv>tE!P&^SUpS=)@k26Y@B08r>>67;VR>Vl}#+<(qa^zn8QX8inUbHi!V7kAO zFtp5QFV!x+fW?V)muFl#P98q-UEgfVPAW-vwV_=~>7%$VBEtB+^LmJ*c_2i7F&~ld zx1(O2iKj1jTMw4fk(=-cI?4R$R_9WCk?*spnOpMleO#i?32m}{Arv(fCqKUTvfn5} zbPlgjtBz z{jLz}CS*5wbB{8TGHIlp3+rsu8M)=5cA#KU=w90=(Wl&Jk$xWBiT|hFLW~CMMQAIe zsyT()GP1|h2Q6J54yzCJm%gx)h#vq)VK3AE*qe1W(YoHCA&G{vr^r@3%b9uWLK zJVWq86PGy&=W6`fS4*5b#~FK%_Tg>x19TZJ4(RMTl#)OvXh!@e$3pCmnLz}F-Rp|* zX#c0i=O3HA#KxH4Hm;fVYU^LZdeRts9oaV`!f#rMJ~`bKfq+)L^;J8Fk}~w&krqdI z6lc*YMvVaNhJ@cc8lj~WYMY<$#CYV}snhmQr1bL`J9hA5Ij4ljUS_V1yW7kk@G)_C zmBZR)24fE<-_7F&KA--*5oIZ3&5&)gvzXYMcAeOUAziY`>Ab;^eJM2u_w@4KGFqD3 zhZmWj^bEbk%-sol_>XOu&6)UgIqvtXdxw!%=E*PtT9}Bu_LRmR8F(FiX(n%r|q6Yx9mE z@TO>jtayD?9~>te-7WAYhzCvQa+1Qg#5q^B(=2t;>v0_(3(rnkuH3Kh@?YqQBGE3j zoO&m6jVJV}b*v@xG54^!z2autsebR8aW9OK`E@Vm4l_YK=lqhz+A-E+yzSS`|-}AgupBGvnosrU?#%H*&&!H3FTD6yL z<@8zRW7WKD_0exhbF8%b&O*l=kmTw&^?NKogqKP`ue{V zdTO6*-@fP#1=x+Qh}-z?6ttuEWFJqB%K4QG#(QBrQrZXlS+tyIXPw6Uz~{1duDqd` z1F86+teIi;vI}?K8MMys_SwH0ZxPMe=juI~$Pe_aJRI&H!D7OW%)IB~o9?AmUeTCw zP{dq0ld}^&GhZG9R%l{351AHML!(q{$-CaFW@UcV^>deX{D$;;X3Oca0VtUx-On%G zii0Q4TiV2x>vQznMvzqJPsRjEAdj9?qRj`V*BiUo+J}-^ea!=p9cytOP-vL z%X8QfGG>M3yLt_cMK%0<^dQpo>mv&<=MVGEoU3_;cTYSWx;k!A=ahSgS3rCiE2f`I z=GDzoq0Vyn0SQpsL82-`=A4`BlXpvu0S#p?W5%;DZn@^ZjO*vA&XT)j-wIr#lS^sv zpL@^PV8O~aRh{;QxCiiY`*oX3-oLFd$)oi-)C;6|wc3u$4}F<2)*UC!&t81JL93oA z8}(wfH;qguik=1EU`L>DGO7oKna5B}{jD_^D|~(!Iq$D2X+P}ys7JQ0+t%&I)y}W= zI~RE1m}`wPw3T>f`Gy^+Jz@Fw0I$2!JFRYc*B%iQY!$4@=j}hX=98cXGst@~X5?VH z5x;pWgU~XE@g2q4jJ=-pmR!y2nX59ql^DMl2}~~HTp$s0kHXw*Y$!!LiGE@ue;e4~ z37s~Vq#<^#Xf3^Fr=;Rx-bbQU)|4s9J zK3UGL<|k1v5eP*WwYn=mQS+O2i7ZO1LAUfR+*fp-$M#O-=cWj5nqa)<=kny!H_j6B zF3{V#QlQiuQ6JRxelBRvnSjh^JqA*8dOe$w)vAui$%sx~VyBJNx^mcbNI!a;y&7xp zb8W5>3r3NITyv#n?tIW(lf0s@(1!>WQUeWYTU4v+C+oe?T!|Wd3!@3;rDW zyc)6{`So);sQf&*2K)BUAt}Cz&zuWC-K5sXaVHAzUXtHc+t%Jd;xo`UWlGKC)9Fj6 z+-5Fi?E^{U`I|S{FH!c3$ccxhZO(Hqa6-TJIqpOquZ}$ZIUjxwvctXfE-ioO#29{n-v)uDLxdJhjRk`j z`8wJ+R%R1YT~-hlM6OKyoU$NhuI&epAp=q~TC*DItmkq?$T2V5TmROfx3>8>dWpZs z8+HF0tzl^)?U*gE-l)fn|47NynnXP%H_UsVG;Y&+2rbTifxh5EDkI+v?%JgH8c2<5IUOLu!ErT>eusVq($kGt4(SYN< zgS52;#(l&Sig}Eg$7PL&$*3bti?L2`f_6) z>ECZB8R5Febo3$CBm4q2vZuVK0`5%vmv=ti2*ldws~7;!)Vo@e8KL)9)u*f+<=*_?VSazSl)0y|)H zZl4sdxsY4f->fLr=jM-t7#V8rdCYTKGvfDM$v*85i)pnb=XYOfT3T3MLCTrnG{t!p zyRUbc^z{(Qa(v&ne^3Lui@P<@=holSzVp1?oPTM?t}AgnX7H1c=vWgcZ>N@8Y7PGk z?!?M={7ccXrIfotk9wY-S$;R@@I%9uk_?m?!BTyChAjIiXvn^tmvJKd-S~MH&%`nC zIlTOC)4{V=KWH<7or<4^RJ<9oNjpRz#(!kTVdFZloc0zLk_p-(1-YH^!7zewHMTlh zpx$HQmR$DUQ9I@q-VZmfX4}5+xdf?7ObHu^y?U-;?x`(cPP*>}rknAfy*L-+|Jxx4 zZbe^ChbF%p5kBr5C*{{iIkmH-<|HNxh4A3cwlc~?%lQUmMZou)^shM4;m{8sffy+< z1a>58oeqiY{oVKw?o~#6;3ak|-HLuVp2qF?*JJOCWtmQ}P$N0gUhOHUQ9$x2cA2g9 z`AmP(B`f=M-Cu|fVHB2fh)0&wJU7yk5p8qAyL9-4OOMpzdtHP9`dbRzkC!{WwUjhsB4lEoqz8?pL`LfL4)HduW_-s7O_C`N zfE|S`N_6eBmPa<7=v$xg8M$~bYK2mDXSeK=oi@Ajgv5=8mJ+mitMP?K87nkn%Sv}d zz-J^GLlHBM8`wD_Q#qKib$umPCgoIj9vigtH@&c>b!-&Uw+j3m;amSvoa{*syU!k-?raT?O2tqLm`v>UO74AI7zpY z1i<@qKpT0W#rEF_{Kkr*VSdqhv+Iqd~y2ZB>vO1_-2^?tl~vd>8* z3-59%=RDgSdw;UR;j`n|GhTHEA<;UXd8I92_K%zO^kI`6UJL%X^rAmCS1Am}@ur5p zN90)EFXuOA2_u@0dq0UEA){V5>btIal;A2D#rZJm zfjcsnM-&b~M%MHkTM(>6t+N~I*&kxeyl-fIf3n_#$j=I@Y<;bK^fJ~FWy@d7Go4IQ ztFFZ@azil^5-o~GrN`(AK6!rJh~B=Ar_|?i>1CiZSy9>)y~tYeYouSW=4nT?6vx?5 zgL7X-y7S_Td5(P-oOArmcy$J8a<{z~>7c#8wT{vi~rFd)1Ei6uG^{7c9 zkNywwlr>Y%T_UI8O4`vmNO~nCS}*mCbt!gA`UWM9*`4^VevD(tnvv|;b+cLXEc4lN zn&njHvBy_e_#8vMTx^moG3vog`7CJg!_kZ!pWlt1Wdt@;t#z$EGX?uu^N<-&tc3d; zmhyR>cBDZ1zns6XI=XKKd7ZV@PuG**fNT9jxvHa%tspHGe1H;;7 z2l&}Iqf9DR2eSr=DN9)L!kW{&;x^~&cifTpden&z(C^!uQ|6LrPb3*}=Zu->{ygLp zoC9KHhwZTA_T;Ih>M!4n8rJW_v(3OhQgG9*tR?TgQx2XxUN`5_%v3Z5-JlaFdm+!q zJ$B0J`7QgF^-AoHlsUO;1p7DBZ^fuW7wcQB;Q3vBdWwhId(^U-(>Jz+Q~pi+pOQYu?}f{KZE5{`ze%QH?It}K|9;P# zX4dt_<2vn3G{G?o%`J~5b2d{=+vU_sPxpGc72*wfYs==m8Iy7A%XMaCAa$ZBKifNS zGgb*UoNQ5jI#_8aPP=*C!4%M2tcmJqUmAN@S&Q`f2W%(k!V~Jorc(||Xl+3|yIi+x z7UjW@Jjgms7xLA0ImMPtjlLFHH@5Z3^UKdK6!?V#>nMOM+%$s}^=0SH(p;KLXVj8f z@qPRz%u7cR%BA)ke?k^u9nhL$nv!9X*%_5TSlK|cY{P%oTjAKvUGEAYs+2yJcdFuh zVe6o)mu`xA6^OJOEpKK)nt9(??#Ia8Q=m<(-dBRAJ0EuOsb(vliXLJkpNhZq^i-tj z|JktG$%PHi^9wB}r7o^4@{FQ>)as(W>Nn)m%*h!{)ja0zQ?djnOoeGIL5fh5BHL4U z24-n|LY)sFC;9aLp$ARQE1m~;U;`kp@%N!n-Ux#4!*e`$c_P&pm0v?W#1k@JlTU2X zVFA<=7nuW1RL|68N?L}FiavS%$kENZ`tWL-?7k|S4 z+COuWUDArPvw8<6Ys`68xb-K|VhmIPjZ-36FFN398|g|C1Wq?5r<1ChqN=JTq`oybSL z3|cJZW3M1m!@UIwp1-KU`xuDbV8{5}2XRAeTD9r?qb29(?9}94mX5V}eyJ5`tJ}z# zTWMd*Bdz_Ze*1eNb?{x!4Kah7|6cT$bu#zM>m$S^YQ9=8BUsbwsLT|;6SL`eEm{Vb z<`~x+#vRT}X}PO=Ih7HB;-3el+?(Z`j2SDN52KGdJHM2_KXE78BVD}f z6Aw>(l6+f{A!*Q(rjKdpCwhMpT%Y_wY(nih7cnudDrc_L4q1QZOG{vB$L=PnhbN$0 zb?`VW?X;dDetKucS72mCAp5JeTAqIyW2JrG^3d$xs{fML_~k_U7=1mLd~{w`BNd(T zSxaPx?jeJ#Ri>^_xlO0dk`-)AC3c!01QuyRBIe>~EE`H4Ul+7kemh{Upw*~|tS@}K zluPv)yalBm2InIUDy2w6IzDKeAupagYnD9qJ}MB8guIp{5n?oHTH~}cAcv}+YhSAvv1tBiiMQ#N=|;Jhc2_%>J?oyO2PrvUPh~| zlL&(&CZZ>?GWz0roXTv)_P85qIiG0-`kM<~%FngK4!lIIK$CQF9`9zEQxpktooKYf z)!x?Y@kzS~`&7`S9Q3!h!uH&bH$#fU(RP08vqwdx|q2!Cq^vK)_>Z6LR-n zrK-nK6m=|<8-etu4dlk>;h%uuxHX1cSx^ha>9Fk4l_u5u4XXEg*-VMnCZ=G-oxh)FbQ)?a!A@wcfisA5=iP^|^CDkm@6Tm6qPP zk5cF6@G^DpgXYUY;A12#>1z#V;^|jG{jZ|TS1|(H@%MWCeiy&b;`dSflA?PEYDs)6 zpE|}X#iya?H4omD^VE~cxSrADpNWaJ3uBa$%XxA@1AK1)*Sus$~zEsyU^S^O_-Jy|Kpo+piqkQc8S_p)M* zq~jzxGZRk2Ce)aok8yk}K0k^*y^Qs{ZB!*c-&;&$)RoRXXK$@asfJABHn2G@(=Q&? zE$-oDd!}**L8$uF%+XU4+mE^Nf1i?^%l{xK%<4aDM(>79dA_2T=vi~@gob!GEU}xb z9O{+1)2mKcE_GAfy^B1`%}wtvRX2FVb1hjZkfV; zQs?3~+ct+^3BHC84`OW8Dtb3>$wh9>Yq!e7Y^r{no~D|}b`}kq#)p4g9&wq$~#4WH>ogdBR z{kr9Pn3ijh^0M@)-%H6oZJ&Yt$6%c;q{IWN6uLT0;#>My%rB8 z_v4uPc<01fwQi_eS)@nrMLBlK$o>KeF+O>loY-TP$nSghbH#Y+IcLL&~4{=@GJCWA9IbaIM21_mxx-9zldhy=tnWf-KwA9ZS{HZ-ufr_as3lKy8a11cmD)W zyMKajttYb3!Hb+#gtnI*=Z-8FVgrg#*Rmd&^kv3;nS)+?F55RCKL2gotzipkERSq< z9%^76Mf>Bq^M-mRH``2mdir&)ZyF*1F!Kos_gk)~}-4!?zwv9=sZeo;2wz ztp%5p>d}Ko9FfXWc>b&fqP6y0esRiPP>nH}+i^hwVfU>^OX^FJvo1u@RGWOH%s++^SM#Y?Kq|4t?l%99UpQ%DP5NElDdR9 zOZ9m3xlzsSIHlsP?eut&b(Ov;`hqpN4#@N#ar9y@e&oTc=;{~ zw1ihNhqpN4#@N#ar9y@m?PA@_jvCQkUqPrFy*ie8fAaRJ^sF9xqX*p2B*v z9<$PyP}h<@?wT?pUrMXk`}RikXqL(!>>u4kaiuS#&ypkhOqtQoX+3(<-QI{EJ=3F4 zjkUzz?8MC4s>D-@Mr}l&bttJZ$yvQ>CvbDT1H>>RF6JOj_5OGMn9+Z=xci; zdUQ~aKDF60`l_{h^jUI5pD8o?Iju)u+Z)lNk$Uv0!Isfi9oD1Ik|X*|nbFT_J^I?- zh#vjaqfdRdjJ|5L9(|S^(PzqxeopJr*Y-yAXsaH5YPV(dRloJP3klU3St@^+K1Rr)geEIFdjlo|b; z)}trg?TzTsWIg)SeM_8kZmq6W%95_FDKq+P&uKmS^}3d`$|L&Jeaq;p?&~=xOOCY9 z6eF~MBn0ZS(|Yu^y^;24vYz&-`b@R*mK@P%%8Y(a>(STtM)YX19)0S*W%O0|_2{$Yh(1$h^mAH|zP2}_N0asFQ}->S zuez^CpCw21nKGlF(|Yu^y&gU1!Fu$1vR>CJ-P)s~uO)l*HDyG>p z)7hkJmA;HVOOEI>Wkx@z_2@}=dn5W$*K(S0Gy1CgdfI2n5q+l2=;yQ^eQj?6b>A}js{4BMS#m_5DKq*xtw&$m8_}c5di1ILmeE(;*Q3vpBl=94(a&i;`r6)z z9!=JxPu;hSzUsaneU=>2XUdFzPV3Rv_D1w*vL1cvzGd`P_x0$rrX_Zf``7ChO6s?pxxV_tyHgN?G!2Ys!p1 z+jClve!Z^cjR_ttJZ$ytK>(Qs~TSi}XUynXZj_5OGMn9+Z=xcjDdQM07==Eg1u2s4v zSVdn;_ULQMh<+)pqVL-q(WA*K?YT2%lV_;(W%OBcM4u@$`Z=vfPrBP1(T}?J!ZCiW z(p_6m`_!5v`b?S8&uKk+(%s&O9xd3@KK0@f-(Ohk*D7VnQm832`fSf>J$lmDp+}ST z=u`JCqp!NJr+t(STtM%tsvdi1ILmeE(;*Q3vpBl=7+!bCr( z_2_GRBYHGhk3MzZGWx3fdh}UxM4u@$`Z=vfU)vkeqse;osr#1ESKZg6&ypkhOqtQo zX+8Sd-iRJe)}v3|w~W5(z8-y+9MNaWjDAk*(bx7y^k}jked@kt^i}uu=(FUAK2v7& zb6StSw%4QQd}NPaPuA;NrCWkk^tEJ_a%=rd(TKd1HRYkMR5QP*-JcQfs)?(5NK z$q{{~%;@K|9(`?ZM2{xxX`i}pnf6up_2{$Yh(1$h^mAH|zP1O_{s!v$ZV{hM9?!A) z+;i@z*SuD3&ttdy_i+RIc$S?L2kd<3)Pcv7{rgMjC{zdUdf-I^PUx&7hoI0bSkPH_KI%rg2_`}W&7fpd2O z)l7wYvQB4T>R8PEnroGZnW=BJn-@5v zaI?L);L)nTqToNrd*fclX@{@lmJ&YmE`%qm&wq)OuUEN6RdR5alrqL)tlpIu+yigP#Ip$IL0 zDxa5X$egajG9mAB{wdDK_-Ef;5;u@ zZQ45GJ{<0j)(u=s{Jg%+T5?^R++8hxv_->PYB@{y`VIS7%PqG?4$raNpPln@sdt$= z)|oYV2JnW%$8m;ixgMVtbFQ(zS1UT?ZfV~7!|A@w^*PsApYOim&XJFzZgbPw<`H7Q zmSEc-nViyw9ZdQ_qQO$(K)&Uk-N2=2b8tOj~nl0 zsw9g2BGoS5J+6M|TGv9Rs}0X8x8d~7z2FXE^>%$bnL{mkE~%wcQA5_UxwSs;rWVIG zHJd!uv7ejc{TTag1Bq1Si4h8pdOKJVY7Zp=3tVM%c#3~%Xs*6b>72H~mW1l2>I zJ=uEi2Iu?peJ>~RgDLTKScpGHIX?Tgzmt^ZPPN0p{mmPctZn!nUfnFK7EeYO_=-DH z9yWjON%Q~<{4ZgjKMUJ~J7HgL{ad5pVNmsl@N;=z>|eKb!jjz$59C_dHJ^m{w9x#__#W_Nyj%^Z=NOGVZ(a}p{L&hS4*VTsZSL} zExUA6NtV@}7%I!V;C={vx|0d3d^6RQKW+Hqa_er`ov4@lVICe^yYlZvPVU(_9*y$D zGx*7y(LhOfL$@Gtr^#|$i90Z%4wl2Oq6FOdLDL}T+TD-aaS!RcQIGE3qDEq5dIzX- z>kW7ZQRaI2ITfF;#0 zZ=KjDBR98r*f0?B$y(J9ZUxEyh)x#){dmT9lQ@<>OTh^+9V3F5vD{?)bjAYD4GoRf4y5KVOy5 z=Vz;LFGJ(JY_0PqqKmB_VN{Gq=&k^DWjYmF? zKC{oCTT^)#l6osXq^7?{YcE%5iNx9pX#z@SF2y22kG<3`e z4L#j${igSp5=3S-W1qB9!Q02)y&NOMC@rM z-Gk68yxUN=sN)&3N0a|V!O_apN|W02Jw8YRI3;7{BQM&@kzA0x}T zjdG%)DXM;9AIuh)teJ;V8=9CrvU&CSpy?lde%^Td!0|=2V4I&`j{m$KbqVnu#%An*BdtIbFtw{OgSU4rLdx|#F%kg@V8OV ztu~Ht#V1pS+W$HFie2s>-n5xN(4F5eBZ7i1dD^(J+9#X6#afE}EZBZTkv5m&jgdr( K@QT)Zum1-Z_42d; literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index 63bf2c0f..d425d033 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,19 @@ **/__pycache__/* -.bin/tmp \ No newline at end of file +.bin/tmp +.bin/ConEmu/ +.bin/python/ +.bin/7-Zip/ +.bin/NotepadPlusPlus/ +.cbin/ +*.exe +.bin/HWiNFO/HWiNFO*.ini +.bin/ProcessKiller/ +.bin/SysinternalsSuite/ +.bin/XMPlay/ +.bin/AIDA64/ +.bin/BleachBit/ +.bin/erunt/ +.bin/Everything/ +.bin/ProduKey/ +.bin/ClassicStartSkin/ +.bin/curl/ diff --git a/Activate Windows.cmd b/Activate Windows.cmd index 5787be18..615d5f93 100644 --- a/Activate Windows.cmd +++ b/Activate Windows.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Copy WizardKit.cmd b/Copy WizardKit.cmd index 797d1110..b421d931 100644 --- a/Copy WizardKit.cmd +++ b/Copy WizardKit.cmd @@ -2,15 +2,25 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Tools Copier color 1b echo Initializing... call :CheckFlags %* call :FindBin +call :SetTitle Tools Copier :SetVariables -set "ARCHIVE_PASS=Abracadabra" +rem Set variables using settings\main.py file +set "SETTINGS=%bin%\Scripts\settings\main.py" +for %%v in (ARCHIVE_PASSWORD KIT_NAME_FULL) do ( + set "var=%%v" + for /f "tokens=* usebackq" %%f in (`findstr "!var!=" %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "%%v=!_v:~0,-1!" + ) +) rem Set ARCH to 32 as a gross assumption and check for x86_64 status set ARCH=32 if /i "%PROCESSOR_ARCHITECTURE%" == "AMD64" set "ARCH=64" @@ -110,6 +120,14 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorNoBin echo. diff --git a/Data Recovery/PhotoRec (CLI).cmd b/Data Recovery/PhotoRec (CLI).cmd index 9e11e6c4..4d1eb5bb 100644 --- a/Data Recovery/PhotoRec (CLI).cmd +++ b/Data Recovery/PhotoRec (CLI).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Recovery/PhotoRec.cmd b/Data Recovery/PhotoRec.cmd index 2693c369..d489acd9 100644 --- a/Data Recovery/PhotoRec.cmd +++ b/Data Recovery/PhotoRec.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Recovery/TestDisk.cmd b/Data Recovery/TestDisk.cmd index 68e02164..b29aba6e 100644 --- a/Data Recovery/TestDisk.cmd +++ b/Data Recovery/TestDisk.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Transfers/FastCopy (as ADMIN).cmd b/Data Transfers/FastCopy (as ADMIN).cmd index ed567067..9de4f7e4 100644 --- a/Data Transfers/FastCopy (as ADMIN).cmd +++ b/Data Transfers/FastCopy (as ADMIN).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer :DefineLaunch @@ -79,6 +80,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Transfers/FastCopy.cmd b/Data Transfers/FastCopy.cmd index a446ae3b..eae3688c 100644 --- a/Data Transfers/FastCopy.cmd +++ b/Data Transfers/FastCopy.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer :DefineLaunch @@ -79,6 +80,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Transfers/KVRT.cmd b/Data Transfers/KVRT.cmd index 67884371..2ad0f695 100644 --- a/Data Transfers/KVRT.cmd +++ b/Data Transfers/KVRT.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Quarantine set "q_dir=%client_dir%\Quarantine\KVRT" mkdir "%q_dir%">nul 2>&1 @@ -81,6 +82,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Transfers/Q-Dir (as ADMIN).cmd b/Data Transfers/Q-Dir (as ADMIN).cmd deleted file mode 100644 index cf31d73c..00000000 --- a/Data Transfers/Q-Dir (as ADMIN).cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Q-Dir -set L_ITEM=Q-Dir.exe -set L_ARGS="%userprofile%" -set L_7ZIP= -set L_CHCK=True -set L_ELEV=True -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Data Transfers/Q-Dir.cmd b/Data Transfers/Q-Dir.cmd deleted file mode 100644 index 3a13302d..00000000 --- a/Data Transfers/Q-Dir.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Q-Dir -set L_ITEM=Q-Dir.exe -set L_ARGS="%userprofile%" -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Data Transfers/Transferred Keys.cmd b/Data Transfers/Transferred Keys.cmd index 2f5d4e9f..be1f1369 100644 --- a/Data Transfers/Transferred Keys.cmd +++ b/Data Transfers/Transferred Keys.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Data Transfers/User Data Transfer.cmd b/Data Transfers/User Data Transfer.cmd index 7a55ff7a..0820a153 100644 --- a/Data Transfers/User Data Transfer.cmd +++ b/Data Transfers/User Data Transfer.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/BatteryInfoView.cmd b/Data Transfers/XYplorer (as ADMIN).cmd similarity index 82% rename from Diagnostics/Extras/BatteryInfoView.cmd rename to Data Transfers/XYplorer (as ADMIN).cmd index 9ee208d1..2af99043 100644 --- a/Diagnostics/Extras/BatteryInfoView.cmd +++ b/Data Transfers/XYplorer (as ADMIN).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -30,9 +31,9 @@ call :FindBin :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=BatteryInfoView -set L_ITEM=BatteryInfoView.exe -set L_ARGS= +set L_PATH=XYplorerFree +set L_ITEM=XYplorerFree.exe +set L_ARGS=/exp /win=max %userprofile% set L_7ZIP= set L_CHCK=True set L_ELEV=True @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/HWiNFO (Summary).cmd b/Data Transfers/XYplorer.cmd similarity index 82% rename from Diagnostics/Extras/HWiNFO (Summary).cmd rename to Data Transfers/XYplorer.cmd index 95841f73..e4371c6c 100644 --- a/Diagnostics/Extras/HWiNFO (Summary).cmd +++ b/Data Transfers/XYplorer.cmd @@ -6,18 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin - -:Configure -rem just configure for both x32 & x64 -for %%a in (32 64) do ( - copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" - (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" - (echo SummaryOnly=1)>>"%bin%\HWiNFO\HWiNFO%%a.ini" -) +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -38,9 +31,9 @@ for %%a in (32 64) do ( :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=HWiNFO -set L_ITEM=HWiNFO.exe -set L_ARGS= +set L_PATH=XYplorerFree +set L_ITEM=XYplorerFree.exe +set L_ARGS=/exp /win=max %userprofile% set L_7ZIP= set L_CHCK=True set L_ELEV= @@ -86,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/AIDA64.cmd b/Diagnostics/Extras/AIDA64.cmd index 68b6574f..8f834b62 100644 --- a/Diagnostics/Extras/AIDA64.cmd +++ b/Diagnostics/Extras/AIDA64.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/Auslogics DiskDefrag.cmd b/Diagnostics/Extras/Auslogics DiskDefrag.cmd deleted file mode 100644 index fbf1512e..00000000 --- a/Diagnostics/Extras/Auslogics DiskDefrag.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Auslogics DiskDefrag -set L_ITEM=DiskDefrag.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd b/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd index 6be6d6d6..f355c653 100644 --- a/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd +++ b/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :Configure reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 1 /f >nul @@ -42,7 +43,7 @@ reg add HKCU\Software\Sysinternals\AutoRuns\VirusTotal /v VirusTotalTermsAccepte :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=SysinternalsSuite +set L_PATH=Autoruns set L_ITEM=Autoruns.exe set L_ARGS=-e set L_7ZIP=Autoruns* @@ -90,6 +91,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/BIOSCodes.cmd b/Diagnostics/Extras/BIOSCodes.cmd deleted file mode 100644 index 9de2ce3d..00000000 --- a/Diagnostics/Extras/BIOSCodes.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=BIOSCodes -set L_ITEM=BIOSCodes.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Diagnostics/Extras/BleachBit.cmd b/Diagnostics/Extras/BleachBit.cmd index d205fdd6..582e34c8 100644 --- a/Diagnostics/Extras/BleachBit.cmd +++ b/Diagnostics/Extras/BleachBit.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/BlueScreenView.cmd b/Diagnostics/Extras/BlueScreenView.cmd index c34c5b1b..928705c1 100644 --- a/Diagnostics/Extras/BlueScreenView.cmd +++ b/Diagnostics/Extras/BlueScreenView.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/ERUNT.cmd b/Diagnostics/Extras/ERUNT.cmd index ab0472f8..5ca53226 100644 --- a/Diagnostics/Extras/ERUNT.cmd +++ b/Diagnostics/Extras/ERUNT.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Info :DefineLaunch @@ -79,6 +80,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/GpuTest.cmd b/Diagnostics/Extras/GpuTest.cmd deleted file mode 100644 index 0255b8c6..00000000 --- a/Diagnostics/Extras/GpuTest.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=GpuTest -set L_ITEM=GpuTest_GUI.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Diagnostics/Extras/HWiNFO (Sensors).cmd b/Diagnostics/Extras/HWiNFO (Sensors).cmd index ce6bcb0e..b8038dee 100644 --- a/Diagnostics/Extras/HWiNFO (Sensors).cmd +++ b/Diagnostics/Extras/HWiNFO (Sensors).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :Configure rem just configure for both x32 & x64 @@ -43,7 +44,7 @@ set L_ITEM=HWiNFO.exe set L_ARGS= set L_7ZIP= set L_CHCK=True -set L_ELEV= +set L_ELEV=True set L_NCMD=True set L_WAIT= @@ -86,6 +87,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/Extras/HeavyLoad.cmd b/Diagnostics/Extras/HeavyLoad.cmd deleted file mode 100644 index 3a741985..00000000 --- a/Diagnostics/Extras/HeavyLoad.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=HeavyLoad -set L_ITEM=HeavyLoad.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Diagnostics/Extras/HitmanPro (FullBreach).cmd b/Diagnostics/Extras/HitmanPro (FullBreach).cmd deleted file mode 100644 index eb60c70c..00000000 --- a/Diagnostics/Extras/HitmanPro (FullBreach).cmd +++ /dev/null @@ -1,112 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin -call "%bin%\Scripts\init_client_dir.cmd" /Info - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=HitmanPro -set L_ITEM=HitmanPro.exe -set L_ARGS=/scan /noinstall /noupload /log=%log_dir%\hitman.xml /fb -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Diagnostics/Extras/HitmanPro.cmd b/Diagnostics/Extras/HitmanPro.cmd index fc85c7a2..ec6344af 100644 --- a/Diagnostics/Extras/HitmanPro.cmd +++ b/Diagnostics/Extras/HitmanPro.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Info :DefineLaunch @@ -79,6 +80,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/HWiNFO.cmd b/Diagnostics/HWiNFO.cmd index 0084eeae..564f2895 100644 --- a/Diagnostics/HWiNFO.cmd +++ b/Diagnostics/HWiNFO.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :Configure rem just configure for both x32 & x64 @@ -43,7 +44,7 @@ set L_ITEM=HWiNFO.exe set L_ARGS= set L_7ZIP= set L_CHCK=True -set L_ELEV= +set L_ELEV=True set L_NCMD=True set L_WAIT= @@ -86,6 +87,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Diagnostics/ProduKey.cmd b/Diagnostics/ProduKey.cmd index 359887d7..d4e8b544 100644 --- a/Diagnostics/ProduKey.cmd +++ b/Diagnostics/ProduKey.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :ClearConfigs if exist "%bin%\ProduKey" ( @@ -84,6 +85,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/AMD.url b/Drivers/Extras/AMD.url similarity index 100% rename from Drivers/AMD.url rename to Drivers/Extras/AMD.url diff --git a/Drivers/Extras/Acer.cmd b/Drivers/Extras/Acer.cmd index 18282c07..89addc25 100644 --- a/Drivers/Extras/Acer.cmd +++ b/Drivers/Extras/Acer.cmd @@ -6,10 +6,19 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) :OpenDriverPage start "" "http://us.acer.com/ac/en/US/content/drivers" @@ -33,8 +42,8 @@ start "" "http://us.acer.com/ac/en/US/content/drivers" :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=AIDA64 -set L_ITEM=aida64.exe +set L_PATH=HWiNFO +set L_ITEM=HWiNFO.exe set L_ARGS= set L_7ZIP= set L_CHCK=True @@ -81,6 +90,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/Extras/Device Remover.url b/Drivers/Extras/Device Remover.url new file mode 100644 index 00000000..99675801 --- /dev/null +++ b/Drivers/Extras/Device Remover.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +IDList= +URL=http://www.majorgeeks.com/files/details/device_remover_543c.html diff --git a/Drivers/Extras/DeviceRemover.cmd b/Drivers/Extras/DeviceRemover.cmd deleted file mode 100644 index aa78d852..00000000 --- a/Drivers/Extras/DeviceRemover.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=_Drivers -set L_ITEM=DeviceRemover.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Drivers/Extras/Display Driver Uninstaller.cmd b/Drivers/Extras/Display Driver Uninstaller.cmd deleted file mode 100644 index cc73a00e..00000000 --- a/Drivers/Extras/Display Driver Uninstaller.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Display Driver Uninstaller -set L_ITEM=Display Driver Uninstaller.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Misc/Windows 10 Update Assistant.url b/Drivers/Extras/Display Driver Uninstaller.url similarity index 50% rename from Misc/Windows 10 Update Assistant.url rename to Drivers/Extras/Display Driver Uninstaller.url index bf734f64..2a5a1b9e 100644 --- a/Misc/Windows 10 Update Assistant.url +++ b/Drivers/Extras/Display Driver Uninstaller.url @@ -1,5 +1,5 @@ [{000214A0-0000-0000-C000-000000000046}] Prop3=19,11 [InternetShortcut] -URL=https://support.microsoft.com/en-us/help/12387/windows-10-update-history IDList= +URL=https://www.wagnardsoft.com/ diff --git a/Drivers/Extras/Intel Driver & Support Assistant.url b/Drivers/Extras/Intel Driver & Support Assistant.url new file mode 100644 index 00000000..45ec2894 --- /dev/null +++ b/Drivers/Extras/Intel Driver & Support Assistant.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,11 +[InternetShortcut] +IDList= +URL=https://www.intel.com/content/www/us/en/support/detect.html diff --git a/Drivers/Extras/Lenovo.cmd b/Drivers/Extras/Lenovo.cmd index f82029e8..f072ae41 100644 --- a/Drivers/Extras/Lenovo.cmd +++ b/Drivers/Extras/Lenovo.cmd @@ -6,10 +6,19 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) :OpenDriverPage start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" @@ -33,8 +42,8 @@ start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=AIDA64 -set L_ITEM=aida64.exe +set L_PATH=HWiNFO +set L_ITEM=HWiNFO.exe set L_ARGS= set L_7ZIP= set L_CHCK=True @@ -81,6 +90,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/NVIDIA.url b/Drivers/Extras/NVIDIA.url similarity index 100% rename from Drivers/NVIDIA.url rename to Drivers/Extras/NVIDIA.url diff --git a/Drivers/Extras/Samsung Tools & Software.url b/Drivers/Extras/Samsung Tools & Software.url new file mode 100644 index 00000000..93f5f9d3 --- /dev/null +++ b/Drivers/Extras/Samsung Tools & Software.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +IDList= +URL=http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html diff --git a/Drivers/Extras/Toshiba.cmd b/Drivers/Extras/Toshiba.cmd index f767bd32..28116d3b 100644 --- a/Drivers/Extras/Toshiba.cmd +++ b/Drivers/Extras/Toshiba.cmd @@ -6,10 +6,19 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) :OpenDriverPage start "" "http://support.toshiba.com/drivers" @@ -33,8 +42,8 @@ start "" "http://support.toshiba.com/drivers" :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=AIDA64 -set L_ITEM=aida64.exe +set L_PATH=HWiNFO +set L_ITEM=HWiNFO.exe set L_ARGS= set L_7ZIP= set L_CHCK=True @@ -81,6 +90,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/Intel Driver Update Utility.cmd b/Drivers/Intel Driver Update Utility.cmd deleted file mode 100644 index 606559d7..00000000 --- a/Drivers/Intel Driver Update Utility.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=_Drivers -set L_ITEM=Intel Driver Update Utility.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Drivers/Intel RST (Current Release).cmd b/Drivers/Intel RST (Current Release).cmd index e5b57b3a..8f5f09c4 100644 --- a/Drivers/Intel RST (Current Release).cmd +++ b/Drivers/Intel RST (Current Release).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,9 +32,9 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program set L_PATH=_Drivers\Intel RST -set L_ITEM=SetupRST_15.2.exe +set L_ITEM=SetupRST_15.8.exe set L_ARGS= -set L_7ZIP=SetupRST_15.2.exe +set L_7ZIP=SetupRST_15.8.exe set L_CHCK=True set L_ELEV= set L_NCMD=True @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/Intel RST (Previous Releases).cmd b/Drivers/Intel RST (Previous Releases).cmd index a9b868ae..8c6a994b 100644 --- a/Drivers/Intel RST (Previous Releases).cmd +++ b/Drivers/Intel RST (Previous Releases).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/Intel SSD Toolbox.cmd b/Drivers/Intel SSD Toolbox.cmd index 67c4d307..c830d5e0 100644 --- a/Drivers/Intel SSD Toolbox.cmd +++ b/Drivers/Intel SSD Toolbox.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/Samsing Magician.cmd b/Drivers/Samsing Magician.cmd index 5770bcf0..84b003ef 100644 --- a/Drivers/Samsing Magician.cmd +++ b/Drivers/Samsing Magician.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Drivers/Samsung NVMe Driver.cmd b/Drivers/Samsung NVMe Driver.cmd deleted file mode 100644 index c99e28de..00000000 --- a/Drivers/Samsung NVMe Driver.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=_Drivers -set L_ITEM=Samsung NVMe Driver.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Drivers/Snappy Driver Installer.cmd b/Drivers/Snappy Driver Installer.cmd index 9a0a0907..fdbf842a 100644 --- a/Drivers/Snappy Driver Installer.cmd +++ b/Drivers/Snappy Driver Installer.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Enter SafeMode.cmd b/Enter SafeMode.cmd index 03792946..64dc125e 100644 --- a/Enter SafeMode.cmd +++ b/Enter SafeMode.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Exit SafeMode.cmd b/Exit SafeMode.cmd index f9157478..19ac904c 100644 --- a/Exit SafeMode.cmd +++ b/Exit SafeMode.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd deleted file mode 100644 index ae66c179..00000000 --- a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2010 -set L_ITEM=Outlook 2010 (SP2) (x32) -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd deleted file mode 100644 index a27149e5..00000000 --- a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2010 -set L_ITEM=Outlook 2010 (SP2) (x64) -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd b/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd deleted file mode 100644 index 8649e3a8..00000000 --- a/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2010 -set L_ITEM=Professional Plus 2010 (SP2) -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd b/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd deleted file mode 100644 index a2925608..00000000 --- a/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2010 -set L_ITEM=Publisher 2010 (SP2) -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd b/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd deleted file mode 100644 index e8c3b017..00000000 --- a/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2010 -set L_ITEM=Single Image 2010 (SP2) -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd b/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd index a0542d0e..f80f5afd 100644 --- a/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd +++ b/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd b/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd index e88aff55..a622b8b1 100644 --- a/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd +++ b/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd b/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd index 34059b71..d6da84d5 100644 --- a/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd +++ b/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd b/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd index a2da52da..4f946af2 100644 --- a/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd +++ b/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2013/Office 365 2013 (x32).cmd b/Installers/Extras/Office/2013/Office 365 2013 (x32).cmd deleted file mode 100644 index c79e51d9..00000000 --- a/Installers/Extras/Office/2013/Office 365 2013 (x32).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2013 -set L_ITEM=365_32.xml -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Office 365 2013 (x64).cmd b/Installers/Extras/Office/2013/Office 365 2013 (x64).cmd deleted file mode 100644 index 05290ec9..00000000 --- a/Installers/Extras/Office/2013/Office 365 2013 (x64).cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Office -set L_PATH=2013 -set L_ITEM=365_64.xml -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd b/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd index 938d79a1..41ae7ed8 100644 --- a/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd +++ b/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd b/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd index ea209113..0b091dfb 100644 --- a/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd +++ b/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd b/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd index 47fbf4e6..95c5218b 100644 --- a/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd +++ b/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd b/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd index 59a76531..bebd1ef8 100644 --- a/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd +++ b/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd b/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd index 7d5f2ad3..8cb85d76 100644 --- a/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd +++ b/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd b/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd index 37e0c425..6dd35122 100644 --- a/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd +++ b/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -77,6 +78,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/QuickBooks/2010/QuickBooksPremier2010_R17.cmd b/Installers/Extras/QuickBooks/2010/QuickBooksPremier2010_R17.cmd deleted file mode 100644 index 58b53c91..00000000 --- a/Installers/Extras/QuickBooks/2010/QuickBooksPremier2010_R17.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2010 -set L_ITEM=QuickBooksPremier2010_R17 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2010/QuickBooksPro2010_R17.cmd b/Installers/Extras/QuickBooks/2010/QuickBooksPro2010_R17.cmd deleted file mode 100644 index 2268dc6f..00000000 --- a/Installers/Extras/QuickBooks/2010/QuickBooksPro2010_R17.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2010 -set L_ITEM=QuickBooksPro2010_R17 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2011/QuickBooksPremier2011_R14.cmd b/Installers/Extras/QuickBooks/2011/QuickBooksPremier2011_R14.cmd deleted file mode 100644 index 015879fc..00000000 --- a/Installers/Extras/QuickBooks/2011/QuickBooksPremier2011_R14.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2011 -set L_ITEM=QuickBooksPremier2011_R14 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2011/QuickBooksPro2011_R14.cmd b/Installers/Extras/QuickBooks/2011/QuickBooksPro2011_R14.cmd deleted file mode 100644 index 03b15b58..00000000 --- a/Installers/Extras/QuickBooks/2011/QuickBooksPro2011_R14.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2011 -set L_ITEM=QuickBooksPro2011_R14 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2012/QuickBooksPremier2012_R16.cmd b/Installers/Extras/QuickBooks/2012/QuickBooksPremier2012_R16.cmd deleted file mode 100644 index 6558fc11..00000000 --- a/Installers/Extras/QuickBooks/2012/QuickBooksPremier2012_R16.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2012 -set L_ITEM=QuickBooksPremier2012_R16 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2012/QuickBooksPro2012_R16.cmd b/Installers/Extras/QuickBooks/2012/QuickBooksPro2012_R16.cmd deleted file mode 100644 index b3de80b0..00000000 --- a/Installers/Extras/QuickBooks/2012/QuickBooksPro2012_R16.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2012 -set L_ITEM=QuickBooksPro2012_R16 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2013/QuickBooksPremier2013_R18.cmd b/Installers/Extras/QuickBooks/2013/QuickBooksPremier2013_R18.cmd deleted file mode 100644 index f04a13a8..00000000 --- a/Installers/Extras/QuickBooks/2013/QuickBooksPremier2013_R18.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2013 -set L_ITEM=QuickBooksPremier2013_R18 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2013/QuickBooksPro2013_R18.cmd b/Installers/Extras/QuickBooks/2013/QuickBooksPro2013_R18.cmd deleted file mode 100644 index 4283277e..00000000 --- a/Installers/Extras/QuickBooks/2013/QuickBooksPro2013_R18.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2013 -set L_ITEM=QuickBooksPro2013_R18 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2014/QuickBooksPremier2014_R15.cmd b/Installers/Extras/QuickBooks/2014/QuickBooksPremier2014_R15.cmd deleted file mode 100644 index a254b15f..00000000 --- a/Installers/Extras/QuickBooks/2014/QuickBooksPremier2014_R15.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2014 -set L_ITEM=QuickBooksPremier2014_R15 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2014/QuickBooksPro2014_R15.cmd b/Installers/Extras/QuickBooks/2014/QuickBooksPro2014_R15.cmd deleted file mode 100644 index 617904ab..00000000 --- a/Installers/Extras/QuickBooks/2014/QuickBooksPro2014_R15.cmd +++ /dev/null @@ -1,110 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console -:: Office -:: Program -:: PSScript -:: PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %bin%\L_PATH -:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to the filename of the item to launch (or Office product to install) -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=QuickBooks -set L_PATH=2014 -set L_ITEM=QuickBooksPro2014_R15 -set L_ARGS= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Installers/Extras/QuickBooks/2015/QuickBooksPro2015_R13.cmd b/Installers/Extras/QuickBooks/2015/QuickBooksPremier2015.cmd similarity index 84% rename from Installers/Extras/QuickBooks/2015/QuickBooksPro2015_R13.cmd rename to Installers/Extras/QuickBooks/2015/QuickBooksPremier2015.cmd index 65d7c555..b09a8f0d 100644 --- a/Installers/Extras/QuickBooks/2015/QuickBooksPro2015_R13.cmd +++ b/Installers/Extras/QuickBooks/2015/QuickBooksPremier2015.cmd @@ -10,6 +10,7 @@ setlocal title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,7 +32,7 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=QuickBooks set L_PATH=2015 -set L_ITEM=QuickBooksPro2015_R13 +set L_ITEM=QuickBooksPremier2015 set L_ARGS= set L_CHCK=True set L_ELEV= @@ -77,6 +78,19 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "KIT_NAME_FULL=%%f" +) +set "KIT_NAME_FULL=%KIT_NAME_FULL:~15,-1%" +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/QuickBooks/2015/QuickBooksPremier2015_R13.cmd b/Installers/Extras/QuickBooks/2015/QuickBooksPro2015.cmd similarity index 84% rename from Installers/Extras/QuickBooks/2015/QuickBooksPremier2015_R13.cmd rename to Installers/Extras/QuickBooks/2015/QuickBooksPro2015.cmd index 2f86c348..15b14db0 100644 --- a/Installers/Extras/QuickBooks/2015/QuickBooksPremier2015_R13.cmd +++ b/Installers/Extras/QuickBooks/2015/QuickBooksPro2015.cmd @@ -10,6 +10,7 @@ setlocal title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,7 +32,7 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=QuickBooks set L_PATH=2015 -set L_ITEM=QuickBooksPremier2015_R13 +set L_ITEM=QuickBooksPro2015 set L_ARGS= set L_CHCK=True set L_ELEV= @@ -77,6 +78,19 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "KIT_NAME_FULL=%%f" +) +set "KIT_NAME_FULL=%KIT_NAME_FULL:~15,-1%" +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/QuickBooks/2016/QuickBooksPro2016_R9.cmd b/Installers/Extras/QuickBooks/2016/QuickBooksPremier2016.cmd similarity index 84% rename from Installers/Extras/QuickBooks/2016/QuickBooksPro2016_R9.cmd rename to Installers/Extras/QuickBooks/2016/QuickBooksPremier2016.cmd index d0f5a152..d80839c1 100644 --- a/Installers/Extras/QuickBooks/2016/QuickBooksPro2016_R9.cmd +++ b/Installers/Extras/QuickBooks/2016/QuickBooksPremier2016.cmd @@ -10,6 +10,7 @@ setlocal title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,7 +32,7 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=QuickBooks set L_PATH=2016 -set L_ITEM=QuickBooksPro2016_R9 +set L_ITEM=QuickBooksPremier2016 set L_ARGS= set L_CHCK=True set L_ELEV= @@ -77,6 +78,19 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "KIT_NAME_FULL=%%f" +) +set "KIT_NAME_FULL=%KIT_NAME_FULL:~15,-1%" +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/QuickBooks/2016/QuickBooksPremier2016_R9.cmd b/Installers/Extras/QuickBooks/2016/QuickBooksPro2016.cmd similarity index 84% rename from Installers/Extras/QuickBooks/2016/QuickBooksPremier2016_R9.cmd rename to Installers/Extras/QuickBooks/2016/QuickBooksPro2016.cmd index 986f61e0..71010aa0 100644 --- a/Installers/Extras/QuickBooks/2016/QuickBooksPremier2016_R9.cmd +++ b/Installers/Extras/QuickBooks/2016/QuickBooksPro2016.cmd @@ -10,6 +10,7 @@ setlocal title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,7 +32,7 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=QuickBooks set L_PATH=2016 -set L_ITEM=QuickBooksPremier2016_R9 +set L_ITEM=QuickBooksPro2016 set L_ARGS= set L_CHCK=True set L_ELEV= @@ -77,6 +78,19 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "KIT_NAME_FULL=%%f" +) +set "KIT_NAME_FULL=%KIT_NAME_FULL:~15,-1%" +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/QuickBooks/2017/QuickBooksPro2017_R4.cmd b/Installers/Extras/QuickBooks/2017/QuickBooksPremier2017.cmd similarity index 84% rename from Installers/Extras/QuickBooks/2017/QuickBooksPro2017_R4.cmd rename to Installers/Extras/QuickBooks/2017/QuickBooksPremier2017.cmd index 91ae4b82..371629f6 100644 --- a/Installers/Extras/QuickBooks/2017/QuickBooksPro2017_R4.cmd +++ b/Installers/Extras/QuickBooks/2017/QuickBooksPremier2017.cmd @@ -10,6 +10,7 @@ setlocal title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,7 +32,7 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=QuickBooks set L_PATH=2017 -set L_ITEM=QuickBooksPro2017_R4 +set L_ITEM=QuickBooksPremier2017 set L_ARGS= set L_CHCK=True set L_ELEV= @@ -77,6 +78,19 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "KIT_NAME_FULL=%%f" +) +set "KIT_NAME_FULL=%KIT_NAME_FULL:~15,-1%" +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/Extras/QuickBooks/2017/QuickBooksPremier2017_R4.cmd b/Installers/Extras/QuickBooks/2017/QuickBooksPro2017.cmd similarity index 84% rename from Installers/Extras/QuickBooks/2017/QuickBooksPremier2017_R4.cmd rename to Installers/Extras/QuickBooks/2017/QuickBooksPro2017.cmd index 487da248..632d9fb9 100644 --- a/Installers/Extras/QuickBooks/2017/QuickBooksPremier2017_R4.cmd +++ b/Installers/Extras/QuickBooks/2017/QuickBooksPro2017.cmd @@ -10,6 +10,7 @@ setlocal title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -31,7 +32,7 @@ call :FindBin :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=QuickBooks set L_PATH=2017 -set L_ITEM=QuickBooksPremier2017_R4 +set L_ITEM=QuickBooksPro2017 set L_ARGS= set L_CHCK=True set L_ELEV= @@ -77,6 +78,19 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "KIT_NAME_FULL=%%f" +) +set "KIT_NAME_FULL=%KIT_NAME_FULL:~15,-1%" +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Installers/SW Bundle.cmd b/Installers/SW Bundle.cmd index 7e5eda39..c9168179 100644 --- a/Installers/SW Bundle.cmd +++ b/Installers/SW Bundle.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Misc/ConEmu (as ADMIN).cmd b/Misc/ConEmu (as ADMIN).cmd index e288c75c..2499d61b 100644 --- a/Misc/ConEmu (as ADMIN).cmd +++ b/Misc/ConEmu (as ADMIN).cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Misc/ConEmu.cmd b/Misc/ConEmu.cmd index 90b0cdad..3526cffa 100644 --- a/Misc/ConEmu.cmd +++ b/Misc/ConEmu.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Misc/Everything.cmd b/Misc/Everything.cmd index e763602e..ec340519 100644 --- a/Misc/Everything.cmd +++ b/Misc/Everything.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -35,7 +36,7 @@ set L_ITEM=Everything.exe set L_ARGS=-nodb set L_7ZIP= set L_CHCK=True -set L_ELEV= +set L_ELEV=True set L_NCMD=True set L_WAIT= @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Misc/MailPasswordView (as ADMIN).cmd b/Misc/MailPasswordView (as ADMIN).cmd deleted file mode 100644 index b4a8c1b3..00000000 --- a/Misc/MailPasswordView (as ADMIN).cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Mail PassView -set L_ITEM=mailpv.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV=True -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Misc/MailPasswordView.cmd b/Misc/MailPasswordView.cmd deleted file mode 100644 index 4ec5307f..00000000 --- a/Misc/MailPasswordView.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Mail PassView -set L_ITEM=mailpv.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Misc/NK2Edit.cmd b/Misc/NK2Edit.cmd deleted file mode 100644 index b02c4ec2..00000000 --- a/Misc/NK2Edit.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=NK2Edit -set L_ITEM=NK2Edit.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Misc/Nirsoft Utilities - Outlook.url b/Misc/Nirsoft Utilities - Outlook.url new file mode 100644 index 00000000..8db662fd --- /dev/null +++ b/Misc/Nirsoft Utilities - Outlook.url @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +IDList= +URL=http://www.nirsoft.net/outlook_office_software.html +HotKey=0 diff --git a/Misc/Nirsoft Utilities - Passwords.url b/Misc/Nirsoft Utilities - Passwords.url new file mode 100644 index 00000000..39cc3292 --- /dev/null +++ b/Misc/Nirsoft Utilities - Passwords.url @@ -0,0 +1,6 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +IDList= +URL=http://www.nirsoft.net/password_recovery_tools.html +HotKey=0 diff --git a/Misc/Notepad++.cmd b/Misc/Notepad++.cmd index 385a08da..85026824 100644 --- a/Misc/Notepad++.cmd +++ b/Misc/Notepad++.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Misc/OutlookAddressBookView (as ADMIN).cmd b/Misc/OutlookAddressBookView (as ADMIN).cmd deleted file mode 100644 index c46821b4..00000000 --- a/Misc/OutlookAddressBookView (as ADMIN).cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=OutlookAddressBookView -set L_ITEM=OutlookAddressBookView.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV=True -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Misc/OutlookAddressBookView.cmd b/Misc/OutlookAddressBookView.cmd deleted file mode 100644 index fa113586..00000000 --- a/Misc/OutlookAddressBookView.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=OutlookAddressBookView -set L_ITEM=OutlookAddressBookView.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Misc/OutlookAttachView (as ADMIN).cmd b/Misc/OutlookAttachView (as ADMIN).cmd deleted file mode 100644 index 4e6e3e7c..00000000 --- a/Misc/OutlookAttachView (as ADMIN).cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=OutlookAttachView -set L_ITEM=OutlookAttachView.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV=True -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Misc/OutlookAttachView.cmd b/Misc/OutlookAttachView.cmd deleted file mode 100644 index f86e9548..00000000 --- a/Misc/OutlookAttachView.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=OutlookAttachView -set L_ITEM=OutlookAttachView.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% diff --git a/Misc/Sysinternals Suite (Live).url b/Misc/Sysinternals Suite (Live).url new file mode 100644 index 00000000..8b217e29 --- /dev/null +++ b/Misc/Sysinternals Suite (Live).url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +IDList= +URL=http://live.sysinternals.com/ diff --git a/Misc/SysinternalsSuite.cmd b/Misc/SysinternalsSuite.cmd deleted file mode 100644 index b77da620..00000000 --- a/Misc/SysinternalsSuite.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Folder -set L_PATH=SysinternalsSuite -set L_ITEM=. -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Repairs/Extras/Complete Internet Repair.cmd b/Misc/TreeSizeFree.cmd similarity index 83% rename from Repairs/Extras/Complete Internet Repair.cmd rename to Misc/TreeSizeFree.cmd index ef583b69..eece55aa 100644 --- a/Repairs/Extras/Complete Internet Repair.cmd +++ b/Misc/TreeSizeFree.cmd @@ -6,26 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin -call "%bin%\Scripts\init_client_dir.cmd" /Info - -:LaunchERUNT -rem Backup registry first -echo Backing up registry... -set L_TYPE=Program -set L_PATH=erunt -set L_ITEM=ERUNT.EXE -set L_ARGS=%log_dir%\Registry sysreg curuser otherusers -set L_7ZIP= -set L_CHCK= -set L_ELEV=True -set L_NCMD=True -set L_WAIT= -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -ping -n 5 127.0.0.1>nul +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -46,12 +31,12 @@ ping -n 5 127.0.0.1>nul :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=Complete Internet Repair -set L_ITEM=ComIntRep.exe +set L_PATH=TreeSizeFree +set L_ITEM=TreeSizeFree.exe set L_ARGS= set L_7ZIP= set L_CHCK=True -set L_ELEV= +set L_ELEV=True set L_NCMD=True set L_WAIT= @@ -94,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Misc/WinDirStat.cmd b/Misc/WinDirStat.cmd deleted file mode 100644 index 9261acbe..00000000 --- a/Misc/WinDirStat.cmd +++ /dev/null @@ -1,125 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:Config -reg add HKCU\Software\Seifert\WinDirStat\options /v followJunctionPoints /t REG_DWORD /d 0 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v followMountPoints /t REG_DWORD /d 0 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v humanFormat /t REG_DWORD /d 1 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v language /t REG_DWORD /d 409 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v listFullRowSelection /t REG_DWORD /d 1 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v listStripes /t REG_DWORD /d 1 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v pacmanAnimation /t REG_DWORD /d 1 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v showTimeSpent /t REG_DWORD /d 0 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v treelistGrid /t REG_DWORD /d 0 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v treemapGrid /t REG_DWORD /d 0 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\options /v useWdsLocale /t REG_DWORD /d 0 /f >nul -reg add HKCU\Software\Seifert\WinDirStat\persistence /v showTreemap /t REG_DWORD /d 0 /f >nul - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=WinDirStat -set L_ITEM=windirstat.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV=True -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Misc/XMPlay.cmd b/Misc/XMPlay.cmd index f676eac8..468b8d04 100644 --- a/Misc/XMPlay.cmd +++ b/Misc/XMPlay.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/AdwCleaner.cmd b/Repairs/AdwCleaner.cmd index 8bdda6ed..5efa7114 100644 --- a/Repairs/AdwCleaner.cmd +++ b/Repairs/AdwCleaner.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/Autoruns.cmd b/Repairs/Autoruns.cmd index b48a7877..7df953ac 100644 --- a/Repairs/Autoruns.cmd +++ b/Repairs/Autoruns.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :Configure reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 0 /f >nul @@ -42,7 +43,7 @@ reg add HKCU\Software\Sysinternals\AutoRuns\VirusTotal /v VirusTotalTermsAccepte :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=SysinternalsSuite +set L_PATH=Autoruns set L_ITEM=Autoruns.exe set L_ARGS=-e set L_7ZIP=Autoruns* @@ -90,6 +91,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/CHKDSK (Fix).cmd b/Repairs/CHKDSK (Fix).cmd deleted file mode 100644 index 4b903855..00000000 --- a/Repairs/CHKDSK (Fix).cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=PyScript -set L_PATH=Scripts -set L_ITEM=check_disk_fix.py -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV=True -set L_NCMD= -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Repairs/CHKDSK.cmd b/Repairs/CHKDSK.cmd index 99a3c18f..cb4404de 100644 --- a/Repairs/CHKDSK.cmd +++ b/Repairs/CHKDSK.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/DISM.cmd b/Repairs/DISM.cmd index da093801..e15bba1b 100644 --- a/Repairs/DISM.cmd +++ b/Repairs/DISM.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/Extras/ESET.cmd b/Repairs/Extras/ESET.cmd deleted file mode 100644 index 859842f0..00000000 --- a/Repairs/Extras/ESET.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=ESET -set L_ITEM=ESET.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Repairs/JRT.cmd b/Repairs/JRT.cmd deleted file mode 100644 index 11547b6a..00000000 --- a/Repairs/JRT.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=JRT -set L_ITEM=JRT.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Repairs/KVRT.cmd b/Repairs/KVRT.cmd index 67884371..2ad0f695 100644 --- a/Repairs/KVRT.cmd +++ b/Repairs/KVRT.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Quarantine set "q_dir=%client_dir%\Quarantine\KVRT" mkdir "%q_dir%">nul 2>&1 @@ -81,6 +82,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/MBAM.cmd b/Repairs/MBAM.cmd deleted file mode 100644 index fba00866..00000000 --- a/Repairs/MBAM.cmd +++ /dev/null @@ -1,119 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:InstallOrUpdate -start "" /wait "%bin%\..\Installers\Extras\Security\Malwarebytes Anti-Malware.exe" - -:FindInstallation -set install_path= -if exist "%programfiles%\Malwarebytes Anti-Malware\mbam.exe" (set "install_path=%programfiles%\Malwarebytes Anti-Malware") -if exist "%programfiles(x86)%\Malwarebytes Anti-Malware\mbam.exe" (set "install_path=%programfiles(x86)%\Malwarebytes Anti-Malware") - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=%install_path% -set L_ITEM=mbam.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/Repairs/RKill.cmd b/Repairs/RKill.cmd index 662ad4a6..44da0cd3 100644 --- a/Repairs/RKill.cmd +++ b/Repairs/RKill.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Info :UglyHackToOpenRKillFolder @@ -83,6 +84,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/SFC Scan.cmd b/Repairs/SFC Scan.cmd index 89957df2..282e11b7 100644 --- a/Repairs/SFC Scan.cmd +++ b/Repairs/SFC Scan.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Repairs/Extras/TDSSKiller.cmd b/Repairs/TDSSKiller.cmd similarity index 86% rename from Repairs/Extras/TDSSKiller.cmd rename to Repairs/TDSSKiller.cmd index d50c24d0..588cf17f 100644 --- a/Repairs/Extras/TDSSKiller.cmd +++ b/Repairs/TDSSKiller.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher call "%bin%\Scripts\init_client_dir.cmd" /Quarantine set "q_dir=%client_dir%\Quarantine\TDSSKiller" mkdir "%q_dir%">nul 2>&1 @@ -81,6 +82,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/System Checklist.cmd b/System Checklist.cmd index cbed9121..03c398cd 100644 --- a/System Checklist.cmd +++ b/System Checklist.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/System Diagnostics.cmd b/System Diagnostics.cmd index bd3abc2d..56a25389 100644 --- a/System Diagnostics.cmd +++ b/System Diagnostics.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Uninstallers/IObit Uninstaller.cmd b/Uninstallers/IObit Uninstaller.cmd index 0db9604d..c418fd32 100644 --- a/Uninstallers/IObit Uninstaller.cmd +++ b/Uninstallers/IObit Uninstaller.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo. diff --git a/Uninstallers/Revo Uninstaller.cmd b/Uninstallers/Revo Uninstaller.cmd deleted file mode 100644 index d4d4f678..00000000 --- a/Uninstallers/Revo Uninstaller.cmd +++ /dev/null @@ -1,111 +0,0 @@ -:: Wizard Kit: Launcher Script :: -:: -:: This script works by setting env variables and then calling Launch.cmd -:: which inherits the variables. This bypasses batch file argument parsing -:: which is awful. -@echo off - -:Init -setlocal -title Wizard Kit: Launcher -call :CheckFlags %* -call :FindBin - -:DefineLaunch -:: Set L_TYPE to one of these options: -:: Console, Folder, Office, Program, PSScript, or PyScript -:: Set L_PATH to the path to the program folder -:: NOTE: Launch.cmd will test for L_PATH in the following order: -:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) -:: 2: %bin%\L_PATH -:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) -:: Set L_ITEM to one of the following: -:: 1. The filename of the item to launch -:: 2. The Office product to install -:: 3. '.' to open extracted folder -:: Set L_ARGS to include any necessary arguments (if any) -:: Set L_7ZIP to include any necessary arguments for extraction -:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered -:: Set L_ELEV to True to launch with elevated permissions -:: Set L_NCMD to True to stay in the native console window -:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted -set L_TYPE=Program -set L_PATH=Revo Uninstaller -set L_ITEM=Revouninstaller.exe -set L_ARGS= -set L_7ZIP= -set L_CHCK=True -set L_ELEV= -set L_NCMD=True -set L_WAIT= - -::::::::::::::::::::::::::::::::::::::::::: -:: Do not edit anything below this line! :: -::::::::::::::::::::::::::::::::::::::::::: - -:LaunchPrep -rem Verifies the environment before launching item -if not defined bin (goto ErrorNoBin) -if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) - -:Launch -rem Calls the Launch.cmd script using the variables defined above -call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD -goto Exit - -:: Functions :: -:CheckFlags -rem Loops through all arguments to check for accepted flags -set DEBUG= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") -) -@exit /b 0 - -:FindBin -rem Checks the current directory and all parents for the ".bin" folder -rem NOTE: Has not been tested for UNC paths -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" (goto FindBinDone) -if "%~d0\" == "%cd%" (popd & @exit /b 1) -cd .. -goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" -set "cbin=%cd%\.cbin" -popd -@exit /b 0 - -:: Errors :: -:ErrorLaunchCMD -echo. -echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? -goto Abort - -:ErrorLaunchCMDMissing -echo. -echo ERROR: Launch.cmd script not found. -goto Abort - -:ErrorNoBin -echo. -echo ERROR: ".bin" folder not found. -goto Abort - -:Abort -color 4e -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -color -rem Set errorlevel to 1 by calling color incorrectly -color 00 -goto Exit - -:: Cleanup and exit :: -:Exit -endlocal -exit /b %errorlevel% \ No newline at end of file diff --git a/User Checklist.cmd b/User Checklist.cmd index 77a8d4d7..6d8ae60b 100644 --- a/User Checklist.cmd +++ b/User Checklist.cmd @@ -6,10 +6,11 @@ @echo off :Init -setlocal +setlocal EnableDelayedExpansion title Wizard Kit: Launcher call :CheckFlags %* call :FindBin +call :SetTitle Launcher :DefineLaunch :: Set L_TYPE to one of these options: @@ -78,6 +79,20 @@ set "cbin=%cd%\.cbin" popd @exit /b 0 +:SetTitle +rem Sets title using KIT_NAME_FULL from settings\main.py +set "SETTINGS=%bin%\Scripts\settings\main.py" +for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do ( + set "_v=%%f" + set "_v=!_v:*'=!" + set "KIT_NAME_FULL=!_v:~0,-1!" +) +set "window_title=%*" +if not defined window_title set "window_title=Launcher" +set "window_title=%KIT_NAME_FULL%: %window_title%" +title %window_title% +@exit /b 0 + :: Errors :: :ErrorLaunchCMD echo.