Re-worked based on discovery of VMX sandbox

This commit is contained in:
David Parsons 2016-12-29 13:34:56 +00:00
parent 7524b414cf
commit dba3097137
6 changed files with 37 additions and 12 deletions

BIN
dumpsmc.exe Executable file

Binary file not shown.

View File

@ -8,25 +8,49 @@ formatting or comments.
""" """
from __future__ import print_function from __future__ import print_function
import sys
def testline(line, test):
sline = line.lstrip()
if sline == test:
return True
else:
return False
def main(): def main():
vmsvc = ' <vmsvc>\n' vmsvc = '<vmsvc>\n'
sandbox = ' <useVmxSandbox>false</useVmxSandbox>\n' sandbox = '<useVmxSandbox>false</useVmxSandbox>\n'
with open('/etc/vmware/hostd/config.xml', 'r+') as f: with open('/etc/vmware/hostd/config.xml', 'r+') as f:
data = f.readlines() data = f.readlines()
i = data.index(vmsvc)
try: # Search for the relevant XML tags
j = data.index(sandbox) i = 0
except ValueError: vmsvcindex = 0
j = 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 # Simple toggle on or off depending if found
if j == 0: if sandboxindex != 0 and sys.argv[1] == 'delete':
data.insert(i+1, sandbox) 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: else:
del data[j] pass
# Rewrite the config.xml file # Rewrite the config.xml file
f.seek(0) f.seek(0)
@ -34,5 +58,6 @@ def main():
f.truncate() f.truncate()
f.close() f.close()
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -13,6 +13,6 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
echo Installing local.sh echo Installing local.sh
chmod +x local.sh chmod +x local.sh
cp local.sh /etc/rc.local.d/local.sh cp local.sh /etc/rc.local.d/local.sh
python esxi-config.py python esxi-config.py insert
backup.sh 0 backup.sh 0
echo Success - please now restart the server! echo Success - please now restart the server!

View File

@ -11,6 +11,6 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
echo Uninstalling local.sh echo Uninstalling local.sh
cp /etc/rc.local.d/.#local.sh /etc/rc.local.d/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 backup.sh 0
echo Success - please now restart the server! echo Success - please now restart the server!

BIN
gettools.exe Executable file

Binary file not shown.

BIN
unlocker.exe Executable file

Binary file not shown.