Compare commits
3 Commits
6f13b2532d
...
f566b2eeda
Author | SHA1 | Date | |
---|---|---|---|
f566b2eeda | |||
52e88f81b9 | |||
1a8137783c |
@ -25,6 +25,9 @@ RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyri
|
|||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install -y redis grafana
|
&& apt install -y redis grafana
|
||||||
|
|
||||||
|
# Configure Grafana
|
||||||
|
RUN grafana-cli plugins install frser-sqlite-datasource
|
||||||
|
|
||||||
COPY requirements.txt /app/requirements.txt
|
COPY requirements.txt /app/requirements.txt
|
||||||
RUN python3 -m pip install -r requirements.txt
|
RUN python3 -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
17
V6.py
17
V6.py
@ -391,17 +391,22 @@ def login_part_1():
|
|||||||
)
|
)
|
||||||
# 2FA
|
# 2FA
|
||||||
try:
|
try:
|
||||||
wait_until_visible(By.ID, "idTxtBx_SAOTCC_OTC", browser=driver, timeout=5)
|
if not wait_until_visible(By.ID, "idTxtBx_SAOTCC_OTC", browser=driver, timeout=5, raise_error=False):
|
||||||
|
custom_sleep(2)
|
||||||
|
return
|
||||||
|
|
||||||
|
tfa = config.UserCredentials.get_tfa()
|
||||||
|
if tfa is None:
|
||||||
|
error("2FA needed but no code available for this account, sending error")
|
||||||
|
raise ValueError("2FA needed but no code available for this account")
|
||||||
|
else:
|
||||||
|
a2f_code = tfa.now()
|
||||||
|
|
||||||
a2f_code = config.UserCredentials.get_tfa().now()
|
|
||||||
info(f"Need 2FA, I have code: {a2f_code}")
|
info(f"Need 2FA, I have code: {a2f_code}")
|
||||||
send_wait_and_confirm(
|
send_wait_and_confirm(
|
||||||
driver.find_element(By.ID, "idTxtBx_SAOTCC_OTC"),
|
driver.find_element(By.ID, "idTxtBx_SAOTCC_OTC"),
|
||||||
a2f_code
|
a2f_code
|
||||||
)
|
)
|
||||||
except NoSuchElementException:
|
|
||||||
custom_sleep(2)
|
|
||||||
pass
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
log_error(err)
|
log_error(err)
|
||||||
|
|
||||||
@ -704,7 +709,7 @@ def json_start(json_entry, cred: UserCredentials):
|
|||||||
config.WebDriver.switch_to_driver("PC")
|
config.WebDriver.switch_to_driver("PC")
|
||||||
driver = config.WebDriver.driver
|
driver = config.WebDriver.driver
|
||||||
try:
|
try:
|
||||||
if str(account_id) in json_entry["unban"]:
|
if "unban" in json_entry and str(account_id) in json_entry["unban"]:
|
||||||
login_part_1()
|
login_part_1()
|
||||||
info("\nGO TO example.com TO PROCEED or wait 1200 secs.")
|
info("\nGO TO example.com TO PROCEED or wait 1200 secs.")
|
||||||
for _ in range(1200):
|
for _ in range(1200):
|
||||||
|
@ -59,7 +59,6 @@ sqlite3 /app/MsRewards-Reborn/MsRewards.db "CREATE TABLE comptes (id INTEGER PRI
|
|||||||
printf "\nconfigurating grafana\n"
|
printf "\nconfigurating grafana\n"
|
||||||
|
|
||||||
cp /app/MsRewards-Reborn/config/grafana.ini /etc/grafana/
|
cp /app/MsRewards-Reborn/config/grafana.ini /etc/grafana/
|
||||||
grafana-cli plugins install frser-sqlite-datasource
|
|
||||||
|
|
||||||
printf "setting up default dashboard"
|
printf "setting up default dashboard"
|
||||||
cp /app/MsRewards-Reborn/config/Stats-dashbord.json /usr/share/grafana/public/dashboards/home.json
|
cp /app/MsRewards-Reborn/config/Stats-dashbord.json /usr/share/grafana/public/dashboards/home.json
|
||||||
|
1459
config/grafana.ini
1459
config/grafana.ini
File diff suppressed because it is too large
Load Diff
@ -50,9 +50,14 @@ class Config:
|
|||||||
"""
|
"""
|
||||||
self.discord = DiscordConfig()
|
self.discord = DiscordConfig()
|
||||||
self.discord.avatar_url = settings["avatarlink"]
|
self.discord.avatar_url = settings["avatarlink"]
|
||||||
self.discord.wh_link = discord[config[args.config]["discord"]]["errorsL"]
|
|
||||||
|
|
||||||
if self.discord.wh_link != "":
|
if (
|
||||||
|
"discord" in config[args.config]
|
||||||
|
and config[args.config]["discord"] in discord
|
||||||
|
and "errorsL" in discord[config[args.config]["discord"]]
|
||||||
|
and discord[config[args.config]["discord"]]["errorsL"] != ""
|
||||||
|
):
|
||||||
|
self.discord.wh_link = discord[config[args.config]["discord"]]["errorsL"]
|
||||||
self.discord.wh = Webhook.from_url(self.discord.wh_link, adapter=RequestsWebhookAdapter())
|
self.discord.wh = Webhook.from_url(self.discord.wh_link, adapter=RequestsWebhookAdapter())
|
||||||
else:
|
else:
|
||||||
self.discord.wh = FakeWebHook()
|
self.discord.wh = FakeWebHook()
|
||||||
|
@ -9,6 +9,6 @@ class DiscordConfig:
|
|||||||
|
|
||||||
|
|
||||||
class FakeWebHook:
|
class FakeWebHook:
|
||||||
def send(self, *args):
|
def send(self, *args, **kwargs):
|
||||||
debug(f"Used a webhook call without webhook url with {args}")
|
debug(f"Used a webhook call without webhook url with {args} {kwargs}")
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@ class UserCredentials:
|
|||||||
|
|
||||||
def get_tfa(self):
|
def get_tfa(self):
|
||||||
if not self.tfa_enable():
|
if not self.tfa_enable():
|
||||||
warning("Warning: TFA is not enabled. Calling get_tfa is an expected behaviour.")
|
warning("Warning: TFA is not enabled. Can't get a TFA code.")
|
||||||
|
return None
|
||||||
return TOTP(self.data[self.current]["2fa"])
|
return TOTP(self.data[self.current]["2fa"])
|
||||||
|
|
||||||
def next_account(self):
|
def next_account(self):
|
||||||
|
@ -71,11 +71,12 @@ def send_wait_and_confirm(element, keys: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
# Wait for the presence of the element identifier or [timeout]s
|
# Wait for the presence of the element identifier or [timeout]s
|
||||||
def wait_until_visible(search_by: str, identifier: str, timeout: int = 20, browser=None) -> bool:
|
def wait_until_visible(search_by: str, identifier: str, timeout: int = 20, browser=None, raise_error=True) -> bool:
|
||||||
try:
|
try:
|
||||||
WebDriverWait(browser, timeout).until(
|
WebDriverWait(browser, timeout).until(
|
||||||
expected_conditions.visibility_of_element_located((search_by, identifier)), "element not found")
|
expected_conditions.visibility_of_element_located((search_by, identifier)), "element not found")
|
||||||
return True
|
return True
|
||||||
except TimeoutException as e:
|
except TimeoutException as e:
|
||||||
error(f"element {identifier} not found after {timeout}s")
|
if raise_error:
|
||||||
|
error(f"element {identifier} not found after {timeout}s")
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user