diff --git a/dumpsmc.exe b/dumpsmc.exe new file mode 100755 index 0000000..07ed1eb Binary files /dev/null and b/dumpsmc.exe differ diff --git a/esxi-config.py b/esxi-config.py index 8e1f180..24eb888 100755 --- a/esxi-config.py +++ b/esxi-config.py @@ -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 = ' \n' - sandbox = ' false\n' + vmsvc = '\n' + sandbox = 'false\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() diff --git a/esxi-install.sh b/esxi-install.sh index 9c07489..f8f2e8c 100755 --- a/esxi-install.sh +++ b/esxi-install.sh @@ -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! diff --git a/esxi-uninstall.sh b/esxi-uninstall.sh index ee76fc0..d20e634 100755 --- a/esxi-uninstall.sh +++ b/esxi-uninstall.sh @@ -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! diff --git a/gettools.exe b/gettools.exe new file mode 100755 index 0000000..a2981dc Binary files /dev/null and b/gettools.exe differ diff --git a/unlocker.exe b/unlocker.exe new file mode 100755 index 0000000..eaddf8e Binary files /dev/null and b/unlocker.exe differ