Last active
February 21, 2022 11:50
-
-
Save crbyxwpzfl/dfb322b19f6b1a42819f37b29b7543f9 to your computer and use it in GitHub Desktop.
hb windows vbox pythons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import subprocess | |
#import privates variable | |
import sys | |
import os | |
sys.path.append(os.environ.get('privates')) | |
import privates | |
characteristic = sys.argv[3].strip("''") | |
status = 0 | |
output = subprocess.Popen([f"{privates.vboxman}", 'list', 'runningvms'], stdout=subprocess.PIPE) | |
if "android" in str(output.stdout.read()): | |
status = 1 | |
if sys.argv[1] == "Get": | |
print(int(status), end='') | |
sys.exit() | |
if sys.argv[1] == "Set": | |
value = sys.argv[4].strip("''") | |
if characteristic == "On" and value == "1" and status == 0: | |
output = subprocess.run([f"{privates.vboxman}", 'startvm', "android"]) | |
time.sleep(5) | |
response = requests.get('http://localhost:8080/motion?screen') | |
sys.exit() | |
if characteristic == "On" and value == "0" and status == 1: | |
output = subprocess.run([f"{privates.vboxman}", 'controlvm', "android", 'savestate']) | |
time.sleep(5) | |
response = requests.get('http://localhost:8080/motion?screen') | |
sys.exit() | |
#print("irgendwas stimmt nicht") | |
sys.exit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import subprocess | |
#import privates variable | |
import sys | |
import os | |
sys.path.append(os.environ.get('privates')) | |
import privates | |
characteristic = sys.argv[3].strip("''") | |
status = 0 | |
output = subprocess.Popen([f"{privates.vboxman}", 'list', 'runningvms'], stdout=subprocess.PIPE) | |
if "bigSUR" in str(output.stdout.read()): | |
status = 1 | |
if sys.argv[1] == "Get": | |
print(int(status), end='') | |
sys.exit() | |
if sys.argv[1] == "Set": | |
value = sys.argv[4].strip("''") | |
if characteristic == "On" and value == "1" and status == 0: | |
try: | |
f = open("N:/sicherungskopien/gists/ahk.txt") | |
f.close() | |
output = subprocess.run([f"{privates.vboxman}", 'startvm', "bigSUR"]) | |
time.sleep(120) | |
response = requests.get('http://localhost:8080/motion?screen') | |
time.sleep(120) | |
output = subprocess.run([f"{privates.sshprogramm}", '-batch', '-i', privates.pathtosshkey, '[email protected]', "open -a Music.app && open -a Photos.app"]) | |
sys.exit() | |
except IOError: | |
sys.exit() | |
if characteristic == "On" and value == "0" and status == 1: | |
output = subprocess.run([f"{privates.vboxman}", 'controlvm', "bigSUR", 'acpipowerbutton']) | |
time.sleep(20) | |
output = subprocess.run([f"{privates.vboxman}", 'controlvm', "bigSUR", 'keyboardputscancode', "1c"]) | |
time.sleep(20) | |
response = requests.get('http://localhost:8080/motion?screen') | |
sys.exit() | |
#print("irgendwas stimmt nicht") | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment