GShellAutomator/Automator/shell/gists/userbot.py

36 lines
1.6 KiB
Python

from shell.gists.gist import Gist
from shell.shell import Shell
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
class UserBot (Gist):
def execute(self, shell):
# prepare for userbot, without enabling ephimeral files will be there next reboot
shell.execute_script_from_local("./src/shell/gists/scripts/clear_homedir.sh")
shell.execute_script_from_local("./src/shell/gists/scripts/prepare_environment_ubuntu.sh")
i = 1
while True:
print("[UserBOT] Starting execution #{}".format(i))
i += 1
#clean home dir, just in case
shell.execute_script_from_local("./src/shell/gists/scripts/clear_homedir.sh")
#download bot
shell.execute_command("wget https://gist.githubusercontent.com/EmaMaker/86d49a9b6b2a66e6299ec4cd9fd8de12/raw/b26b9328a1ee06d34124eee86ff024ae92e0bbf8/userbot.py")
#prepare python
shell.execute_script_from_local("./src/shell/gists/scripts/prepare_python_environment.sh")
#the userbot.py script is executing chromedriver in headless mode, so vnc isn't actually needed
shell.execute_script_from_local("./src/shell/gists/scripts/start_vnc_server.sh")
# now execute userbot. Probably there will be some time between end of execution and start of reboot
shell.execute_script_from_local("./src/shell/gists/scripts/userbot_script.sh")
# reboot the machine to get a clean one with a new ip and mac
shell.reboot()