Updates for 2.0.9 RC3
This commit is contained in:
parent
409f9a9ed9
commit
fcc21ab454
|
@ -138,7 +138,7 @@ def dumpsmc(name):
|
|||
print('appleSMCTableV0 Table : ' + hex(smc_key1))
|
||||
dumpkeys(f, smc_key1)
|
||||
|
||||
print('xxxx')
|
||||
print()
|
||||
|
||||
# Print vSMC1 tables and keys
|
||||
print('appleSMCTableV1 (smc.version = "1")')
|
||||
|
|
|
@ -6,6 +6,7 @@ set -e
|
|||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
|
||||
# Copy patch to local.sh
|
||||
rm -fv local.sh
|
||||
cp local-prefix.sh local.sh
|
||||
cat unlocker.py >> local.sh
|
||||
cat local-suffix.sh >> local.sh
|
||||
|
|
|
@ -21,9 +21,11 @@ def testline(line, test):
|
|||
|
||||
def main():
|
||||
vmsvc = '<vmsvc>\n'
|
||||
sandbox = '<useVmxSandbox>false</useVmxSandbox>\n'
|
||||
starttag = '<useVmxSandbox>'
|
||||
endtag = '</useVmxSandbox>'
|
||||
|
||||
with open('/etc/vmware/hostd/config.xml', 'r+') as f:
|
||||
# with open('/etc/vmware/hostd/config.xml', 'r+') as f:
|
||||
with open('samples/config.xml', 'r+') as f:
|
||||
data = f.readlines()
|
||||
|
||||
# Search for the relevant XML tags
|
||||
|
@ -35,29 +37,51 @@ def main():
|
|||
if testline(line, vmsvc):
|
||||
vmsvcindex = i
|
||||
|
||||
if testline(line, sandbox):
|
||||
if testline(line, starttag):
|
||||
sandboxindex = i
|
||||
|
||||
# print(line, end='')
|
||||
i += 1
|
||||
|
||||
# Simple toggle on or off depending if found
|
||||
if sandboxindex != 0 and sys.argv[1] == 'delete':
|
||||
print('Removing useVmxSandbox')
|
||||
del data[sandboxindex]
|
||||
elif sandboxindex == 0 and sys.argv[1] == 'insert':
|
||||
print('Adding useVmxSandbox')
|
||||
pad = len(data[vmsvcindex + 1]) - len(data[vmsvcindex + 1].lstrip())
|
||||
data.insert(vmsvcindex + 1, (" " * pad) + sandbox)
|
||||
else:
|
||||
# If vmsvc tag not found then file is probably corrupt
|
||||
if vmsvcindex is None:
|
||||
print('ESXi Config - config.xml is corrupt')
|
||||
return False
|
||||
|
||||
# Remove the existing line if prsent
|
||||
del data[sandboxindex]
|
||||
|
||||
# Now add line with correct flag
|
||||
pad = len(data[vmsvcindex + 1]) - len(data[vmsvcindex + 1].lstrip())
|
||||
|
||||
if sys.argv[1] in ['on', 'off']:
|
||||
pass
|
||||
|
||||
if sys.argv[1] == 'off':
|
||||
print('ESXi Config - useVmxSandbox off')
|
||||
data.insert(vmsvcindex + 1, (" " * pad) + sandboxoff)
|
||||
|
||||
elif sys.argv[1] == 'on':
|
||||
print('ESXi Config - useVmxSandbox on')
|
||||
data.insert(vmsvcindex + 1, (" " * pad) + sandboxon)
|
||||
|
||||
else:
|
||||
print('ESXi Config - Incorrect paramter passed')
|
||||
return False
|
||||
|
||||
# Rewrite the config.xml file
|
||||
f.seek(0)
|
||||
f.write(''.join(data))
|
||||
f.truncate()
|
||||
f.close()
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
sys.exit(1)
|
||||
if main():
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
|
|
@ -11,7 +11,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|||
|
||||
# Exit if boot option specified
|
||||
if bootOption -o | grep -q 'nounlocker'; then
|
||||
logger -t unlocker Disbaled via nounlocker boot option
|
||||
logger -t unlocker disabled via nounlocker boot option
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
11
local.sh
11
local.sh
|
@ -11,7 +11,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|||
|
||||
# Exit if boot option specified
|
||||
if bootOption -o | grep -q 'nounlocker'; then
|
||||
logger -t unlocker Disbaled via nounlocker boot option
|
||||
logger -t unlocker disabled via nounlocker boot option
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -107,6 +107,7 @@ Offset Length Struct Type Description
|
|||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import codecs
|
||||
import os
|
||||
import sys
|
||||
import struct
|
||||
|
@ -125,8 +126,8 @@ if sys.platform == 'win32' \
|
|||
def rot13(s):
|
||||
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
|
||||
trans = chars[26:] + chars[:26]
|
||||
rot_char = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
||||
return ''.join(rot_char(c) for c in s)
|
||||
rotchar = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
||||
return ''.join(rotchar(c) for c in s)
|
||||
|
||||
|
||||
def bytetohex(data):
|
||||
|
@ -237,7 +238,7 @@ def patchkeys(f, key):
|
|||
|
||||
# Write new data for key
|
||||
f.seek(offset + 24)
|
||||
smc_new_data = rot13('bheuneqjbexolgurfrjbeqfthneqrqcy')
|
||||
smc_new_data = codecs.encode('bheuneqjbexolgurfrjbeqfthneqrqcy', 'rot_13')
|
||||
f.write(smc_new_data.encode('UTF-8'))
|
||||
f.flush()
|
||||
|
||||
|
@ -259,7 +260,7 @@ def patchkeys(f, key):
|
|||
|
||||
# Write new data for key
|
||||
f.seek(offset + 24)
|
||||
smc_new_data = rot13('rnfrqbagfgrny(p)NccyrPbzchgreVap')
|
||||
smc_new_data = codecs.encode('rnfrqbagfgrny(p)NccyrPbzchgreVap', 'rot_13')
|
||||
f.write(smc_new_data.encode('UTF-8'))
|
||||
f.flush()
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ Offset Length Struct Type Description
|
|||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import codecs
|
||||
import os
|
||||
import sys
|
||||
import struct
|
||||
|
@ -60,8 +61,8 @@ if sys.platform == 'win32' \
|
|||
def rot13(s):
|
||||
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
|
||||
trans = chars[26:] + chars[:26]
|
||||
rot_char = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
||||
return ''.join(rot_char(c) for c in s)
|
||||
rotchar = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
||||
return ''.join(rotchar(c) for c in s)
|
||||
|
||||
|
||||
def bytetohex(data):
|
||||
|
@ -172,7 +173,7 @@ def patchkeys(f, key):
|
|||
|
||||
# Write new data for key
|
||||
f.seek(offset + 24)
|
||||
smc_new_data = rot13('bheuneqjbexolgurfrjbeqfthneqrqcy')
|
||||
smc_new_data = codecs.encode('bheuneqjbexolgurfrjbeqfthneqrqcy', 'rot_13')
|
||||
f.write(smc_new_data.encode('UTF-8'))
|
||||
f.flush()
|
||||
|
||||
|
@ -194,7 +195,7 @@ def patchkeys(f, key):
|
|||
|
||||
# Write new data for key
|
||||
f.seek(offset + 24)
|
||||
smc_new_data = rot13('rnfrqbagfgrny(p)NccyrPbzchgreVap')
|
||||
smc_new_data = codecs.encode('rnfrqbagfgrny(p)NccyrPbzchgreVap', 'rot_13')
|
||||
f.write(smc_new_data.encode('UTF-8'))
|
||||
f.flush()
|
||||
|
||||
|
|
Loading…
Reference in New Issue