Skip to content

Instantly share code, notes, and snippets.

@solaritygh
Last active June 21, 2024 20:18
Show Gist options
  • Save solaritygh/7b5a8b91d1d056b1a2ffbef9305b1589 to your computer and use it in GitHub Desktop.
Save solaritygh/7b5a8b91d1d056b1a2ffbef9305b1589 to your computer and use it in GitHub Desktop.
Bypassing Cyber Scarecrow

Basically, it's checking for both VMWare Tools and VBox Guest Additions.

Just a side project. Please don't use this for malicious purposes.

import subprocess
import platform
import winreg
def get_running_processes():
if platform.system().startsWith("Windows"):
cmd = "tasklist"
result = subprocess.check_output(cmd, shell=True).decode()
else:
print(f"Doesn't work on {platform.system()}")
exit()
return result
def check_registry_keys():
vmware_key = r'SOFTWARE\VMWare, Inc.\VMWare Tools'
virtualbox_key = r'SOFTWARE\Oracle\VirtualBox Guest Additions'
vmware_installed = False
virtualbox_installed = False
try:
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
try:
winreg.OpenKey(reg, vmware_key)
vmware_installed = True
except FileNotFoundError:
pass
try:
winreg.OpenKey(reg, virtualbox_key)
virtualbox_installed = True
except FileNotFoundError:
pass
except Exception as e:
print(f"An error occurred while accessing the registry: {e}")
return vmware_installed, virtualbox_installed
def check_virtualbox_and_vmware_processes(processes):
virtualbox_processes = ["vboxservice", "VBoxTray", "VBoxClient", "VBoxControl"]
vmware_processes = ["vmtoolsd", "vmwaretray", "vmwareuser"]
found_virtualbox_process = any(process.lower() in processes.lower() for process in virtualbox_processes)
found_vmware_process = any(process.lower() in processes.lower() for process in vmware_processes)
return found_virtualbox_process, found_vmware_process
def detect_fake_vm_service():
processes = get_running_processes()
vmware_installed, virtualbox_installed = check_registry_keys()
found_virtualbox_process, found_vmware_process = check_virtualbox_and_vmware_processes(processes)
if vmware_installed and virtualbox_installed:
if found_virtualbox_process and found_vmware_process:
print("Fake VM detected: Both VMware and VirtualBox services are running.")
else:
print("Both VMware and VirtualBox are installed, but services are not running.")
else:
print("Not a fake VM: Either VMware or VirtualBox is not installed.")
if __name__ == "__main__":
detect_fake_vm_service()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment