forked from charlesbel/Microsoft-Rewards-Farmer
-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
954f76b
commit f6f489e
Showing
12 changed files
with
418 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,138 +1,160 @@ | ||
import argparse | ||
import json | ||
import random | ||
import ipapi | ||
import os | ||
import argparse | ||
import random | ||
|
||
from src import * | ||
import ipapi | ||
|
||
from src import ( | ||
DailySet, | ||
Login, | ||
MorePromotions, | ||
PunchCards, | ||
Searches, | ||
Utils, | ||
browserSetup, | ||
) | ||
|
||
POINTS_COUNTER = 0 | ||
|
||
|
||
def getCCodeLang() -> tuple: | ||
lang = "en" | ||
geo = "US" | ||
try: | ||
nfo = ipapi.location() | ||
lang = nfo['languages'].split(',')[0].split('-')[0] | ||
geo = nfo['country'] | ||
if isinstance(nfo, dict): | ||
lang = nfo["languages"].split(",")[0].split("-")[0] | ||
geo = nfo["country"] | ||
return (lang, geo) | ||
except Exception: # pylint: disable=broad-except | ||
return (lang, geo) | ||
except: | ||
return ('en', 'US') | ||
|
||
|
||
def prRed(prt): | ||
print("\033[91m{}\033[00m".format(prt)) | ||
print(f"\033[91m{prt}\033[00m") | ||
|
||
|
||
def prGreen(prt): | ||
print("\033[92m{}\033[00m".format(prt)) | ||
print(f"\033[92m{prt}\033[00m") | ||
|
||
|
||
def prPurple(prt): | ||
print("\033[95m{}\033[00m".format(prt)) | ||
print(f"\033[95m{prt}\033[00m") | ||
|
||
|
||
def prYellow(prt): | ||
print("\033[93m{}\033[00m".format(prt)) | ||
print(f"\033[93m{prt}\033[00m") | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
parser = argparse.ArgumentParser(description='Microsoft Rewards Farmer') | ||
parser.add_argument('-v', '--visible', action='store_true', | ||
help='Optional: Visible browser') | ||
parser.add_argument('-l', '--lang', type=str, default=None, | ||
help='Optional: Language (ex: en)') | ||
parser.add_argument('-g', '--geo', type=str, default=None, | ||
help='Optional: Geolocation (ex: US)') | ||
parser = argparse.ArgumentParser(description="Microsoft Rewards Farmer") | ||
parser.add_argument( | ||
"-v", "--visible", action="store_true", help="Optional: Visible browser" | ||
) | ||
parser.add_argument( | ||
"-l", "--lang", type=str, default=None, help="Optional: Language (ex: en)" | ||
) | ||
parser.add_argument( | ||
"-g", "--geo", type=str, default=None, help="Optional: Geolocation (ex: US)" | ||
) | ||
args = parser.parse_args() | ||
|
||
prRed(""" | ||
prRed( | ||
""" | ||
███╗ ███╗███████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗██████╗ | ||
████╗ ████║██╔════╝ ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔══██╗ | ||
██╔████╔██║███████╗ █████╗ ███████║██████╔╝██╔████╔██║█████╗ ██████╔╝ | ||
██║╚██╔╝██║╚════██║ ██╔══╝ ██╔══██║██╔══██╗██║╚██╔╝██║██╔══╝ ██╔══██╗ | ||
██║ ╚═╝ ██║███████║ ██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗██║ ██║ | ||
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝""") | ||
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝""" | ||
) | ||
prPurple(" by Charles Bel (@charlesbel) version 3.0\n") | ||
|
||
headless = not args.visible | ||
|
||
LANG = args.lang | ||
GEO = args.geo | ||
if not LANG or not GEO : | ||
if not LANG or not GEO: | ||
l, g = getCCodeLang() | ||
if not LANG: | ||
LANG = l | ||
if not GEO: | ||
GEO = g | ||
|
||
accountPath = os.path.dirname(os.path.abspath(__file__)) + "/accounts.json" | ||
try: | ||
account_path = os.path.dirname( | ||
os.path.abspath(__file__)) + '/accounts.json' | ||
ACCOUNTS = json.load(open(account_path, "r")) | ||
with open(accountPath, "r", encoding="utf-8") as f: | ||
ACCOUNTS = json.load(f) | ||
except FileNotFoundError: | ||
with open(account_path, 'w') as f: | ||
f.write(json.dumps([{ | ||
"username": "Your Email", | ||
"password": "Your Password" | ||
}], indent=4)) | ||
prPurple(""" | ||
with open(accountPath, "w", encoding="utf-8") as f: | ||
f.write( | ||
json.dumps( | ||
[{"username": "Your Email", "password": "Your Password"}], indent=4 | ||
) | ||
) | ||
prPurple( | ||
""" | ||
[ACCOUNT] Accounts credential file "accounts.json" created. | ||
[ACCOUNT] Edit with your credentials and save, then press any key to continue... | ||
""") | ||
""" | ||
) | ||
input() | ||
ACCOUNTS = json.load(open(account_path, "r")) | ||
with open(accountPath, "r", encoding="utf-8") as f: | ||
ACCOUNTS = json.load(f) | ||
|
||
random.shuffle(ACCOUNTS) | ||
|
||
for account in ACCOUNTS: | ||
|
||
prYellow('********************' + | ||
account['username'] + '********************') | ||
browser = browserSetup(account['username'], headless, False, LANG) | ||
prYellow("********************" + account["username"] + "********************") | ||
browser = browserSetup(account["username"], headless, False, LANG) | ||
utils = Utils(browser) | ||
|
||
print('[LOGIN]', 'Logging-in...') | ||
POINTS_COUNTER = Login(browser).login( | ||
account['username'], account['password']) | ||
prGreen('[LOGIN] Logged-in successfully !') | ||
print("[LOGIN]", "Logging-in...") | ||
POINTS_COUNTER = Login(browser).login(account["username"], account["password"]) | ||
prGreen("[LOGIN] Logged-in successfully !") | ||
startingPoints = POINTS_COUNTER | ||
prGreen('[POINTS] You have ' + str(POINTS_COUNTER) + | ||
' points on your account !') | ||
prGreen( | ||
"[POINTS] You have " + str(POINTS_COUNTER) + " points on your account !" | ||
) | ||
|
||
utils.goHome() | ||
|
||
print('[DAILY SET]', 'Trying to complete the Daily Set...') | ||
print("[DAILY SET]", "Trying to complete the Daily Set...") | ||
DailySet(browser).completeDailySet() | ||
prGreen('[DAILY SET] Completed the Daily Set successfully !') | ||
print('[PUNCH CARDS]', 'Trying to complete the Punch Cards...') | ||
prGreen("[DAILY SET] Completed the Daily Set successfully !") | ||
print("[PUNCH CARDS]", "Trying to complete the Punch Cards...") | ||
PunchCards(browser).completePunchCards() | ||
prGreen('[PUNCH CARDS] Completed the Punch Cards successfully !') | ||
print('[MORE PROMO]', 'Trying to complete More Promotions...') | ||
prGreen("[PUNCH CARDS] Completed the Punch Cards successfully !") | ||
print("[MORE PROMO]", "Trying to complete More Promotions...") | ||
MorePromotions(browser).completeMorePromotions() | ||
prGreen('[MORE PROMO] Completed More Promotions successfully !') | ||
prGreen("[MORE PROMO] Completed More Promotions successfully !") | ||
remainingSearches, remainingSearchesM = utils.getRemainingSearches() | ||
if remainingSearches != 0: | ||
print('[BING]', 'Starting Desktop and Edge Bing searches...') | ||
POINTS_COUNTER = Searches( | ||
browser, LANG, GEO).bingSearches(remainingSearches) | ||
prGreen('[BING] Finished Desktop and Edge Bing searches !') | ||
print("[BING]", "Starting Desktop and Edge Bing searches...") | ||
POINTS_COUNTER = Searches(browser, LANG, GEO).bingSearches( | ||
remainingSearches | ||
) | ||
prGreen("[BING] Finished Desktop and Edge Bing searches !") | ||
browser.quit() | ||
|
||
if remainingSearchesM != 0: | ||
browser = browserSetup(account['username'], headless, True, LANG) | ||
browser = browserSetup(account["username"], headless, True, LANG) | ||
utils = Utils(browser) | ||
|
||
print('[LOGIN]', 'Logging-in...') | ||
print("[LOGIN]", "Logging-in...") | ||
POINTS_COUNTER = Login(browser).login( | ||
account['username'], account['password'], True) | ||
print('[LOGIN]', 'Logged-in successfully !') | ||
print('[BING]', 'Starting Mobile Bing searches...') | ||
account["username"], account["password"], True | ||
) | ||
print("[LOGIN]", "Logged-in successfully !") | ||
print("[BING]", "Starting Mobile Bing searches...") | ||
POINTS_COUNTER = Searches(browser, LANG, GEO).bingSearches( | ||
remainingSearchesM, True) | ||
prGreen('[BING] Finished Mobile Bing searches !') | ||
remainingSearchesM, True | ||
) | ||
prGreen("[BING] Finished Mobile Bing searches !") | ||
browser.quit() | ||
|
||
prGreen(f'[POINTS] You have earned {POINTS_COUNTER - startingPoints} points today !') | ||
prGreen(f'[POINTS] You are now at {POINTS_COUNTER} points !\n') | ||
prGreen( | ||
f"[POINTS] You have earned {POINTS_COUNTER - startingPoints} points today !" | ||
) | ||
prGreen(f"[POINTS] You are now at {POINTS_COUNTER} points !\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
from .browser import * | ||
from .constants import * | ||
from .dailySet import * | ||
from .login import * | ||
from .morePromotions import * | ||
from .punchCards import * | ||
from .searches import * | ||
from .utils import * | ||
from .activities import * | ||
from .browser import browserSetup | ||
from .dailySet import DailySet | ||
from .login import Login | ||
from .morePromotions import MorePromotions | ||
from .punchCards import PunchCards | ||
from .searches import Searches | ||
from .utils import Utils |
Oops, something went wrong.