mirror of
https://github.com/paolo-projects/unlocker.git
synced 2025-07-26 23:44:28 +02:00
Re-worked based on discovery of VMX sandbox
This commit is contained in:
parent
7524b414cf
commit
dba3097137
BIN
dumpsmc.exe
Executable file
BIN
dumpsmc.exe
Executable file
Binary file not shown.
@ -8,25 +8,49 @@ formatting or comments.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
|
||||
def testline(line, test):
|
||||
sline = line.lstrip()
|
||||
if sline == test:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
vmsvc = ' <vmsvc>\n'
|
||||
sandbox = ' <useVmxSandbox>false</useVmxSandbox>\n'
|
||||
vmsvc = '<vmsvc>\n'
|
||||
sandbox = '<useVmxSandbox>false</useVmxSandbox>\n'
|
||||
|
||||
with open('/etc/vmware/hostd/config.xml', 'r+') as f:
|
||||
data = f.readlines()
|
||||
i = data.index(vmsvc)
|
||||
try:
|
||||
j = data.index(sandbox)
|
||||
except ValueError:
|
||||
j = 0
|
||||
|
||||
# Search for the relevant XML tags
|
||||
i = 0
|
||||
vmsvcindex = 0
|
||||
sandboxindex = 0
|
||||
for line in data:
|
||||
|
||||
if testline(line, vmsvc):
|
||||
vmsvcindex = i
|
||||
|
||||
if testline(line, sandbox):
|
||||
sandboxindex = i
|
||||
|
||||
# print(line, end='')
|
||||
i += 1
|
||||
|
||||
# Simple toggle on or off depending if found
|
||||
if j == 0:
|
||||
data.insert(i+1, sandbox)
|
||||
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:
|
||||
del data[j]
|
||||
pass
|
||||
|
||||
# Rewrite the config.xml file
|
||||
f.seek(0)
|
||||
@ -34,5 +58,6 @@ def main():
|
||||
f.truncate()
|
||||
f.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -13,6 +13,6 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
echo Installing local.sh
|
||||
chmod +x local.sh
|
||||
cp local.sh /etc/rc.local.d/local.sh
|
||||
python esxi-config.py
|
||||
python esxi-config.py insert
|
||||
backup.sh 0
|
||||
echo Success - please now restart the server!
|
||||
|
@ -11,6 +11,6 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
|
||||
echo Uninstalling local.sh
|
||||
cp /etc/rc.local.d/.#local.sh /etc/rc.local.d/local.sh
|
||||
python esxi-config.py
|
||||
python esxi-config.py delete
|
||||
backup.sh 0
|
||||
echo Success - please now restart the server!
|
||||
|
BIN
gettools.exe
Executable file
BIN
gettools.exe
Executable file
Binary file not shown.
BIN
unlocker.exe
Executable file
BIN
unlocker.exe
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user