added possibility to add userdata on start, added argument -s --setup switch, added colored output, added Winnings log with date output for better stats
This commit is contained in:
parent
d269c3dc10
commit
a97d3475c5
@ -4,6 +4,8 @@ import time
|
||||
import logging
|
||||
import requests
|
||||
import platform
|
||||
import argparse
|
||||
import datetime
|
||||
import subprocess
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
@ -12,6 +14,46 @@ from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
|
||||
def print_color(message, color):
|
||||
colors = {
|
||||
'black': '\033[30m',
|
||||
'red': '\033[31m',
|
||||
'green': '\033[32m',
|
||||
'yellow': '\033[33m',
|
||||
'blue': '\033[34m',
|
||||
'purple': '\033[35m',
|
||||
'cyan': '\033[36m',
|
||||
'white': '\033[37m'
|
||||
}
|
||||
end_color = '\033[0m'
|
||||
print(f"{colors[color]}{message}{end_color}")
|
||||
|
||||
def get_login_data():
|
||||
username = input("Gebe deine Honeygain Mailadresse ein: ")
|
||||
password = input("Gebe dein Honeygain passwort ein: ")
|
||||
login_data = {"username": username, "password": password}
|
||||
with open('honeygainlogin.json', 'w') as file:
|
||||
json.dump(login_data, file)
|
||||
return login_data
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-s', '--setup', action='store_true', help='set up Honeygain login credentials')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.setup:
|
||||
login_data = get_login_data()
|
||||
write_userdata = input("Möchtest du den Honeypot Claimer nun ausführen? [Y/n] ").lower()
|
||||
if write_userdata == "" or write_userdata == "y":
|
||||
# continue with the default action
|
||||
pass
|
||||
elif write_userdata == "n":
|
||||
# take alternative action
|
||||
print_color("Deine Daten wurden gespeichert...", 'green')
|
||||
sys.exit()
|
||||
else:
|
||||
# handle invalid input
|
||||
print_color("Invalid input, please try again.", 'red')
|
||||
|
||||
# Hier wird das logging erstmal auf Critical gestellt
|
||||
logging.basicConfig(level=logging.CRITICAL)
|
||||
|
||||
@ -31,9 +73,32 @@ logger = logging.getLogger()
|
||||
# Stelle das Log Level ein
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
login_file = 'honeygainlogin.json'
|
||||
|
||||
# Lade die Logindaten aus der honeygainlogin.json datei.
|
||||
with open('honeygainlogin.json', 'r') as file:
|
||||
login_data = json.load(file)
|
||||
try:
|
||||
with open(login_file, 'r') as file:
|
||||
login_data = json.load(file)
|
||||
except FileNotFoundError:
|
||||
print_color("FEHLER! Die honeygainlogin.json konnte nicht gefunden werden.", 'red')
|
||||
login_data = {"username": "user@mail.com", "password": "p@ssw0rd"}
|
||||
with open(login_file, 'w') as file:
|
||||
json.dump(login_data, file)
|
||||
quit()
|
||||
|
||||
if login_data['username'] == 'user@mail.com' or login_data['password'] == 'p@ssw0rd':
|
||||
print_color("FEHLER! Bitte gebe deine Logindaten noch in der honeygainlogin.json ein!", 'red')
|
||||
write_userdata = input("Möchtest du deine Userdaten jetzt aktualisieren? [Y/n] ").lower()
|
||||
if write_userdata == "" or write_userdata == "y":
|
||||
# continue with the default action
|
||||
get_login_data()
|
||||
elif write_userdata == "n":
|
||||
# take alternative action
|
||||
print_color("Breche vorgang ab...", 'red')
|
||||
quit()
|
||||
else:
|
||||
# handle invalid input
|
||||
print_color("Invalid input, please try again.", "red")
|
||||
|
||||
username = login_data['username']
|
||||
password = login_data['password']
|
||||
@ -147,6 +212,17 @@ try:
|
||||
winnings_str = str(winnings_int)
|
||||
# Zeige eine Nachricht mit den Credits die heute gewonnen wurden.
|
||||
print('Du hast heute', winnings_str ,'Credits (', winnings_in_dollars, '$) gewonnen.')
|
||||
winningslog = f"Es wurden {winnings_str} Credits ({winnings_in_dollars} $) gewonnen."
|
||||
today = datetime.datetime.now().strftime("%d.%m.%Y")
|
||||
filename = "Winnings.txt"
|
||||
try:
|
||||
with open(filename, 'r+') as file:
|
||||
contents = file.read()
|
||||
if today not in contents:
|
||||
file.write(f"{today} - {winningslog}\n")
|
||||
except FileNotFoundError:
|
||||
with open(filename, 'w') as file:
|
||||
file.write(f"{today} - {winningslog}\n")
|
||||
else:
|
||||
print('Error:', response.status_code, response.text)
|
||||
except TimeoutException:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user