fix minor bugs

master
EmaMaker 2021-09-01 17:37:03 +02:00
parent ce369f7f77
commit ea192e2d12
22 changed files with 40 additions and 12 deletions

View File

@ -38,4 +38,13 @@ Use a plain chrome/firefox session, and automate by programmatically controlling
Mouse and keyboard are controlled using https://pyautogui.readthedocs.io/en/latest/<br>
For simpicity, and to avoid messing up the OS by clicking on the wrong stuff, both chrome and pyautogui can be started in a separate Xephyr (https://wiki.archlinux.org/title/Xephyr) window, where they can harm no one. This also gives consistent screen coordinates to the elements on the screen: Google chrome will always be fullscreen inside Xephyr. Mouse coordinates are relative to the X server the script is started in. Using a nested X server with Xephyr requires <b>copyq</b> to share the clipboard with the main X server
<br>
<br>
<br>
# <b> Failure </b>
This project apparently badly failed, since google accounts obtained through qwiklabs.com labs appear to never be able to obtain a backend on Google Colab<br>
## Possible workaround.
Go back to cpu-only and use Google Cloud Shell (which is actually what qwiklabs is meant to be used with) and create some king of botnet/userbot/viewbot for youtube, altervista or other websites. The machine will always appear to be a new one, because it actually is
# Qwiklabs monthly subscription
There is a workaround to obtain a qwiklabs monthly subscription that actually works: https://www.youtube.com/watch?v=gF6agG9kyBs (actually works).<br>
Tested on account i3z8qtab@xojxe.com, now it has monthly sub

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -127,7 +127,7 @@ class ColabGist(Thread):
browser_manager.clickButton(self.driver, By.CSS_SELECTOR, "#ok")
time.sleep(1.5)
def terminate_session():
def terminate_session(self):
# Terminate the session
browser_manager.clickButton(self.driver, By.CSS_SELECTOR, "#runtime-menu-button")
#factory reset to close session

View File

@ -1,5 +1,6 @@
import subprocess
from utils import global_vars, proxy
import time
print("[MAIN] Entering main script!")

View File

@ -94,6 +94,7 @@ if __name__ == "__main__":
# print("[QL_GetGAccount] Inserting credentials")
# account; "mopopa1077@5sword.com", "hellogoodbye"
# account = ("hemerey688@kibwot.com", "hellogoodbye")
account_email = sys.argv[1]
account = (account_email, "hellogoodbye")
username = account[0]
@ -165,13 +166,13 @@ def get_google_account():
account = global_vars.ql_list.request_new_account()
res = subprocess.check_output(['bash','-c', "src/qwiklabs/get_account.sh {} {} ".format(str(global_vars.PROXY), account)]).decode('utf-8')
if res is False:
if res == 'False' or 'False' in res:
res = bool(res)
# Maybe if we failed there was a connection issue, so ping qwiklabs.com to check
# If ping is successful the account is out of quota
if global_vars.PROXY is False:
r = requests.get("https://qwiklabs.com", proxies=proxyDict)
r = requests.get("https://qwiklabs.com")
else :
proxyDict = {
"socksVersion" : 5,
@ -185,10 +186,10 @@ def get_google_account():
print("[QL_GetAccount] Something went wrong, trying again")
return get_google_account()
else:
ql_list.mark_account_for_deletition(account)
global_vars.account_list.mark_account_for_deletition(account)
else:
res = tuple(creds.rsplit())
res = tuple(res.rsplit())
print("[QL_GetGAccount] {}".format(res))
return res

View File

@ -14,6 +14,9 @@ import time
import random
import requests
from random_user_agent.user_agent import UserAgent
from random_user_agent.params import SoftwareName, OperatingSystem
from utils.global_vars import PROXY
def waitForElement(browser, by, selector, timeout=5, after_delay=0):
@ -71,13 +74,16 @@ def start_browser(headless=False):
options.headless = True
opts.add_argument('--enable-javascript') #enabling javascript is needed in order to not get recognized as a bot
# opts.add_argument("user-agent={}".format(user_agent))
user_agent = random_user_agent()
opts.add_argument("user-agent={}".format(user_agent))
if PROXY is not False:
opts.add_argument(f'--proxy-server=socks5://'+PROXY)
print("[Browser_Manager] Starting new browser. Proxy: {} | UserAgent {}".format(PROXY, user_agent))
#Fire up chromedriver
chromedriver = webdriver.Chrome(options=opts)
time.sleep(3)
return chromedriver
@ -87,3 +93,11 @@ def quit_browser(driver):
def delay(driver, waiting_time=5):
driver.implicitly_wait(waiting_time)
def random_user_agent():
software_names = [SoftwareName.CHROME.value]
operating_systems = [OperatingSystem.WINDOWS.value, OperatingSystem.LINUX.value]
user_agent_rotator = UserAgent(software_names=software_names, operating_systems=operating_systems, limit=100)
#list of all user agents
# user_agents = user_agent_rotator.get_user_agents()
return user_agent_rotator.get_random_user_agent()

View File

@ -1,6 +1,6 @@
#!/bin/bash
# change mac
sudo ip link set wlp3s0 down
sudo macchanger -r wlp3s0
sudo ip link set wlp3s0 up
sudo ip link set enp39s0 down
sudo macchanger -r enp39s0
sudo ip link set enp39s0 up

View File

@ -3,4 +3,4 @@ from qwiklabs import account_list
PROXY = False
ql_list = account_list.QL_AccountList('/home/emamaker/Documents/Projects/GColabAutomator/GColabAutomator-v2/src/qwiklabs_available_accounts.txt')
TEST_ACCOUNT = False
# TEST_ACCOUNT = ("student-03-0556d73e7330@qwiklabs.net", "S3jD9Cn6k5dpW")
# TEST_ACCOUNT = ('student-03-8b9257f4e203@qwiklabs.net', '925ZwgHmPf')

View File

@ -18,6 +18,7 @@ class Proxy():
self.account_combo = Proxy.PROXY_COMBOS[self.account_combo_index]
self.last_time = time.time()
print("[Proxy] First time running, starting a new proxy session")
self.start_new_proxy_session()
def request_new_proxy(self):
@ -48,5 +49,7 @@ class Proxy():
self.colab = colab.ColabGist(self.account_combo[1], get_account.get_google_account())
self.colab.run() #this launches a new thread
time.sleep(90)
self.ngrok = ngrok.Ngrok( self.account_combo[0] )