diff --git a/dumpsmc.exe b/dumpsmc.exe deleted file mode 100755 index 8b930cc..0000000 Binary files a/dumpsmc.exe and /dev/null differ diff --git a/gettools.exe b/gettools.exe deleted file mode 100755 index 6065df0..0000000 Binary files a/gettools.exe and /dev/null differ diff --git a/gettools.py b/gettools.py index 6328dc4..0817666 100755 --- a/gettools.py +++ b/gettools.py @@ -29,6 +29,9 @@ import shutil import tarfile import zipfile +import time + +ARCH = 'x86_x64' try: # For Python 3.0 and later @@ -70,90 +73,94 @@ def clean(self): def convertpath(path): # OS path separator replacement funciton return path.replace(os.path.sep, '/') - + +def reporthook(count, block_size, total_size): + global start_time + if count == 0: + start_time = time.time() + return + duration = time.time() - start_time + progress_size = int(count * block_size) + speed = int(progress_size / (1024 * duration)) if duration>0 else 0 + percent = min(int(count*block_size*100/total_size),100) + time_remaining = ((total_size - progress_size)/1024) / speed if speed > 0 else 0 + sys.stdout.write("\r...%d%%, %d MB, %d KB/s, %d seconds remaining" % + (percent, progress_size / (1024 * 1024), speed, time_remaining)) + sys.stdout.flush() def main(): - # Check minimal Python version is 2.7 - if sys.version_info < (2, 7): - sys.stderr.write('You need Python 2.7 or later\n') - sys.exit(1) - - # Setup url and file paths - url = 'http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/' - dest = os.path.dirname(os.path.abspath(__file__)) - - # Re-create the tools folder - shutil.rmtree(dest + '/tools', True) - os.mkdir(dest + '/tools') - - # Get the list of Fusion releases - # And get the last item in the ul/li tags - response = urlopen(url) - html = response.read() - parser = CDSParser() - parser.feed(str(html)) - url = url + parser.HTMLDATA[-1] + '/' - parser.clean() - - # Open the latest release page - # And build file URL - response = urlopen(url) - html = response.read() - parser.feed(str(html)) - urlpost15 = url + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwin.zip.tar' - urlpre15 = url + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwinPre15.zip.tar' - parser.clean() - - # Download the darwin.iso tgz file - print('Retrieving Darwin tools from: ' + urlpost15) - urlretrieve(urlpost15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar')) - - # Extract the tar to zip - tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'), 'r') - tar.extract('com.vmware.fusion.tools.darwin.zip', path=convertpath(dest + '/tools/')) - tar.close() - - # Extract the iso and sig files from zip - cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip'), 'r') - cdszip.extract('payload/darwin.iso', path=convertpath(dest + '/tools/')) - cdszip.extract('payload/darwin.iso.sig', path=convertpath(dest + '/tools/')) - cdszip.close() - - # Move the iso and sig files to tools folder - shutil.move(convertpath(dest + '/tools/payload/darwin.iso'), convertpath(dest + '/tools/darwin.iso')) - shutil.move(convertpath(dest + '/tools/payload/darwin.iso.sig'), convertpath(dest + '/tools/darwin.iso.sig')) - - # Cleanup working files and folders - shutil.rmtree(convertpath(dest + '/tools/payload'), True) - os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar')) - os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip')) - - # Download the darwinPre15.iso tgz file - print('Retrieving DarwinPre15 tools from: ' + urlpre15) - urlretrieve(urlpre15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar')) - - # Extract the tar to zip - tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'), 'r') - tar.extract('com.vmware.fusion.tools.darwinPre15.zip', path=convertpath(dest + '/tools/')) - tar.close() - - # Extract the iso and sig files from zip - cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip'), 'r') - cdszip.extract('payload/darwinPre15.iso', path=convertpath(dest + '/tools/')) - cdszip.extract('payload/darwinPre15.iso.sig', path=convertpath(dest + '/tools/')) - cdszip.close() - - # Move the iso and sig files to tools folder - shutil.move(convertpath(dest + '/tools/payload/darwinPre15.iso'), - convertpath(dest + '/tools/darwinPre15.iso')) - shutil.move(convertpath(dest + '/tools/payload/darwinPre15.iso.sig'), - convertpath(dest + '/tools/darwinPre15.iso.sig')) - - # Cleanup working files and folders - shutil.rmtree(convertpath(dest + '/tools/payload'), True) - os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar')) - os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip')) - - + # Check minimal Python version is 2.7 + if sys.version_info < (3, 0): + sys.stderr.write('You need Python 3 or later\n') + sys.exit(1) + + dest = os.path.dirname(os.path.abspath(__file__)) + + # Re-create the tools folder + shutil.rmtree(dest + '/tools', True) + os.mkdir(dest + '/tools') + + parser = CDSParser() + + # Last published version doesn't ship with darwin tools + # so in case of error get it from the core.vmware.fusion.tar + print('Trying to get tools from the packages folder...') + + # Setup url and file paths + url = 'http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/' + + # Get the list of Fusion releases + # And get the last item in the ul/li tags + + response = urlopen(url) + html = response.read() + parser.clean() + parser.feed(str(html)) + url = url + parser.HTMLDATA[-1] + '/' + parser.clean() + + # Open the latest release page + # And build file URL + response = urlopen(url) + html = response.read() + parser.feed(str(html)) + + lastVersion = parser.HTMLDATA[-1] + + parser.clean() + + urlcoretar = url + lastVersion + '/universal/core/com.vmware.fusion.zip.tar' + + # Get the main core file + try: + urlretrieve(urlcoretar, convertpath(dest + '/tools/com.vmware.fusion.zip.tar'), reporthook) + except: + print('Couldn\'t find tools') + return + + print('Extracting com.vmware.fusion.zip.tar...') + tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.zip.tar'), 'r') + tar.extract('com.vmware.fusion.zip', path=convertpath(dest + '/tools/')) + tar.close() + + print('Extracting files from com.vmware.fusion.zip...') + cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.zip'), 'r') + cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/' + ARCH + '/darwin.iso', path=convertpath(dest + '/tools/')) + cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/' + ARCH + '/darwinPre15.iso', path=convertpath(dest + '/tools/')) + cdszip.close() + + # Move the iso and sig files to tools folder + shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/' + ARCH + '/darwin.iso'), convertpath(dest + '/tools/darwin.iso')) + shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/' + ARCH + '/darwinPre15.iso'), convertpath(dest + '/tools/darwinPre15.iso')) + + # Cleanup working files and folders + shutil.rmtree(convertpath(dest + '/tools/payload'), True) + os.remove(convertpath(dest + '/tools/com.vmware.fusion.zip.tar')) + os.remove(convertpath(dest + '/tools/com.vmware.fusion.zip')) + + print('Tools retrieved successfully') + return + + if __name__ == '__main__': main() diff --git a/lnx-install.sh b/lnx-install.sh index 8dbebe9..d9218b4 100755 --- a/lnx-install.sh +++ b/lnx-install.sh @@ -27,10 +27,10 @@ elif [ -d /usr/lib/vmware/lib/libvmwarebase.so/ ]; then fi echo Patching... -python2 ./unlocker.py +python3 ./unlocker.py echo Getting VMware Tools... -python gettools.py +python3 ./gettools.py cp ./tools/darwin*.* /usr/lib/vmware/isoimages/ echo Finished! diff --git a/lnx-update-tools.sh b/lnx-update-tools.sh index 27b3f0d..147e63a 100755 --- a/lnx-update-tools.sh +++ b/lnx-update-tools.sh @@ -15,7 +15,7 @@ if [[ $EUID -ne 0 ]]; then fi echo Getting VMware Tools... -python gettools.py +python3 ./gettools.py cp ./tools/darwin*.* /usr/lib/vmware/isoimages/ echo Finished! diff --git a/readme.txt b/readme.txt index c9f8cda..3bcc4a7 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,16 @@ macOS Unlocker V3.0 for VMware Workstation ========================================== +************************************************************** +************************* READ HERE: ************************* + +WINDOWS USERS: Get the tool from the Releases section, you will get a bundled python distribution that avoids the virus warnings and python not found etc. + +LINUX USERS: No bundled python for you, but make sure you have python 3.0+ installed. If you have errors like "Python not supported" but you have python installed, change the lines inside of lnx-install.sh from 'python xxxxxxx.py' to 'python3.7 xxxxxxx.py' (if you have python 3.7 installed, otherwise try python3 or other stuff) + +************************************************************** +************************************************************** + +-----------------------------------------------------------------------------+ | IMPORTANT: | | ========== | @@ -105,4 +115,4 @@ History - Allow Python 2 and 3 to run the Python code from Bash scripts -(c) 2011-2018 Dave Parsons \ No newline at end of file +(c) 2011-2018 Dave Parsons diff --git a/unlocker.exe b/unlocker.exe deleted file mode 100755 index 80e4409..0000000 Binary files a/unlocker.exe and /dev/null differ diff --git a/unlocker.py b/unlocker.py index decbc51..b786fa3 100755 --- a/unlocker.py +++ b/unlocker.py @@ -44,6 +44,7 @@ from __future__ import print_function import codecs import os +import re import struct import sys @@ -55,7 +56,11 @@ if sys.platform == 'win32' \ or sys.platform == 'cli': # noinspection PyUnresolvedReferences - from _winreg import * + if sys.version_info > (3, 0): + from winreg import * + else: + from _winreg import * + def bytetohex(data): @@ -301,9 +306,10 @@ def patchbase(name): f = open(name, 'r+b') # Entry to search for in GOS table - # Should work for 12 & 14 of Workstation... - darwin = b'\x10\x00\x00\x00\x10\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00' \ - '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + # Should work for Workstation 12-15... + darwin = re.compile( + b'\x10\x00\x00\x00[\x10|\x20]\x00\x00\x00[\x01|\x02]\x00\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') # Read file into string variable base = f.read() @@ -311,19 +317,15 @@ def patchbase(name): # Loop through each entry and set top bit # 0xBE --> 0xBF (WKS 12) # 0x3E --> 0x3F (WKS 14) - offset = 0 - while offset < len(base): - offset = base.find(darwin, offset) - if offset == -1: - break + for m in darwin.finditer(base): + offset = m.start() f.seek(offset + 32) flag = ord(f.read(1)) flag = set_bit(flag, 0) - flag = chr(flag) +# flag = chr(flag) f.seek(offset + 32) - f.write(flag) + f.write(bytes([flag])) print('GOS Patched flag @: ' + hex(offset)) - offset += 40 # Tidy up f.flush() diff --git a/win-install.cmd b/win-install.cmd index e853239..74f63d5 100644 --- a/win-install.cmd +++ b/win-install.cmd @@ -44,11 +44,11 @@ xcopy /F /Y "%InstallPath%vmwarebase.dll" .\backup\ echo. echo Patching... -unlocker.exe +python unlocker.py echo. echo Getting VMware Tools... -gettools.exe +python gettools.py xcopy /F /Y .\tools\darwin*.* "%InstallPath%" echo. diff --git a/win-update-tools.cmd b/win-update-tools.cmd index 3cb1e95..6b3c982 100644 --- a/win-update-tools.cmd +++ b/win-update-tools.cmd @@ -18,7 +18,7 @@ for /F "tokens=2* delims= " %%A in ('REG QUERY %KeyName% /v InstallPath') do se echo VMware is installed at: %InstallPath% echo Getting VMware Tools... -gettools.exe +python gettools.py xcopy /F /Y .\tools\darwin*.* "%InstallPath%" popd