mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-06-25 19:03:56 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
ecd5a9f204 | |||
2b1c7b985e | |||
c9c93e9828 | |||
1a4ed4f4e7 | |||
0ba92798ad | |||
4aef2bf948 | |||
68395f4314 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,7 +1,6 @@
|
|||||||
/old
|
/old
|
||||||
geckodriver.log
|
geckodriver.log
|
||||||
.vscode/
|
.vscode/
|
||||||
update.sh
|
|
||||||
/Git
|
/Git
|
||||||
page.html
|
page.html
|
||||||
screenshot.png
|
screenshot.png
|
||||||
@ -11,5 +10,5 @@ data
|
|||||||
/user_data
|
/user_data
|
||||||
install.sh
|
install.sh
|
||||||
nohup.out
|
nohup.out
|
||||||
test.py
|
|
||||||
points.csv
|
points.csv
|
||||||
|
/dev
|
||||||
|
127
CODE_OF_CONDUCT.md
Normal file
127
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at piair338@gmail.com.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
|
https://www.contributor-covenant.org/translations.
|
92
README.md
92
README.md
@ -1,46 +1,50 @@
|
|||||||
# MsReward
|
# MsReward
|
||||||
|
|
||||||
|
|
||||||
A Microsoft reward automator, designed to work headless on any server.
|
A Microsoft reward automator, designed to work headless on any x64 server.
|
||||||
Using a discord webhook or SQL to log points everyday.
|
Using a discord webhook or SQL to log points everyday.
|
||||||
Using Selenium and Geckodriver.
|
Using Selenium and Geckodriver.
|
||||||
|
# Installation instruction
|
||||||
|
Make sure your contry is [supported by MS Rewards](https://support.microsoft.com/en-us/topic/microsoft-rewards-regions-9795ec47-c0f4-a33e-aede-738903359d63).
|
||||||
|
Create 5 Microsoft accounts, that the programm will use.
|
||||||
|
- [linux](#linux)
|
||||||
|
- [Windows](#windows)
|
||||||
|
- [MacOS](#macos)
|
||||||
|
- [Database configuration](#database)
|
||||||
|
- [Options](#options)
|
||||||
|
- [Flags](#flags)
|
||||||
|
## Linux
|
||||||
|
|
||||||
## If you're using docker (way easier)
|
### Using docker (Recommended)
|
||||||
to use docker, run
|
Make sure that [docker](https://docs.docker.com/get-docker/) and [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) are installed.
|
||||||
|
Clone the repository:
|
||||||
```
|
```
|
||||||
sudo docker build .
|
git clone https://github.com/piair338/MsRewards
|
||||||
#copy the build id
|
|
||||||
sudo docker run -ti --name MsRewards [build id]
|
|
||||||
```
|
```
|
||||||
Then, fill the config and start the program everyday with
|
Build the docker container:
|
||||||
```
|
```
|
||||||
sudo docker start MsRewards
|
cd MsRewards
|
||||||
|
sudo docker build -t msrewards .
|
||||||
|
```
|
||||||
|
Run the app for the first time to configure it.
|
||||||
|
```
|
||||||
|
sudo docker run -ti --name MsRewards msrewards
|
||||||
|
```
|
||||||
|
Then to run it everyday, you can use cron and add the line:
|
||||||
|
```
|
||||||
|
10 10 * * * sudo docker start MsRewards
|
||||||
```
|
```
|
||||||
|
|
||||||
## Other configuration
|
### **not** using docker (not recommended)
|
||||||
|
**This is only a recommandation and shouldn't be used !**
|
||||||
To use the database, I recommend MySql, Create a database with the name you want and create a table `daily`, like the one from the image :
|
|
||||||

|
|
||||||
|
|
||||||
You have to use the default world list (`sudo apt install wfrench`). The language is french by default, but you can change it if you want.
|
|
||||||
You can add a link to a website where content is only the link of the monthly fidelity card.
|
|
||||||
|
|
||||||
|
|
||||||
You should limit to 6 account per IP, and DON'T USE outlook account, they are banned.
|
|
||||||

|
|
||||||
|
|
||||||
## If you're **not** using docker
|
|
||||||
|
|
||||||
installation recommandation :
|
|
||||||
```
|
```
|
||||||
sudo apt-get install xdg-utils libdbus-glib-1-2 bzip2 wfrench tigervnc-standalone-server -y
|
sudo apt-get install xdg-utils libdbus-glib-1-2 bzip2 wfrench tigervnc-standalone-server xvnc -y
|
||||||
|
|
||||||
curl -sSLO https://download-installer.cdn.mozilla.net/pub/firefox/releases/91.9.1esr/linux-x86_64/en-US/firefox-91.9.1esr.tar.bz2
|
curl -sSLO https://download-installer.cdn.mozilla.net/pub/firefox/releases/91.9.1esr/linux-x86_64/en-US/firefox-91.9.1esr.tar.bz2
|
||||||
tar -xjf firefox-91.9.1esr.tar.bz2
|
tar -xjf firefox-91.9.1esr.tar.bz2
|
||||||
sudo mv firefox /opt/
|
sudo mv firefox /opt/
|
||||||
sudo ln -s /opt/firefox/firefox /usr/bin/firefox
|
sudo ln -s /opt/firefox/firefox /usr/bin/firefox
|
||||||
|
|
||||||
|
|
||||||
curl -sSLO https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
|
curl -sSLO https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
|
||||||
tar zxf geckodriver-v0.31.0-linux64.tar.gz
|
tar zxf geckodriver-v0.31.0-linux64.tar.gz
|
||||||
sudo mv geckodriver /usr/bin/
|
sudo mv geckodriver /usr/bin/
|
||||||
@ -48,3 +52,41 @@ sudo mv geckodriver /usr/bin/
|
|||||||
rm geckodriver-v0.31.0-linux64.tar.gz
|
rm geckodriver-v0.31.0-linux64.tar.gz
|
||||||
rm firefox-91.9.1esr.tar.bz2
|
rm firefox-91.9.1esr.tar.bz2
|
||||||
```
|
```
|
||||||
|
## Windows
|
||||||
|
Not yet tested, but using docker should work.
|
||||||
|
## MacOS
|
||||||
|
I don't have a mac (yet) so i can't test, but again, install docker and follow the linux installation.
|
||||||
|
|
||||||
|
# Database
|
||||||
|
|
||||||
|
To use the database, I recommend MySql, Create a database with the name `MsRewards` and create a table `daily`, like the one from the image :
|
||||||
|

|
||||||
|
|
||||||
|
# Options
|
||||||
|
TODO
|
||||||
|
# Flags
|
||||||
|
## Override
|
||||||
|
Enable you to choose what action to perform on which account. **Linux only**
|
||||||
|
```
|
||||||
|
python3 main.py -o
|
||||||
|
```
|
||||||
|
## VNC
|
||||||
|
Enble a vnc to a specific port
|
||||||
|
```
|
||||||
|
python3 main.py -v 1234
|
||||||
|
```
|
||||||
|
## config
|
||||||
|
Tell the programm which config to use.
|
||||||
|
Default to ./user_data/config.cfg
|
||||||
|
Putting only a number is equivalent to ./user_data/config[number].cfg
|
||||||
|
```
|
||||||
|
python3 main.py -c 12
|
||||||
|
```
|
||||||
|
## Add points to database
|
||||||
|
Add points to the database using the credentials provided in the default config file.
|
||||||
|
argument : file with a list of `account,points`
|
||||||
|
```
|
||||||
|
python3 main.py -a file.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
90
V5.py
90
V5.py
@ -28,12 +28,14 @@ def firefox_driver(mobile=False, headless=False):
|
|||||||
options.set_preference('intl.accept_languages', 'fr-FR, fr')
|
options.set_preference('intl.accept_languages', 'fr-FR, fr')
|
||||||
options.set_preference("browser.link.open_newwindow", 3)
|
options.set_preference("browser.link.open_newwindow", 3)
|
||||||
options.set_preference("dom.confirm_repost.testing.always_accept", True)
|
options.set_preference("dom.confirm_repost.testing.always_accept", True)
|
||||||
|
if g.fast:
|
||||||
|
options.set_preference("permissions.default.image", 2)
|
||||||
if headless:
|
if headless:
|
||||||
options.add_argument("-headless")
|
options.add_argument("-headless")
|
||||||
if mobile :
|
if mobile :
|
||||||
options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
|
options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
|
||||||
driver = webdriver.Firefox(options=options)
|
driver = webdriver.Firefox(options=options)
|
||||||
driver.set_window_size(1070 + hash(g._mail)%20 , 1900 + hash(g._password + "salt")%10) # mobile resolution are crazy high now, right ?
|
driver.set_window_size(1070 + hash(g._mail)%10 , 1900 + hash(g._password + "salt")%20) # mobile resolution are crazy high now, right ?
|
||||||
else :
|
else :
|
||||||
options.set_preference("general.useragent.override", PC_USER_AGENT)
|
options.set_preference("general.useragent.override", PC_USER_AGENT)
|
||||||
driver = webdriver.Firefox(options=options)
|
driver = webdriver.Firefox(options=options)
|
||||||
@ -225,14 +227,13 @@ def all_cards():
|
|||||||
driver.refresh()
|
driver.refresh()
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
if(len(liste) < 10):
|
if(len(liste) < 10):
|
||||||
log_error("moins de 10 cartes", driver)
|
log_error("Less than 10 cards. Most likely an error with login.", driver)
|
||||||
return("PAS ASSEZ DE CARTES")
|
return("PAS ASSEZ DE CARTES")
|
||||||
if (len(liste) < 20): # most likely not in france
|
if (len(liste) < 20): # most likely not in france
|
||||||
if not g.norvege :
|
if not g.norvege : # TODO : rename norvege to not_france or smth like that
|
||||||
g.norvege = True
|
g.norvege = True
|
||||||
printf("moins de 20 cartes, disabling fidelity")
|
printf("Most likely not in France, thus disabling France specific action")
|
||||||
g.fidelity_link = "Disabled because norway"
|
# TODO : check country for fidelity
|
||||||
log_error("Verifying if Norway", driver, True)
|
|
||||||
for i in range(len(liste)):
|
for i in range(len(liste)):
|
||||||
printf(f"carte {i}")
|
printf(f"carte {i}")
|
||||||
try :
|
try :
|
||||||
@ -243,7 +244,7 @@ def all_cards():
|
|||||||
printf(f"staled, {len(liste)}")
|
printf(f"staled, {len(liste)}")
|
||||||
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
driver.refresh()
|
driver.get("https://rewards.bing.com")
|
||||||
custom_sleep(10)
|
custom_sleep(10)
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
try :
|
try :
|
||||||
@ -294,7 +295,11 @@ def promo():
|
|||||||
break
|
break
|
||||||
if i > 8 :
|
if i > 8 :
|
||||||
log_error("chelou, plus de 8 truc", driver)
|
log_error("chelou, plus de 8 truc", driver)
|
||||||
|
try :
|
||||||
|
elm.click()
|
||||||
|
except :
|
||||||
driver.execute_script("arguments[0].click();", elm)
|
driver.execute_script("arguments[0].click();", elm)
|
||||||
|
printf("that should't be there (promo)")
|
||||||
custom_sleep(3)
|
custom_sleep(3)
|
||||||
if len(driver.window_handles) > 1 :
|
if len(driver.window_handles) > 1 :
|
||||||
driver.switch_to.window(driver.window_handles[len(driver.window_handles)-1])
|
driver.switch_to.window(driver.window_handles[len(driver.window_handles)-1])
|
||||||
@ -306,6 +311,7 @@ def promo():
|
|||||||
except :
|
except :
|
||||||
printf("no new windows", driver)
|
printf("no new windows", driver)
|
||||||
driver.get("https://rewards.bing.com")
|
driver.get("https://rewards.bing.com")
|
||||||
|
driver.refresh()
|
||||||
custom_sleep(3)
|
custom_sleep(3)
|
||||||
|
|
||||||
|
|
||||||
@ -407,7 +413,7 @@ def cookie_login(ldriver):
|
|||||||
printf("No cookies file Found.")
|
printf("No cookies file Found.")
|
||||||
return(False)
|
return(False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(f"error performing cookies login. Trying with password instead. {str(e)}", driver)
|
log_error(f"Error performing cookies login. Trying with password instead. \n{str(e)}", driver)
|
||||||
return(False)
|
return(False)
|
||||||
try :
|
try :
|
||||||
ldriver.refresh()
|
ldriver.refresh()
|
||||||
@ -427,6 +433,8 @@ def login_part_2(ldriver, cookies = False):
|
|||||||
raise Identity()
|
raise Identity()
|
||||||
if ('notice' in ldriver.current_url) :
|
if ('notice' in ldriver.current_url) :
|
||||||
ldriver.find_element(By.ID, "id__0").click()
|
ldriver.find_element(By.ID, "id__0").click()
|
||||||
|
if ("proof" in ldriver.current_url):
|
||||||
|
ldriver.find_element(BY.ID, "iLooksGood")
|
||||||
if cookies:
|
if cookies:
|
||||||
save_cookies(ldriver)
|
save_cookies(ldriver)
|
||||||
for id in ["KmsiCheckboxField", "id__0", "iLooksGood", "idSIButton9", "iCancel"]:
|
for id in ["KmsiCheckboxField", "id__0", "iLooksGood", "idSIButton9", "iCancel"]:
|
||||||
@ -577,41 +585,26 @@ def log_points(account="unknown"):
|
|||||||
webhookSuccess.send(f"{account_name} actuellement à {str(points)} points")
|
webhookSuccess.send(f"{account_name} actuellement à {str(points)} points")
|
||||||
|
|
||||||
if g.sql_enabled :
|
if g.sql_enabled :
|
||||||
|
try :
|
||||||
add_to_database(account_name, points, g.sql_host, g.sql_usr, g.sql_pwd, g.sql_database)
|
add_to_database(account_name, points, g.sql_host, g.sql_usr, g.sql_pwd, g.sql_database)
|
||||||
|
except Exception as e:
|
||||||
|
if g.database_error_override:
|
||||||
|
printf("database error.")
|
||||||
|
else :
|
||||||
|
log_error(e)
|
||||||
|
|
||||||
|
|
||||||
def fidelity():
|
def fidelity():
|
||||||
|
def sub_fidelity():
|
||||||
try:
|
try:
|
||||||
while 1: #close all tabs
|
|
||||||
try:
|
|
||||||
close_tab(1)
|
|
||||||
except:
|
|
||||||
break
|
|
||||||
try :
|
|
||||||
fidelity_link_page = get(g.fidelity_link) #get the url of fidelity page
|
|
||||||
except Exception as e :
|
|
||||||
printf(e)
|
|
||||||
fidelity_link_page = False
|
|
||||||
|
|
||||||
if fidelity_link_page :
|
|
||||||
fidelity_link = fidelity_link_page.content.decode("UTF-8")
|
|
||||||
|
|
||||||
if (fidelity_link.split(":")[0] == "https") or (fidelity_link.split(":")[0] == "http") :
|
|
||||||
driver.get(fidelity_link)
|
|
||||||
wait_until_visible(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]', browser=driver)
|
wait_until_visible(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]', browser=driver)
|
||||||
try :
|
|
||||||
choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]') # pull-left spacer-48-bottom punchcard-row? USELESS ?
|
|
||||||
except : # tentative de fix
|
|
||||||
driver.execute_script("location.reload(true);")
|
|
||||||
wait_until_visible(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]', browser=driver)
|
|
||||||
choix = driver.find_element(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]')
|
|
||||||
answer_number = search("([0-9]) of ([0-9]) completed", driver.page_source)
|
answer_number = search("([0-9]) of ([0-9]) completed", driver.page_source)
|
||||||
|
if answer_number is None :
|
||||||
|
answer_number = search("([0-9]) défi\(s\) terminé\(s\) sur ([0-9])", driver.page_source)
|
||||||
if answer_number is None:
|
if answer_number is None:
|
||||||
answer_number = search("([0-9]) de ([0-9]) finalisé", driver.page_source)
|
answer_number = search("([0-9]) de ([0-9]) finalisé", driver.page_source)
|
||||||
if answer_number is None :
|
if answer_number is None :
|
||||||
answer_number = search("([0-9]) licence\(s\) sur ([0-9]) disponible\(s\)", driver.page_source)
|
answer_number = search("([0-9]) licence\(s\) sur ([0-9]) disponible\(s\)", driver.page_source)
|
||||||
if answer_number is None :
|
|
||||||
answer_number = search("([0-9]) défi\(s\) terminé\(s\) sur ([0-9])", driver.page_source)
|
|
||||||
if answer_number is None :
|
if answer_number is None :
|
||||||
answer_number = [0,0,0]
|
answer_number = [0,0,0]
|
||||||
for _ in range(int(answer_number[2]) - int(answer_number[1])):
|
for _ in range(int(answer_number[2]) - int(answer_number[1])):
|
||||||
@ -630,20 +623,38 @@ def fidelity():
|
|||||||
log_error(f"fidélité - double erreur - e1 : {format_error(e1)} - e2 {format_error(e2)}")
|
log_error(f"fidélité - double erreur - e1 : {format_error(e1)} - e2 {format_error(e2)}")
|
||||||
break
|
break
|
||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
driver.switch_to.window(driver.window_handles[1])
|
driver.switch_to.window(driver.window_handles[2])
|
||||||
try_play(driver.title)
|
try_play(driver.title)
|
||||||
driver.get(fidelity_link) # USELESS ?
|
|
||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
try:
|
try:
|
||||||
close_tab(driver.window_handles[1])
|
close_tab(driver.window_handles[2], 1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf(e)
|
printf(e)
|
||||||
printf("fidelity - done")
|
printf("fidelity - done")
|
||||||
else :
|
|
||||||
printf("invalid fidelity link.")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
if driver.current_url != "https://rewards.bing.com":
|
||||||
|
driver.get("https://rewards.bing.com")
|
||||||
|
pause = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]') # mettre le truc en pause
|
||||||
|
pause.click()
|
||||||
|
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||||
|
nb_cartes = len(cartes)
|
||||||
|
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
|
||||||
|
for i in range(nb_cartes):
|
||||||
|
cartes[i].click() # affiche la bonne carte
|
||||||
|
checked_txt = checked_list_all[i].get_attribute("innerHTML")
|
||||||
|
ok = checked_txt.count("StatusCircleOuter checkmark")
|
||||||
|
total = checked_txt.count("StatusCircleOuter")
|
||||||
|
if (ok != total) :
|
||||||
|
elm = driver.find_elements(By.CLASS_NAME, 'clickable-link')[i]
|
||||||
|
if not "moviesandtv" in elm.get_attribute("innerHTML"): # not the film card
|
||||||
|
elm.click()
|
||||||
|
driver.switch_to.window(driver.window_handles[len(driver.window_handles)-1])
|
||||||
|
sub_fidelity()
|
||||||
|
close_tab(driver.window_handles[1])
|
||||||
|
custom_sleep(1)
|
||||||
|
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||||
|
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
|
||||||
|
|
||||||
def mobile_alert_popup():
|
def mobile_alert_popup():
|
||||||
try:
|
try:
|
||||||
@ -723,7 +734,8 @@ def daily_routine(custom = False):
|
|||||||
|
|
||||||
|
|
||||||
def dev():
|
def dev():
|
||||||
input("dev pause")
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def CustomStart():
|
def CustomStart():
|
||||||
|
27
main.py
27
main.py
@ -34,7 +34,7 @@ def confirm(texte, default = False):
|
|||||||
return False
|
return False
|
||||||
return default
|
return default
|
||||||
|
|
||||||
lang = "fr"
|
lang = "en"
|
||||||
|
|
||||||
text = {"fr" : {
|
text = {"fr" : {
|
||||||
"compte" : "entrer l'adresse mail du compte ",
|
"compte" : "entrer l'adresse mail du compte ",
|
||||||
@ -55,6 +55,24 @@ text = {"fr" : {
|
|||||||
"proxye" : "voulez vous utiliser un proxy ",
|
"proxye" : "voulez vous utiliser un proxy ",
|
||||||
"proxyl" : "entrez le lien du proxy ",
|
"proxyl" : "entrez le lien du proxy ",
|
||||||
"proxyp" : "entrez le port du proxy "
|
"proxyp" : "entrez le port du proxy "
|
||||||
|
},
|
||||||
|
"en" : {
|
||||||
|
"compte" : "enter email of an account",
|
||||||
|
"mdp" : "enter password of this account ",
|
||||||
|
"next" : "Add another account ? ",
|
||||||
|
"finc" : "Adding accounts ",
|
||||||
|
"ajout" : "Accounts added ",
|
||||||
|
"discorde" : "Do you want to use discord ? (Highly recommended as it's untested without)",
|
||||||
|
"w1" : "Enter Webhook link for sending points everyday",
|
||||||
|
"w2" : "Enter Webhook link for errors ",
|
||||||
|
"msqle" : "Do you want to use a database ? ",
|
||||||
|
"msqll" : "database link ",
|
||||||
|
"msqlu" : "database username ",
|
||||||
|
"msqlp" : "database password ",
|
||||||
|
"msqlt" : "database name (should be MsRewards) ",
|
||||||
|
"proxye" : "Do you want to use a proxy ",
|
||||||
|
"proxyl" : "Proxy address ",
|
||||||
|
"proxyp" : "Proxy port "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +110,7 @@ def edit_config_txt(ligne, contenu):
|
|||||||
txt = f.readlines()
|
txt = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
if txt.count(txt) >1:
|
if txt.count(txt) >1:
|
||||||
raise NameError("il y a plus d'une occurence, echec de la modification")
|
raise NameError("Fail")
|
||||||
|
|
||||||
for i in range(len(txt)) :
|
for i in range(len(txt)) :
|
||||||
name = txt[i].split(" = ")[0]
|
name = txt[i].split(" = ")[0]
|
||||||
@ -106,16 +124,11 @@ def edit_config_txt(ligne, contenu):
|
|||||||
|
|
||||||
|
|
||||||
def setup_settings():
|
def setup_settings():
|
||||||
general()
|
|
||||||
discord()
|
discord()
|
||||||
proxy()
|
proxy()
|
||||||
sql()
|
sql()
|
||||||
|
|
||||||
|
|
||||||
def general():
|
|
||||||
if confirm(t["fidelity"]):
|
|
||||||
lien = input(t["lien"])
|
|
||||||
edit_config_txt('FidelityLink',lien)
|
|
||||||
|
|
||||||
|
|
||||||
def discord():
|
def discord():
|
||||||
|
@ -151,6 +151,15 @@ g.sql_host = config["SQL"]["host"]
|
|||||||
g.sql_database = config["SQL"]["database"]
|
g.sql_database = config["SQL"]["database"]
|
||||||
|
|
||||||
|
|
||||||
|
try :
|
||||||
|
g.database_error_override = config["OTHER"]["database_override"] == "True"
|
||||||
|
except :
|
||||||
|
pass
|
||||||
|
|
||||||
|
try :
|
||||||
|
g.fast = config["OTHER"]["fast"] == "True"
|
||||||
|
except :
|
||||||
|
pass
|
||||||
h = open(g.mot_path, "r", encoding="utf-8")
|
h = open(g.mot_path, "r", encoding="utf-8")
|
||||||
lines = h.readlines()
|
lines = h.readlines()
|
||||||
if len(lines) < 3 :
|
if len(lines) < 3 :
|
||||||
|
@ -34,3 +34,5 @@ sql_host = "https://example.com"
|
|||||||
sql_database = "MsRewards"
|
sql_database = "MsRewards"
|
||||||
dev = False
|
dev = False
|
||||||
norvege = False
|
norvege = False
|
||||||
|
database_error_override = False
|
||||||
|
fast = False
|
||||||
|
@ -5,7 +5,6 @@ logpath = /your/path/to/loginandpass.csv
|
|||||||
|
|
||||||
[SETTINGS]
|
[SETTINGS]
|
||||||
|
|
||||||
FidelityLink = Null
|
|
||||||
embeds = False
|
embeds = False
|
||||||
Headless = True
|
Headless = True
|
||||||
|
|
||||||
@ -31,5 +30,8 @@ usr = root
|
|||||||
pwd = password
|
pwd = password
|
||||||
|
|
||||||
[OTHER]
|
[OTHER]
|
||||||
|
|
||||||
avatar = https://cdn.discordapp.com/icons/793934298977009674/d8055bccef6eca4855c349e808d0d788.webp
|
avatar = https://cdn.discordapp.com/icons/793934298977009674/d8055bccef6eca4855c349e808d0d788.webp
|
||||||
ipv6 = False
|
ipv6 = False
|
||||||
|
database_override = False
|
||||||
|
fast = False
|
||||||
|
Reference in New Issue
Block a user