Compare commits
No commits in common. "3eb193eca3d1f30064605b6c3030bdb73afdbf3d" and "db157771def588aa5b2791e31e3c416e54b86f34" have entirely different histories.
3eb193eca3
...
db157771de
|
@ -25,9 +25,6 @@ RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyri
|
|||
RUN apt update \
|
||||
&& apt install -y redis grafana
|
||||
|
||||
# Configure Grafana
|
||||
RUN grafana-cli plugins install frser-sqlite-datasource
|
||||
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
|
|
50
V6.py
50
V6.py
|
@ -9,7 +9,7 @@ from modules.db import add_to_database
|
|||
from modules.driver_tools import *
|
||||
from modules.error import *
|
||||
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
import os
|
||||
|
||||
# create a webdriver
|
||||
def create_driver(mobile=False):
|
||||
|
@ -24,7 +24,9 @@ def create_driver(mobile=False):
|
|||
"Chrome/22 Mobile Safari/537.36"
|
||||
)
|
||||
|
||||
chrome_profile_dir = init_profile(config.UserCredentials.get_mail())
|
||||
# Profile dir
|
||||
chrome_profile_dir = "/app/MsRewards-Reborn/user_data/profile/"+config.UserCredentials.get_mail()
|
||||
os.makedirs(chrome_profile_dir, exist_ok=True)
|
||||
|
||||
# Full list on https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
|
||||
arguments = [
|
||||
|
@ -50,6 +52,7 @@ def create_driver(mobile=False):
|
|||
chrome_options.add_argument(arg)
|
||||
|
||||
driver = uc.Chrome(options=chrome_options)
|
||||
set_language(driver)
|
||||
return driver
|
||||
|
||||
|
||||
|
@ -380,35 +383,22 @@ def login_part_1():
|
|||
driver = config.WebDriver.driver
|
||||
driver.get("https://login.live.com")
|
||||
wait_until_visible(By.ID, "i0116", browser=driver)
|
||||
send_wait_and_confirm(
|
||||
driver.find_element(By.ID, "i0116"),
|
||||
config.UserCredentials.get_mail()
|
||||
)
|
||||
mail_elem = driver.find_element(By.ID, "i0116")
|
||||
send_keys_wait(mail_elem, config.UserCredentials.get_mail())
|
||||
mail_elem.send_keys(Keys.ENTER)
|
||||
wait_until_visible(By.ID, "i0118", browser=driver)
|
||||
send_wait_and_confirm(
|
||||
driver.find_element(By.ID, "i0118"),
|
||||
config.UserCredentials.get_password()
|
||||
)
|
||||
pwd_elem = driver.find_element(By.ID, "i0118")
|
||||
send_keys_wait(pwd_elem, config.UserCredentials.get_password())
|
||||
pwd_elem.send_keys(Keys.ENTER)
|
||||
custom_sleep(2)
|
||||
# 2FA
|
||||
try:
|
||||
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()
|
||||
|
||||
info(f"Need 2FA, I have code: {a2f_code}")
|
||||
send_wait_and_confirm(
|
||||
driver.find_element(By.ID, "idTxtBx_SAOTCC_OTC"),
|
||||
a2f_code
|
||||
)
|
||||
except Exception as err:
|
||||
log_error(err)
|
||||
if "Entrez le code de sécurité" in driver.page_source:
|
||||
try:
|
||||
a2f_elem = driver.find_element(By.ID, "idTxtBx_SAOTCC_OTC")
|
||||
a2f_elem.send_keys(config.UserCredentials.get_tfa().now())
|
||||
a2f_elem.send_keys(Keys.ENTER)
|
||||
except Exception as err:
|
||||
log_error(err)
|
||||
|
||||
|
||||
# Accept all cookies question, and check if the account is locked
|
||||
|
@ -709,7 +699,7 @@ def json_start(json_entry, cred: UserCredentials):
|
|||
config.WebDriver.switch_to_driver("PC")
|
||||
driver = config.WebDriver.driver
|
||||
try:
|
||||
if "unban" in json_entry and str(account_id) in json_entry["unban"]:
|
||||
if str(account_id) in json_entry["unban"]:
|
||||
login_part_1()
|
||||
info("\nGO TO example.com TO PROCEED or wait 1200 secs.")
|
||||
for _ in range(1200):
|
||||
|
|
13
clean.sh
13
clean.sh
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker-do () { # Check if sudo needs to be used
|
||||
if id -nG "$(whoami)" | grep -qw "docker"; then
|
||||
docker $@
|
||||
else
|
||||
sudo docker $@
|
||||
fi
|
||||
}
|
||||
|
||||
docker-do stop MsRewards
|
||||
docker-do rm MsRewards
|
||||
docker-do image rm msrewards
|
|
@ -46,7 +46,6 @@ server {
|
|||
proxy_pass "http://127.0.0.1:6666";
|
||||
chunked_transfer_encoding off;
|
||||
proxy_buffering off;
|
||||
set_header X-Accel-Buffering no;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,6 +59,7 @@ sqlite3 /app/MsRewards-Reborn/MsRewards.db "CREATE TABLE comptes (id INTEGER PRI
|
|||
printf "\nconfigurating grafana\n"
|
||||
|
||||
cp /app/MsRewards-Reborn/config/grafana.ini /etc/grafana/
|
||||
grafana-cli plugins install frser-sqlite-datasource
|
||||
|
||||
printf "setting up default dashboard"
|
||||
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,14 +50,9 @@ class Config:
|
|||
"""
|
||||
self.discord = DiscordConfig()
|
||||
self.discord.avatar_url = settings["avatarlink"]
|
||||
self.discord.wh_link = discord[config[args.config]["discord"]]["errorsL"]
|
||||
|
||||
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"]
|
||||
if self.discord.wh_link != "":
|
||||
self.discord.wh = Webhook.from_url(self.discord.wh_link, adapter=RequestsWebhookAdapter())
|
||||
else:
|
||||
self.discord.wh = FakeWebHook()
|
||||
|
|
|
@ -9,6 +9,6 @@ class DiscordConfig:
|
|||
|
||||
|
||||
class FakeWebHook:
|
||||
def send(self, *args, **kwargs):
|
||||
debug(f"Used a webhook call without webhook url with {args} {kwargs}")
|
||||
def send(self, *args):
|
||||
debug(f"Used a webhook call without webhook url with {args}")
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ class UserCredentials:
|
|||
|
||||
def get_tfa(self):
|
||||
if not self.tfa_enable():
|
||||
warning("Warning: TFA is not enabled. Can't get a TFA code.")
|
||||
return None
|
||||
warning("Warning: TFA is not enabled. Calling get_tfa is an expected behaviour.")
|
||||
return TOTP(self.data[self.current]["2fa"])
|
||||
|
||||
def next_account(self):
|
||||
|
@ -42,5 +41,4 @@ class UserCredentials:
|
|||
debug("No new credentials.")
|
||||
|
||||
def is_valid(self):
|
||||
return (self.current < self.total
|
||||
and self.get_mail() != "" and self.get_mail is not None)
|
||||
return self.current < self.total
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import os
|
||||
import json
|
||||
from random import uniform
|
||||
|
||||
from selenium.common import TimeoutException
|
||||
|
@ -12,36 +10,33 @@ from modules.Tools.logger import debug
|
|||
from modules.Tools.tools import *
|
||||
|
||||
|
||||
def init_profile(mail):
|
||||
chrome_profile_dir = "/app/MsRewards-Reborn/user_data/profile/"+mail
|
||||
os.makedirs(chrome_profile_dir, exist_ok=True)
|
||||
|
||||
preferences_file = os.path.join(chrome_profile_dir, "Default", "Preferences")
|
||||
if not os.path.exists(preferences_file):
|
||||
os.makedirs(os.path.join(chrome_profile_dir, "Default"), exist_ok=True)
|
||||
with open(preferences_file, "w") as f:
|
||||
json.dump(
|
||||
{
|
||||
"intl": {
|
||||
"accept_languages": "fr-FR,en-US,en",
|
||||
"selected_languages": "fr-FR,en-US,en"
|
||||
}
|
||||
}, f
|
||||
)
|
||||
else:
|
||||
with open(preferences_file, "r") as f:
|
||||
settings = json.load(f)
|
||||
|
||||
if "intl" not in settings:
|
||||
settings["intl"] = {}
|
||||
|
||||
settings["intl"]["accept_languages"] = "fr-FR,en-US,en"
|
||||
settings["intl"]["selected_languages"] = "fr-FR,en-US,en"
|
||||
|
||||
with open(preferences_file, "w") as f:
|
||||
json.dump(settings, f)
|
||||
|
||||
return chrome_profile_dir
|
||||
def set_language(ldriver):
|
||||
ldriver.get("chrome://settings/languages")
|
||||
action = ActionChains(ldriver)
|
||||
action.reset_actions()
|
||||
# select language
|
||||
x_coord = 1200
|
||||
y_coord = 150
|
||||
action.move_by_offset(x_coord, y_coord).click().perform()
|
||||
sleep(0.5)
|
||||
# scroll down
|
||||
action.reset_actions()
|
||||
elm = ldriver.find_element(By.XPATH, "/html/body")
|
||||
ActionChains(ldriver) \
|
||||
.send_keys("french") \
|
||||
.pause(0.5) \
|
||||
.send_keys(Keys.TAB + Keys.TAB + Keys.ENTER + Keys.TAB + Keys.TAB + Keys.ENTER) \
|
||||
.perform()
|
||||
x_coord = 1163
|
||||
y_coord = 717
|
||||
action.move_by_offset(x_coord, y_coord).click().perform()
|
||||
# put to the top
|
||||
sleep(0.5)
|
||||
action.reset_actions()
|
||||
x_coord = 1257
|
||||
y_coord = 328
|
||||
action.move_by_offset(x_coord, y_coord).click().perform()
|
||||
action.click().perform()
|
||||
|
||||
|
||||
# Deal with RGPD popup as well as some random popup like 'are you satisfied' one
|
||||
|
@ -65,18 +60,13 @@ def send_keys_wait(element, keys: str) -> None:
|
|||
element.send_keys(i)
|
||||
sleep(uniform(0.1, 0.3))
|
||||
|
||||
def send_wait_and_confirm(element, keys: str) -> None:
|
||||
send_keys_wait(element, keys)
|
||||
element.send_keys(Keys.ENTER)
|
||||
|
||||
|
||||
# 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, raise_error=True) -> bool:
|
||||
def wait_until_visible(search_by: str, identifier: str, timeout: int = 20, browser=None) -> bool:
|
||||
try:
|
||||
WebDriverWait(browser, timeout).until(
|
||||
expected_conditions.visibility_of_element_located((search_by, identifier)), "element not found")
|
||||
return True
|
||||
except TimeoutException as e:
|
||||
if raise_error:
|
||||
error(f"element {identifier} not found after {timeout}s")
|
||||
error(f"element {identifier} not found after {timeout}s")
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue