I'm writing a python application that is supposed to run differently, depending on host/guest system context.
What I need is a function that tells where I am:
if IamRunningOnHost():
#start server if not running, connect to server
else: #running on guest
#use different ip, terminate if server not running
Now the easiest way would be to detect some known file system differences between host and guest system or to have a config which I edit manually each time I switch system context.
Is there a cleaner and more universal way to differentiate whenever I am running inside of VirtualBox?
Edit1: My guest and host are both linux operating systems.
Edit2: I failed to mention, it has to be achieved via python call and without the need for root privileges. I also don't want to install additional software in the guest. I simply want to copy and run the application without the requirement of further system changes. The suggested duplicate "Detect virtualized OS from an application?" is therefore not helpful for me.