Work on a dynamic darwin.iso fetcher

This commit is contained in:
I049299 2015-10-10 06:36:51 +01:00
parent 153f0a50d1
commit 258b81c531
14 changed files with 114 additions and 44 deletions

View File

@ -47,6 +47,7 @@ if sys.version_info < (2, 7):
sys.stderr.write('You need Python 2.7 or later\n') sys.stderr.write('You need Python 2.7 or later\n')
sys.exit(1) sys.exit(1)
def bytetohex(bytestr): def bytetohex(bytestr):
return ''.join(['%02X ' % ord(x) for x in bytestr]).strip() return ''.join(['%02X ' % ord(x) for x in bytestr]).strip()

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
echo VMware Unlocker 2.0.7 echo VMware Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
echo VMware Unlocker 2.0.7 echo VMware Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

54
gettools.py Normal file
View File

@ -0,0 +1,54 @@
import os
import urllib
import urllib2
from HTMLParser import HTMLParser
import shutil
import tarfile
import zipfile
# Parse the Fusion directory page
class myHTMLParser(HTMLParser):
def __init__(self):
self.reset()
self.HTMLDATA = []
def handle_data(self, data):
if data.find("\n") == -1 :
if data[0].isdigit():
self.HTMLDATA.append(data)
def clean(self):
self.HTMLDATA = []
def main():
url = 'http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/'
dir = os.path.dirname(os.path.abspath(__file__))
response = urllib2.urlopen(url)
html = response.read()
parser = myHTMLParser()
parser.feed(html)
url = url + parser.HTMLDATA[-1] + '/'
response = urllib2.urlopen(url)
html = response.read()
parser.clean()
parser.feed(html)
url = url + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwin.zip.tar'
urllib.urlretrieve(url, 'tools/com.vmware.fusion.tools.darwin.zip.tar')
parser.clean()
tar = tarfile.open('tools/com.vmware.fusion.tools.darwin.zip.tar', 'r')
tar.extract('com.vmware.fusion.tools.darwin.zip', path='tools/')
zip = zipfile.ZipFile('tools/com.vmware.fusion.tools.darwin.zip', 'r')
zip.extract('payload/darwin.iso', path='tools/')
zip.extract('payload/darwin.iso.sig', path='tools/')
shutil.move(dir + '/tools/payload/darwin.iso', dir + '/tools/darwin.iso')
shutil.move(dir + '/tools/payload/darwin.iso.sig', dir + '/tools/darwin.iso.sig')
shutil.rmtree(dir + '/tools/payload', True)
os.remove(dir + '/tools/com.vmware.fusion.tools.darwin.zip.tar')
os.remove(dir + '/tools/com.vmware.fusion.tools.darwin.zip')
if __name__ == '__main__':
main()

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
echo VMware Unlocker 2.0.7 echo VMware Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
echo VMware Unlocker 2.0.7 echo VMware Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

View File

@ -2,7 +2,7 @@
set -e set -e
set -x set -x
echo VMware ESXi 6.x Unlocker 2.0.7 echo VMware ESXi 6.x Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
echo VMware Unlocker 2.0.7 echo VMware Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
echo VMware Unlocker 2.0.7 echo VMware Unlocker 2.0.8
echo =============================== echo ===============================
echo Copyright: Dave Parsons 2011-15 echo Copyright: Dave Parsons 2011-15

View File

@ -9,8 +9,8 @@ If you are using an earlier product please continue using Unlocker 1
Version 2 has been tested against: Version 2 has been tested against:
[LIST] [LIST]
[*]Workstation 11/12 on Windows and Linux[/*] [*]Workstation 11/12 Pro on Windows and Linux[/*]
[*]Player 7 & Workstation Player 12 on Windows and Linux[/*] [*]Player 7 & Workstation Player 12 on Windows and Linux[/*]
[*]Fusion 7/8 on Mavericks and Yosemite[/*] [*]Fusion 7/8 on Mavericks and Yosemite[/*]
[*]ESXi 6.0[/*] [*]ESXi 6.0[/*]
[/LIST] [/LIST]
@ -22,7 +22,6 @@ being patched:
[*]Fix libvmkctl.so on ESXi 6 to allow use with vCenter[/*] [*]Fix libvmkctl.so on ESXi 6 to allow use with vCenter[/*]
[*]A copy of the latest VMware Tools for OS X is included[/*] [*]A copy of the latest VMware Tools for OS X is included[/*]
[/LIST] [/LIST]
Note that not all products recognise the darwin.iso via install tools menu item. Note that not all products recognise the darwin.iso via install tools menu item.
You will have to manually mount the darwin.iso for example on Workstation and Player. You will have to manually mount the darwin.iso for example on Workstation and Player.
@ -50,16 +49,16 @@ If you are using VMware Player or Workstation on Windows you may get a core dump
Latest Linux and ESXi products are OK and do not show this problem. Latest Linux and ESXi products are OK and do not show this problem.
[color=#ff0000][u][b] IMPORTANT:[/b][/u] [color=#ff0000][u][b] IMPORTANT:[/b][/u]
 If you create a new VM using version 11 hardware VMware will stop and   If you create a new VM using version 11 hardware VMware will stop and 
 create a core dump.There are two options to work around this issue:  create a core dump.There are two options to work around this issue:
 1. Change the VM to be HW 10 - this does not affect performance.  1. Change the VM to be HW 10 - this does not affect performance.
 2. Edit the VMX file and add: [/color]  2. Edit the VMX file and add: [/color]
   
[code=auto:0] smc.version = "0" |[/code] [code=auto:0] smc.version = "0" |[/code]
   
To remove the check for server versions for OS X Leopard and Snow Leopard To remove the check for server versions for OS X Leopard and Snow Leopard
(10.5 and 10.6) you must use a replacement EFI firwmare module from the firmware (10.5 and 10.6) you must use a replacement EFI firwmare module from the firmware
@ -69,16 +68,16 @@ If you are using a 32-bit installation of OS X:
1. Copy efi32-srvr.rom to guest folder. 1. Copy efi32-srvr.rom to guest folder.
2. Edit the vmx file and add: 2. Edit the vmx file and add:
   
[code=auto:0]efi32.filename = "efi32-srvr.rom"[/code] [code=auto:0]efi32.filename = "efi32-srvr.rom"[/code]
   
If you are using a 64-bit installation of OS X: If you are using a 64-bit installation of OS X:
1. Copy efi64-srvr.rom to guest folder. 1. Copy efi64-srvr.rom to guest folder.
2. Edit the vmx file and add: 2. Edit the vmx file and add:
   
[code=auto:0]efi64.filename = "efi64-srvr.rom"[/code] [code=auto:0]efi64.filename = "efi64-srvr.rom"[/code]
   
[u]4. Windows[/u] [u]4. Windows[/u]
On Windows you will need to either run cmd.exe as Administrator or using On Windows you will need to either run cmd.exe as Administrator or using
@ -178,4 +177,9 @@ debugging expertise. Sam also wrote the code for patching ESXi ELF files.
[LIST] [LIST]
[*]Workstation 12 on Linux fixes[/*] [*]Workstation 12 on Linux fixes[/*]
[/LIST] [/LIST]
[/LIST]
16/09/15 2.0.8
[LIST]
[*]Player 12 on Linux fixes[/*]
[/LIST]
(c) 2011-2015 Dave Parsons (c) 2011-2015 Dave Parsons

View File

@ -157,6 +157,6 @@ History
- Latest tools from Fusion 7.1.2 - Latest tools from Fusion 7.1.2
20/06/15 2.0.6 - ESXi 6 patch for smcPresent vCenter compatibility 20/06/15 2.0.6 - ESXi 6 patch for smcPresent vCenter compatibility
16/09/15 2.0.7 - Workstation 12 on Linux fixes 16/09/15 2.0.7 - Workstation 12 on Linux fixes
19/09/15 2.0.8 - Player 12 on Linux fixes
(c) 2011-2015 Dave Parsons (c) 2011-2015 Dave Parsons

0
tools/darwin.iso Executable file → Normal file
View File

0
tools/darwin.iso.sig Executable file → Normal file
View File

View File

@ -50,10 +50,10 @@ if sys.version_info < (2, 7):
sys.exit(1) sys.exit(1)
# Setup imports depending on whether IronPython or CPython # Setup imports depending on whether IronPython or CPython
if sys.platform == 'win32' \ try:
or sys.platform == 'cli': import _winreg
from _winreg import * except ImportError:
pass
def rot13(s): def rot13(s):
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz' chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
@ -67,17 +67,19 @@ def bytetohex(bytestr):
def printkey(i, offset, smc_key, smc_data): def printkey(i, offset, smc_key, smc_data):
print str(i+1).zfill(3) \ print str(i + 1).zfill(3) \
+ ' ' + hex(offset) \ + ' ' + hex(offset) \
+ ' ' + smc_key[0][::-1] \ + ' ' + smc_key[0][::-1] \
+ ' ' + str(smc_key[1]).zfill(2) \ + ' ' + str(smc_key[1]).zfill(2) \
+ ' ' + smc_key[2][::-1].replace('\x00', ' ') \ + ' ' + smc_key[2][::-1].replace('\x00', ' ') \
+ ' ' + '{0:#0{1}x}'.format(smc_key[3], 4) \ + ' ' + '{0:#0{1}x}'.format(smc_key[3], 4) \
+ ' ' + hex(smc_key[4]) \ + ' ' + hex(smc_key[4]) \
+ ' ' + bytetohex(smc_data) + ' ' + bytetohex(smc_data)
E_CLASS64 = 2
E_SHT_RELA = 4
E_CLASS64 = 2;
E_SHT_RELA = 4;
def patchELF(f, oldOffset, newOffset): def patchELF(f, oldOffset, newOffset):
f.seek(0) f.seek(0)
@ -87,7 +89,7 @@ def patchELF(f, oldOffset, newOffset):
ei_class = struct.unpack('=B', f.read(1))[0] ei_class = struct.unpack('=B', f.read(1))[0]
if ei_class != E_CLASS64: if ei_class != E_CLASS64:
raise Exception('Not 64bit elf header: ' + ei_class) raise Exception('Not 64bit elf header: ' + ei_class)
f.seek(40) f.seek(40)
e_shoff = struct.unpack('=Q', f.read(8))[0] e_shoff = struct.unpack('=Q', f.read(8))[0]
@ -96,7 +98,7 @@ def patchELF(f, oldOffset, newOffset):
e_shnum = struct.unpack('=H', f.read(2))[0] e_shnum = struct.unpack('=H', f.read(2))[0]
e_shstrndx = struct.unpack('=H', f.read(2))[0] e_shstrndx = struct.unpack('=H', f.read(2))[0]
#print 'e_shoff: 0x{:x} e_shentsize: 0x{:x} e_shnum:0x{:x} e_shstrndx:0x{:x}'.format(e_shoff, e_shentsize, e_shnum, e_shstrndx) # print 'e_shoff: 0x{:x} e_shentsize: 0x{:x} e_shnum:0x{:x} e_shstrndx:0x{:x}'.format(e_shoff, e_shentsize, e_shnum, e_shstrndx)
for i in range(0, e_shnum): for i in range(0, e_shnum):
f.seek(e_shoff + i * e_shentsize) f.seek(e_shoff + i * e_shentsize)
@ -108,7 +110,7 @@ def patchELF(f, oldOffset, newOffset):
e_sh_entsize = e_sh[9] e_sh_entsize = e_sh[9]
if e_sh_type == E_SHT_RELA: if e_sh_type == E_SHT_RELA:
e_sh_nument = e_sh_size / e_sh_entsize e_sh_nument = e_sh_size / e_sh_entsize
#print 'RELA at 0x{:x} with {:d} entries'.format(e_sh_offset, e_sh_nument) # print 'RELA at 0x{:x} with {:d} entries'.format(e_sh_offset, e_sh_nument)
for j in range(0, e_sh_nument): for j in range(0, e_sh_nument):
f.seek(e_sh_offset + e_sh_entsize * j) f.seek(e_sh_offset + e_sh_entsize * j)
rela = struct.unpack('=QQq', f.read(e_sh_entsize)) rela = struct.unpack('=QQq', f.read(e_sh_entsize))
@ -116,7 +118,7 @@ def patchELF(f, oldOffset, newOffset):
r_info = rela[1] r_info = rela[1]
r_addend = rela[2] r_addend = rela[2]
if r_addend == oldOffset: if r_addend == oldOffset:
r_addend = newOffset; r_addend = newOffset
f.seek(e_sh_offset + e_sh_entsize * j) f.seek(e_sh_offset + e_sh_entsize * j)
f.write(struct.pack('=QQq', r_offset, r_info, r_addend)) f.write(struct.pack('=QQq', r_offset, r_info, r_addend))
print 'Relocation modified at: ' + hex(e_sh_offset + e_sh_entsize * j) print 'Relocation modified at: ' + hex(e_sh_offset + e_sh_entsize * j)
@ -125,6 +127,8 @@ def patchELF(f, oldOffset, newOffset):
def patchkeys(f, vmx, key, osname): def patchkeys(f, vmx, key, osname):
# Setup struct pack string # Setup struct pack string
key_pack = '=4sB4sB6xQ' key_pack = '=4sB4sB6xQ'
smc_old_memptr = 0
smc_new_memptr = 0
# Do Until OSK1 read # Do Until OSK1 read
i = 0 i = 0
@ -198,9 +202,13 @@ def patchkeys(f, vmx, key, osname):
i += 1 i += 1
return smc_old_memptr, smc_new_memptr return smc_old_memptr, smc_new_memptr
def patchsmc(name, osname, sharedobj): def patchsmc(name, osname, sharedobj):
with open(name, 'r+b') as f: with open(name, 'r+b') as f:
smc_old_memptr = 0
smc_new_memptr = 0
# Read file into string variable # Read file into string variable
vmx = f.read() vmx = f.read()
@ -326,8 +334,8 @@ def patchvmkctl(name):
f.close() f.close()
print 'smcPresent Patched: ' + name print 'smcPresent Patched: ' + name
def main():
def main():
# Work around absent Platform module on VMkernel # Work around absent Platform module on VMkernel
if os.name == 'nt' or os.name == 'cli': if os.name == 'nt' or os.name == 'cli':
osname = 'windows' osname = 'windows'
@ -343,18 +351,20 @@ def main():
vmx_debug = vmx_path + 'vmware-vmx-debug' vmx_debug = vmx_path + 'vmware-vmx-debug'
vmx_stats = vmx_path + 'vmware-vmx-stats' vmx_stats = vmx_path + 'vmware-vmx-stats'
vmwarebase = '' vmwarebase = ''
libvmkctl = ''
elif osname == 'linux': elif osname == 'linux':
vmx_path = '/usr/lib/vmware/bin/' vmx_path = '/usr/lib/vmware/bin/'
vmx = vmx_path + 'vmware-vmx' vmx = vmx_path + 'vmware-vmx'
vmx_debug = vmx_path + 'vmware-vmx-debug' vmx_debug = vmx_path + 'vmware-vmx-debug'
vmx_stats = vmx_path + 'vmware-vmx-stats' vmx_stats = vmx_path + 'vmware-vmx-stats'
vmx_version = subprocess.check_output(["vmware", "-v"]) vmx_version = subprocess.check_output(["vmplayer", "-v"])
if vmx_version.startswith('VMware Workstation 12'): if vmx_version.startswith('VMware Player 12'):
vmx_so = True vmx_so = True
vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so' vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so'
else: else:
vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so.0/libvmwarebase.so.0' vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so.0/libvmwarebase.so.0'
libvmkctl = ''
elif osname == 'vmkernel': elif osname == 'vmkernel':
vmx_path = '/unlocker/' vmx_path = '/unlocker/'
@ -374,6 +384,7 @@ def main():
vmx_debug = vmx_path + 'vmware-vmx-debug.exe' vmx_debug = vmx_path + 'vmware-vmx-debug.exe'
vmx_stats = vmx_path + 'vmware-vmx-stats.exe' vmx_stats = vmx_path + 'vmware-vmx-stats.exe'
vmwarebase = vmwarebase_path + 'vmwarebase.dll' vmwarebase = vmwarebase_path + 'vmwarebase.dll'
libvmkctl = ''
else: else:
print('Unknown Operating System: ' + osname) print('Unknown Operating System: ' + osname)