Compare commits

..

4 Commits

Author SHA1 Message Date
augustin64 db157771de Merge flags 2024-04-08 16:51:43 +02:00
augustin64 cbd1ad93a6 version bump 2024-04-08 16:38:16 +02:00
augustin64 afabd94f0d Re-implement cookie login
with chrome profiles
2024-04-08 16:36:38 +02:00
augustin64 81deaf05b0 Update chrome.deb URL 2024-04-08 16:34:36 +02:00
3 changed files with 41 additions and 10 deletions

View File

@ -15,7 +15,7 @@ RUN apt install -y libgtk-4-1 libvulkan1 libxdamage1 \
# Additional repos and packages
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb \
&& dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN curl -sSLO https://nc.piair.xyz/s/BKLsBWoZkTdYjfq/download/chrome.deb \
RUN curl -sSL http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_123.0.6312.86-1_amd64.deb -o chrome.deb \
&& dpkg -i chrome.deb
RUN ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
RUN wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key \
@ -25,12 +25,14 @@ RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyri
RUN apt update \
&& apt install -y redis grafana
COPY requirements.txt /app/requirements.txt
RUN python3 -m pip install -r requirements.txt
# Setup app
RUN git clone https://gitea.augustin64.fr/piair/MsRewards-Reborn
# Use this instead when developping locally:
# COPY . /app/MsRewards-Reborn
RUN python3 -m pip install -r MsRewards-Reborn/requirements.txt
RUN bash MsRewards-Reborn/config/config.sh
ENV TZ="Europe/Paris"

43
V6.py
View File

@ -1,4 +1,4 @@
#!/usr/bin/python3.10
#!/usr/bin/python3
from modules.Classes.Config import Config
from modules.Classes.DiscordLogger import DiscordLogger
from modules.Classes.UserCredentials import UserCredentials
@ -9,6 +9,7 @@ from modules.db import add_to_database
from modules.driver_tools import *
from modules.error import *
import os
# create a webdriver
def create_driver(mobile=False):
@ -22,14 +23,34 @@ def create_driver(mobile=False):
"AppleWebKit/537.36 (KHTML, like Gecko)"
"Chrome/22 Mobile Safari/537.36"
)
chrome_options = webdriver.ChromeOptions()
# 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 = [
"--no-first-run",
"--ash-no-nudges",
"--no-default-browser-check",
"--disable-features=PrivacySandboxSettings4,Translate",
"--disable-search-engine-choice-screen",
f"--user-data-dir={chrome_profile_dir}/"
]
if mobile:
chrome_options.add_argument(f"--user-agent={mobile_user_agent}")
arguments.append(f"--user-agent={mobile_user_agent}")
else:
chrome_options.add_argument(f"--user-agent={pc_user_agent}")
arguments.append(f"--user-agent={pc_user_agent}")
# disabled as it may cause detection
if config.proxy.is_enabled():
chrome_options.add_argument(f'--proxy-server={config.proxy.ip}:{config.proxy.port}')
arguments.append(f'--proxy-server={config.proxy.ip}:{config.proxy.port}')
chrome_options = webdriver.ChromeOptions()
for arg in arguments:
chrome_options.add_argument(arg)
driver = uc.Chrome(options=chrome_options)
set_language(driver)
return driver
@ -192,7 +213,7 @@ def all_cards():
info("no promo card")
if len(card_list) < 10: # most likely an error during loading
if "suspendu" in driver.page_source:
if "suspendu" in driver.page_source or "suspended" in driver.page_source:
raise Banned()
driver.refresh()
card_list = driver.find_elements(By.CLASS_NAME, "c-card-content")
@ -412,9 +433,17 @@ def login_part_2():
# login() tries to login to your Microsoft account.
# it uses global variable g._mail and g._password to login
def login():
def logged_in():
driver.get("https://login.live.com")
custom_sleep(10)
if get_domain(driver) == "account.microsoft.com":
return True
return False
driver = config.WebDriver.driver
try:
login_part_1()
if not logged_in():
login_part_1()
login_part_2()
driver.get("https://rewards.bing.com/")
except Banned:

View File

@ -1 +1 @@
v6.8.42
v6.8.43