Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

mac #5

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
69d8a51
Fix remote file not found error
paolo-projects Sep 22, 2019
b9c0059
Switched to script execution to allow the fix to be effective
paolo-projects Sep 22, 2019
4fa9e15
Merge pull request #1 from paolo-projects/patch-1
paolo-projects Sep 22, 2019
423da43
Applied @mkitchin patch to unlocker.py and updated gettools.py to loo…
paolo-projects Sep 27, 2019
3f9f162
Rebuilt win executables
paolo-projects Sep 27, 2019
2d99887
Updated gettools.py to display download progress
paolo-projects Sep 27, 2019
b79001b
Reverted to binary execution
paolo-projects Sep 27, 2019
6161d78
Added a missing return instruction in case of error
paolo-projects Sep 27, 2019
71028b0
Added check for python > 3.0
paolo-projects Sep 28, 2019
2ad2325
Fix darwinPre15 url.
shelaf Oct 1, 2019
79a0b3c
Merge pull request #2 from shelaf/patch
paolo-projects Oct 7, 2019
b836646
Update readme.txt
paolo-projects Oct 13, 2019
2aa4ec7
Use python3 to invoke python 3.x
tryfinally Jun 7, 2020
d4802ac
Applied @mkitchingh patch to unlocker.py and updated gettools.py to l…
paolo-projects Sep 27, 2019
567b29f
Rebuilt win executables
paolo-projects Sep 27, 2019
0995c85
Updated gettools.py to display download progress
paolo-projects Sep 27, 2019
68f5f9d
Reverted to binary execution
paolo-projects Sep 27, 2019
994e8bd
Added a missing return instruction in case of error
paolo-projects Sep 27, 2019
ee5e630
Added check for python > 3.0
paolo-projects Sep 28, 2019
c557ed9
Fix darwinPre15 url.
shelaf Oct 1, 2019
63916e2
Update readme.txt
paolo-projects Oct 13, 2019
3564dcf
Merge branch 'master' of https://github.com/paolo-projects/unlocker
Aug 13, 2020
69b308a
add arch
Nov 16, 2021
db74deb
python 3
Nov 16, 2021
6ff719b
add readme
Nov 16, 2021
8113822
fix windows install
Debdut Dec 4, 2021
3fa8d0b
Merge pull request #7 from Debdut/master
paolo-projects Dec 13, 2021
1901b12
Delete README.md
paolo-projects Dec 13, 2021
9e59428
Merge pull request #7 from Debdut
paolo-projects Dec 13, 2021
d6b60e4
Merge pull request #5 from tryfinally/dev-master
paolo-projects Feb 13, 2022
25fd6b4
fixed linux python script to call python3, removed binaries, changed …
paolo-projects Feb 13, 2022
0fbe518
Updated urls for latest VMware and VMware Tools
robertapengelly Feb 3, 2023
3fb15d6
Merge pull request #14 from robertapengelly/master
paolo-projects Apr 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed dumpsmc.exe
Binary file not shown.
Binary file removed gettools.exe
Binary file not shown.
173 changes: 90 additions & 83 deletions gettools.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import shutil
import tarfile
import zipfile
import time

ARCH = 'x86_x64'

try:
# For Python 3.0 and later
Expand Down Expand Up @@ -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()
4 changes: 2 additions & 2 deletions lnx-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion lnx-update-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -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: |
| ========== |
Expand Down Expand Up @@ -105,4 +115,4 @@ History
- Allow Python 2 and 3 to run the Python code from Bash scripts


(c) 2011-2018 Dave Parsons
(c) 2011-2018 Dave Parsons
Binary file removed unlocker.exe
Binary file not shown.
26 changes: 14 additions & 12 deletions unlocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from __future__ import print_function
import codecs
import os
import re
import struct
import sys

Expand All @@ -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):
Expand Down Expand Up @@ -301,29 +306,26 @@ 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()

# 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()
Expand Down
4 changes: 2 additions & 2 deletions win-install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion win-update-tools.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down