mirror of
https://github.com/paolo-projects/unlocker.git
synced 2025-07-26 23:44:28 +02:00
Applied @mkitchingh patch to unlocker.py and updated gettools.py to look into core com.vmware.fusion.zip if tools are not found. Rebuilt unlocker.exe and gettools.exe
This commit is contained in:
parent
b9c0059fcb
commit
d4802acdd7
62
gettools.py
62
gettools.py
@ -71,7 +71,6 @@ def convertpath(path):
|
|||||||
# OS path separator replacement funciton
|
# OS path separator replacement funciton
|
||||||
return path.replace(os.path.sep, '/')
|
return path.replace(os.path.sep, '/')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Check minimal Python version is 2.7
|
# Check minimal Python version is 2.7
|
||||||
if sys.version_info < (2, 7):
|
if sys.version_info < (2, 7):
|
||||||
@ -85,13 +84,10 @@ def main():
|
|||||||
os.mkdir(dest + '/tools')
|
os.mkdir(dest + '/tools')
|
||||||
|
|
||||||
parser = CDSParser()
|
parser = CDSParser()
|
||||||
success = False
|
|
||||||
n = 1
|
|
||||||
|
|
||||||
# Last published version doesn't ship with darwin tools
|
# Last published version doesn't ship with darwin tools
|
||||||
# so in case of error fall back to the latest version that has them
|
# so in case of error get it from the core.vmware.fusion.tar
|
||||||
while (success == False):
|
print('Trying to get tools from the packages folder...')
|
||||||
print('Trying for the '+str(n)+'th time')
|
|
||||||
|
|
||||||
# Setup url and file paths
|
# Setup url and file paths
|
||||||
url = 'http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/'
|
url = 'http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/'
|
||||||
@ -103,7 +99,7 @@ def main():
|
|||||||
html = response.read()
|
html = response.read()
|
||||||
parser.clean()
|
parser.clean()
|
||||||
parser.feed(str(html))
|
parser.feed(str(html))
|
||||||
url = url + parser.HTMLDATA[-n] + '/'
|
url = url + parser.HTMLDATA[-1] + '/'
|
||||||
parser.clean()
|
parser.clean()
|
||||||
|
|
||||||
# Open the latest release page
|
# Open the latest release page
|
||||||
@ -112,19 +108,55 @@ def main():
|
|||||||
html = response.read()
|
html = response.read()
|
||||||
parser.feed(str(html))
|
parser.feed(str(html))
|
||||||
|
|
||||||
urlpost15 = url + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwin.zip.tar'
|
lastVersion = parser.HTMLDATA[-1]
|
||||||
urlpre15 = url + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwinPre15.zip.tar'
|
|
||||||
|
urlpost15 = url + lastVersion + '/packages/com.vmware.fusion.tools.darwin.zip.tar'
|
||||||
|
urlpre15 = url + lastVersion + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwinPre15.zip.tar'
|
||||||
parser.clean()
|
parser.clean()
|
||||||
|
|
||||||
# Download the darwin.iso tgz file
|
# Download the darwin.iso tgz file
|
||||||
print('Retrieving Darwin tools from: ' + urlpost15)
|
print('Retrieving Darwin tools from: ' + urlpost15)
|
||||||
try:
|
try:
|
||||||
|
# Try to get tools from packages folder
|
||||||
urlretrieve(urlpost15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'))
|
urlretrieve(urlpost15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print('Link didn\'t work, trying another one...')
|
# No tools found, get em from the core tar
|
||||||
n += 1
|
print('Tools aren\'t here... Be patient while I download and' +
|
||||||
continue
|
' give a look into the core.vmware.fusion.tar file')
|
||||||
|
urlcoretar = url + lastVersion + '/core/com.vmware.fusion.zip.tar'
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Get the main core file
|
||||||
|
urlretrieve(urlcoretar, convertpath(dest + '/tools/com.vmware.fusion.zip.tar'))
|
||||||
|
|
||||||
|
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/darwin.iso', path=convertpath(dest + '/tools/'))
|
||||||
|
cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/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/darwin.iso'), convertpath(dest + '/tools/darwin.iso'))
|
||||||
|
shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/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
|
||||||
|
except:
|
||||||
|
print('Odds are against you. Sorry.')
|
||||||
|
return
|
||||||
|
|
||||||
|
# Tools have been found, go with the normal way
|
||||||
|
|
||||||
# Extract the tar to zip
|
# Extract the tar to zip
|
||||||
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'), 'r')
|
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'), 'r')
|
||||||
@ -148,12 +180,7 @@ def main():
|
|||||||
|
|
||||||
# Download the darwinPre15.iso tgz file
|
# Download the darwinPre15.iso tgz file
|
||||||
print('Retrieving DarwinPre15 tools from: ' + urlpre15)
|
print('Retrieving DarwinPre15 tools from: ' + urlpre15)
|
||||||
try:
|
|
||||||
urlretrieve(urlpre15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'))
|
urlretrieve(urlpre15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'))
|
||||||
except:
|
|
||||||
print('Link didn\'t work, trying another one...')
|
|
||||||
n += 1
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Extract the tar to zip
|
# Extract the tar to zip
|
||||||
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'), 'r')
|
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'), 'r')
|
||||||
@ -176,7 +203,6 @@ def main():
|
|||||||
shutil.rmtree(convertpath(dest + '/tools/payload'), True)
|
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.tar'))
|
||||||
os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip'))
|
os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip'))
|
||||||
success = True
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
24
unlocker.py
24
unlocker.py
@ -44,6 +44,7 @@ Offset Length Struct Type Description
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -55,9 +56,13 @@ if sys.version_info < (2, 7):
|
|||||||
if sys.platform == 'win32' \
|
if sys.platform == 'win32' \
|
||||||
or sys.platform == 'cli':
|
or sys.platform == 'cli':
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
|
if sys.version_info > (3, 0):
|
||||||
|
from winreg import *
|
||||||
|
else:
|
||||||
from _winreg import *
|
from _winreg import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def bytetohex(data):
|
def bytetohex(data):
|
||||||
if sys.version_info > (3, 0):
|
if sys.version_info > (3, 0):
|
||||||
# Python 3 code in this block
|
# Python 3 code in this block
|
||||||
@ -301,9 +306,10 @@ def patchbase(name):
|
|||||||
f = open(name, 'r+b')
|
f = open(name, 'r+b')
|
||||||
|
|
||||||
# Entry to search for in GOS table
|
# Entry to search for in GOS table
|
||||||
# Should work for 12 & 14 of Workstation...
|
# Should work for Workstation 12-15...
|
||||||
darwin = b'\x10\x00\x00\x00\x10\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00' \
|
darwin = re.compile(
|
||||||
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
|
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
|
# Read file into string variable
|
||||||
base = f.read()
|
base = f.read()
|
||||||
@ -311,19 +317,15 @@ def patchbase(name):
|
|||||||
# Loop through each entry and set top bit
|
# Loop through each entry and set top bit
|
||||||
# 0xBE --> 0xBF (WKS 12)
|
# 0xBE --> 0xBF (WKS 12)
|
||||||
# 0x3E --> 0x3F (WKS 14)
|
# 0x3E --> 0x3F (WKS 14)
|
||||||
offset = 0
|
for m in darwin.finditer(base):
|
||||||
while offset < len(base):
|
offset = m.start()
|
||||||
offset = base.find(darwin, offset)
|
|
||||||
if offset == -1:
|
|
||||||
break
|
|
||||||
f.seek(offset + 32)
|
f.seek(offset + 32)
|
||||||
flag = ord(f.read(1))
|
flag = ord(f.read(1))
|
||||||
flag = set_bit(flag, 0)
|
flag = set_bit(flag, 0)
|
||||||
flag = chr(flag)
|
# flag = chr(flag)
|
||||||
f.seek(offset + 32)
|
f.seek(offset + 32)
|
||||||
f.write(flag)
|
f.write(bytes([flag]))
|
||||||
print('GOS Patched flag @: ' + hex(offset))
|
print('GOS Patched flag @: ' + hex(offset))
|
||||||
offset += 40
|
|
||||||
|
|
||||||
# Tidy up
|
# Tidy up
|
||||||
f.flush()
|
f.flush()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user