mirror of
https://github.com/paolo-projects/unlocker.git
synced 2025-07-25 23:14:48 +02:00
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))
|
print('appleSMCTableV0 Table : ' + hex(smc_key1))
|
||||||
dumpkeys(f, smc_key1)
|
dumpkeys(f, smc_key1)
|
||||||
|
|
||||||
print('xxxx')
|
print()
|
||||||
|
|
||||||
# Print vSMC1 tables and keys
|
# Print vSMC1 tables and keys
|
||||||
print('appleSMCTableV1 (smc.version = "1")')
|
print('appleSMCTableV1 (smc.version = "1")')
|
||||||
|
@ -6,6 +6,7 @@ set -e
|
|||||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||||
|
|
||||||
# Copy patch to local.sh
|
# Copy patch to local.sh
|
||||||
|
rm -fv local.sh
|
||||||
cp local-prefix.sh local.sh
|
cp local-prefix.sh local.sh
|
||||||
cat unlocker.py >> local.sh
|
cat unlocker.py >> local.sh
|
||||||
cat local-suffix.sh >> local.sh
|
cat local-suffix.sh >> local.sh
|
||||||
|
@ -21,9 +21,11 @@ def testline(line, test):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
vmsvc = '<vmsvc>\n'
|
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()
|
data = f.readlines()
|
||||||
|
|
||||||
# Search for the relevant XML tags
|
# Search for the relevant XML tags
|
||||||
@ -35,29 +37,51 @@ def main():
|
|||||||
if testline(line, vmsvc):
|
if testline(line, vmsvc):
|
||||||
vmsvcindex = i
|
vmsvcindex = i
|
||||||
|
|
||||||
if testline(line, sandbox):
|
if testline(line, starttag):
|
||||||
sandboxindex = i
|
sandboxindex = i
|
||||||
|
|
||||||
# print(line, end='')
|
# print(line, end='')
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
# Simple toggle on or off depending if found
|
# If vmsvc tag not found then file is probably corrupt
|
||||||
if sandboxindex != 0 and sys.argv[1] == 'delete':
|
if vmsvcindex is None:
|
||||||
print('Removing useVmxSandbox')
|
print('ESXi Config - config.xml is corrupt')
|
||||||
del data[sandboxindex]
|
return False
|
||||||
elif sandboxindex == 0 and sys.argv[1] == 'insert':
|
|
||||||
print('Adding useVmxSandbox')
|
# Remove the existing line if prsent
|
||||||
pad = len(data[vmsvcindex + 1]) - len(data[vmsvcindex + 1].lstrip())
|
del data[sandboxindex]
|
||||||
data.insert(vmsvcindex + 1, (" " * pad) + sandbox)
|
|
||||||
else:
|
# Now add line with correct flag
|
||||||
|
pad = len(data[vmsvcindex + 1]) - len(data[vmsvcindex + 1].lstrip())
|
||||||
|
|
||||||
|
if sys.argv[1] in ['on', 'off']:
|
||||||
pass
|
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
|
# Rewrite the config.xml file
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
f.write(''.join(data))
|
f.write(''.join(data))
|
||||||
f.truncate()
|
f.truncate()
|
||||||
f.close()
|
f.close()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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
|
# Exit if boot option specified
|
||||||
if bootOption -o | grep -q 'nounlocker'; then
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
11
local.sh
11
local.sh
@ -11,7 +11,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|||||||
|
|
||||||
# Exit if boot option specified
|
# Exit if boot option specified
|
||||||
if bootOption -o | grep -q 'nounlocker'; then
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ Offset Length Struct Type Description
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
import codecs
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
@ -125,8 +126,8 @@ if sys.platform == 'win32' \
|
|||||||
def rot13(s):
|
def rot13(s):
|
||||||
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
|
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
|
||||||
trans = chars[26:] + chars[:26]
|
trans = chars[26:] + chars[:26]
|
||||||
rot_char = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
rotchar = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
||||||
return ''.join(rot_char(c) for c in s)
|
return ''.join(rotchar(c) for c in s)
|
||||||
|
|
||||||
|
|
||||||
def bytetohex(data):
|
def bytetohex(data):
|
||||||
@ -237,7 +238,7 @@ def patchkeys(f, key):
|
|||||||
|
|
||||||
# Write new data for key
|
# Write new data for key
|
||||||
f.seek(offset + 24)
|
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.write(smc_new_data.encode('UTF-8'))
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
@ -259,7 +260,7 @@ def patchkeys(f, key):
|
|||||||
|
|
||||||
# Write new data for key
|
# Write new data for key
|
||||||
f.seek(offset + 24)
|
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.write(smc_new_data.encode('UTF-8'))
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ Offset Length Struct Type Description
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
import codecs
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
@ -60,8 +61,8 @@ if sys.platform == 'win32' \
|
|||||||
def rot13(s):
|
def rot13(s):
|
||||||
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
|
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
|
||||||
trans = chars[26:] + chars[:26]
|
trans = chars[26:] + chars[:26]
|
||||||
rot_char = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
rotchar = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c
|
||||||
return ''.join(rot_char(c) for c in s)
|
return ''.join(rotchar(c) for c in s)
|
||||||
|
|
||||||
|
|
||||||
def bytetohex(data):
|
def bytetohex(data):
|
||||||
@ -172,7 +173,7 @@ def patchkeys(f, key):
|
|||||||
|
|
||||||
# Write new data for key
|
# Write new data for key
|
||||||
f.seek(offset + 24)
|
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.write(smc_new_data.encode('UTF-8'))
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ def patchkeys(f, key):
|
|||||||
|
|
||||||
# Write new data for key
|
# Write new data for key
|
||||||
f.seek(offset + 24)
|
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.write(smc_new_data.encode('UTF-8'))
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user