Compare commits

...

23 Commits

Author SHA1 Message Date
piair 8c224793b0 resize terminal on animation end 2024-02-28 15:04:19 +01:00
piair 36fd92f71c fix json start 2024-02-28 14:44:11 +01:00
piair 0a02eb2033 fix json start 2024-02-28 14:44:01 +01:00
piair 6122d9ee13 fix json start + improve logs 2024-02-28 14:40:12 +01:00
piair a590d0f1b5 fix json start 2024-02-28 14:29:21 +01:00
piair 64a018044c event on resize 2024-02-28 14:26:25 +01:00
piair 91e7f31bac size issues 2024-02-28 14:17:55 +01:00
piair 295f6d114d size issues 2024-02-28 14:14:29 +01:00
piair 49e0d1b599 the issue seemed to be linked to the use of table instead of div 2024-02-28 14:13:19 +01:00
piair 83eea03c73 the issue seemed to be linked to the use of table instead of div 2024-02-28 14:13:16 +01:00
piair 3d096ec34c close to working 2024-02-28 12:09:32 +01:00
piair 7bdf229fa8 je connais pas le js moi 2024-02-28 12:02:41 +01:00
piair 0abb8a3494 weird errors 2024-02-28 12:00:19 +01:00
piair 231c3b34e3 better terminal 2024-02-28 11:55:55 +01:00
piair c72aaf3fcc better terminal 2024-02-28 11:53:23 +01:00
piair 675e67055b better terminal 2024-02-28 11:41:16 +01:00
piair a089fdfdf1 better terminal 2024-02-28 11:41:13 +01:00
piair 0f60d67951 obsolete : module 2024-02-28 11:38:32 +01:00
piair 1c7d1dfcd6 typo 2024-02-28 11:38:21 +01:00
piair 19606e5f4c I'm just a clown, I didn't update... 2024-02-28 11:15:09 +01:00
piair aaafbb2257 some debug don't work at all ? 2024-02-28 11:13:09 +01:00
piair 8d332f1c3c check if discord works 2024-02-28 11:10:48 +01:00
piair ced633dd68 refactored log_points 2024-02-28 10:49:27 +01:00
20 changed files with 480 additions and 76 deletions

3
.gitignore vendored
View File

@ -15,3 +15,6 @@ nohup.out
points.csv points.csv
file.png file.png
user_data/configs.json user_data/configs.json
*.ts
LICENSE
README.md

View File

@ -1,5 +1,5 @@
nohup bash /app/MsRewards-Reborn/sse.sh & nohup redis-server &> nohup_redis.out &
nohup bash /app/MsRewards-Reborn/sse.sh &> nohup_sse.out &
service grafana-server start service grafana-server start
service nginx start service nginx start
nohup redis-server &
gunicorn --reload --worker-class gevent -b 0.0.0.0:6666 'app:app' gunicorn --reload --worker-class gevent -b 0.0.0.0:6666 'app:app'

20
Flask/static/node_modules/.package-lock.json generated vendored Normal file
View File

@ -0,0 +1,20 @@
{
"name": "static",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/xterm": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/xterm/-/xterm-5.3.0.tgz",
"integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg=="
},
"node_modules/xterm-addon-fit": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/xterm-addon-fit/-/xterm-addon-fit-0.8.0.tgz",
"integrity": "sha512-yj3Np7XlvxxhYF/EJ7p3KHaMt6OdwQ+HDu573Vx1lRXsVxOcnVJs51RgjZOouIZOczTsskaS+CpXspK81/DLqw==",
"peerDependencies": {
"xterm": "^5.0.0"
}
}
}
}

View File

@ -0,0 +1,2 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=s-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})()));
//# sourceMappingURL=xterm-addon-fit.js.map

File diff suppressed because one or more lines are too long

26
Flask/static/node_modules/xterm-addon-fit/package.json generated vendored Normal file
View File

@ -0,0 +1,26 @@
{
"name": "xterm-addon-fit",
"version": "0.8.0",
"author": {
"name": "The xterm.js authors",
"url": "https://xtermjs.org/"
},
"main": "lib/xterm-addon-fit.js",
"types": "typings/xterm-addon-fit.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"license": "MIT",
"keywords": [
"terminal",
"xterm",
"xterm.js"
],
"scripts": {
"build": "../../node_modules/.bin/tsc -p .",
"prepackage": "npm run build",
"package": "../../node_modules/.bin/webpack",
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
}
}

209
Flask/static/node_modules/xterm/css/xterm.css generated vendored Normal file
View File

@ -0,0 +1,209 @@
/**
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/term.js
* @license MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Originally forked from (with the author's permission):
* Fabrice Bellard's javascript vt100 for jslinux:
* http://bellard.org/jslinux/
* Copyright (c) 2011 Fabrice Bellard
* The original design remains. The terminal itself
* has been extended to include xterm CSI codes, among
* other features.
*/
/**
* Default styles for xterm.js
*/
.xterm {
cursor: text;
position: relative;
user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
}
.xterm.focus,
.xterm:focus {
outline: none;
}
.xterm .xterm-helpers {
position: absolute;
top: 0;
/**
* The z-index of the helpers must be higher than the canvases in order for
* IMEs to appear on top.
*/
z-index: 5;
}
.xterm .xterm-helper-textarea {
padding: 0;
border: 0;
margin: 0;
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
position: absolute;
opacity: 0;
left: -9999em;
top: 0;
width: 0;
height: 0;
z-index: -5;
/** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap;
overflow: hidden;
resize: none;
}
.xterm .composition-view {
/* TODO: Composition position got messed up somewhere */
background: #000;
color: #FFF;
display: none;
position: absolute;
white-space: nowrap;
z-index: 1;
}
.xterm .composition-view.active {
display: block;
}
.xterm .xterm-viewport {
/* On OS X this is required in order for the scroll bar to appear fully opaque */
background-color: #000;
overflow-y: scroll;
cursor: default;
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
}
.xterm .xterm-screen {
position: relative;
}
.xterm .xterm-screen canvas {
position: absolute;
left: 0;
top: 0;
}
.xterm .xterm-scroll-area {
visibility: hidden;
}
.xterm-char-measure-element {
display: inline-block;
visibility: hidden;
position: absolute;
top: 0;
left: -9999em;
line-height: normal;
}
.xterm.enable-mouse-events {
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
}
.xterm.xterm-cursor-pointer,
.xterm .xterm-cursor-pointer {
cursor: pointer;
}
.xterm.column-select.focus {
/* Column selection mode */
cursor: crosshair;
}
.xterm .xterm-accessibility,
.xterm .xterm-message {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 10;
color: transparent;
pointer-events: none;
}
.xterm .live-region {
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
}
.xterm-dim {
/* Dim should not apply to background, so the opacity of the foreground color is applied
* explicitly in the generated class and reset to 1 here */
opacity: 1 !important;
}
.xterm-underline-1 { text-decoration: underline; }
.xterm-underline-2 { text-decoration: double underline; }
.xterm-underline-3 { text-decoration: wavy underline; }
.xterm-underline-4 { text-decoration: dotted underline; }
.xterm-underline-5 { text-decoration: dashed underline; }
.xterm-overline {
text-decoration: overline;
}
.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
.xterm-strikethrough {
text-decoration: line-through;
}
.xterm-screen .xterm-decoration-container .xterm-decoration {
z-index: 6;
position: absolute;
}
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
z-index: 7;
}
.xterm-decoration-overview-ruler {
z-index: 8;
position: absolute;
top: 0;
right: 0;
pointer-events: none;
}
.xterm-decoration-top {
z-index: 2;
position: relative;
}

2
Flask/static/node_modules/xterm/lib/xterm.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
Flask/static/node_modules/xterm/lib/xterm.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

100
Flask/static/node_modules/xterm/package.json generated vendored Normal file
View File

@ -0,0 +1,100 @@
{
"name": "xterm",
"description": "Full xterm terminal, in your browser",
"version": "5.3.0",
"main": "lib/xterm.js",
"style": "css/xterm.css",
"types": "typings/xterm.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"license": "MIT",
"keywords": [
"cli",
"command-line",
"console",
"pty",
"shell",
"ssh",
"styles",
"terminal-emulator",
"terminal",
"tty",
"vt100",
"webgl",
"xterm"
],
"scripts": {
"prepackage": "npm run build",
"package": "webpack",
"package-headless": "webpack --config ./webpack.config.headless.js",
"postpackage-headless": "node ./bin/package_headless.js",
"start": "node demo/start",
"build-demo": "webpack --config ./demo/webpack.config.js",
"start-debug": "node --inspect-brk demo/start",
"lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
"lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
"test": "npm run test-unit",
"posttest": "npm run lint",
"test-api": "npm run test-api-chromium",
"test-api-chromium": "node ./bin/test_api.js --browser=chromium --timeout=20000",
"test-api-firefox": "node ./bin/test_api.js --browser=firefox --timeout=20000",
"test-api-webkit": "node ./bin/test_api.js --browser=webkit --timeout=20000",
"test-playwright": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4",
"test-playwright-chromium": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4 --project='Chrome Stable'",
"test-playwright-firefox": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4 --project='Firefox Stable'",
"test-playwright-webkit": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4 --project='WebKit'",
"test-playwright-debug": "playwright test -c ./out-test/playwright/playwright.config.js --headed --workers 1 --timeout 30000",
"test-unit": "node ./bin/test.js",
"test-unit-coverage": "node ./bin/test.js --coverage",
"test-unit-dev": "cross-env NODE_PATH='./out' mocha",
"build": "tsc -b ./tsconfig.all.json",
"install-addons": "node ./bin/install-addons.js",
"presetup": "npm run install-addons",
"setup": "npm run build",
"prepublishOnly": "npm run package",
"watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput",
"benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json",
"benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/test/benchmark/*benchmark.js",
"benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/test/benchmark/*benchmark.js",
"clean": "rm -rf lib out addons/*/lib addons/*/out",
"vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts"
},
"devDependencies": {
"@playwright/test": "^1.37.1",
"@types/chai": "^4.2.22",
"@types/debug": "^4.1.7",
"@types/deep-equal": "^1.0.1",
"@types/express": "4",
"@types/express-ws": "^3.0.1",
"@types/glob": "^7.2.0",
"@types/jsdom": "^16.2.13",
"@types/mocha": "^9.0.0",
"@types/node": "^18.16.0",
"@types/utf8": "^3.0.0",
"@types/webpack": "^5.28.0",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^6.2.00",
"@typescript-eslint/parser": "^6.2.00",
"chai": "^4.3.4",
"cross-env": "^7.0.3",
"deep-equal": "^2.0.5",
"eslint": "^8.45.0",
"eslint-plugin-jsdoc": "^39.3.6",
"express": "^4.17.1",
"express-ws": "^5.0.2",
"glob": "^7.2.0",
"jsdom": "^18.0.1",
"mocha": "^10.1.0",
"mustache": "^4.2.0",
"node-pty": "^0.10.1",
"nyc": "^15.1.0",
"source-map-loader": "^3.0.0",
"source-map-support": "^0.5.20",
"ts-loader": "^9.3.1",
"typescript": "^5.1.6",
"utf8": "^3.0.0",
"webpack": "^5.61.0",
"webpack-cli": "^4.9.1",
"ws": "^8.2.3",
"xterm-benchmark": "^0.3.1"
}
}

26
Flask/static/package-lock.json generated Normal file
View File

@ -0,0 +1,26 @@
{
"name": "static",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
}
},
"node_modules/xterm": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/xterm/-/xterm-5.3.0.tgz",
"integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg=="
},
"node_modules/xterm-addon-fit": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/xterm-addon-fit/-/xterm-addon-fit-0.8.0.tgz",
"integrity": "sha512-yj3Np7XlvxxhYF/EJ7p3KHaMt6OdwQ+HDu573Vx1lRXsVxOcnVJs51RgjZOouIZOczTsskaS+CpXspK81/DLqw==",
"peerDependencies": {
"xterm": "^5.0.0"
}
}
}
}

View File

@ -0,0 +1,6 @@
{
"dependencies": {
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
}
}

View File

@ -1,4 +1,3 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block left_pannel %}override{% endblock %} {% block left_pannel %}override{% endblock %}
@ -7,27 +6,41 @@
{% if not current_user.is_authenticated %} {% if not current_user.is_authenticated %}
<button class="unselected" onclick="location.href = '/login';">login</button> <button class="unselected" onclick="location.href = '/login';">login</button>
{% else %} {% else %}
<table> <link rel="stylesheet" href="{{ url_for('static', filename='node_modules/xterm/css/xterm.css') }}"/>
<tr> <script src="{{ url_for('static', filename='node_modules/xterm/lib/xterm.js') }}"></script>
<td width="20%" height="90%"> <script src="{{ url_for('static', filename='node_modules/xterm-addon-fit/lib/xterm-addon-fit.js') }}"></script>
<div id="console"></div> <script>
</td> document.getElementsByClassName("content")[0].style.padding = "0 0"
<td width="80%"> </script>
<iframe src="/novnc/vnc.html?resize=scale&path=novnc/websockify&autoconnect=true&view_only" width="100%" height="100%" frameborder="0"></iframe> <div style="height: 100%">
</td>
</tr>
</table>
<div id="console" style="height: 100%; width: 20%; float:left;"></div>
<div style="height: 100%; width: 80%; float:left;">
<iframe src="/novnc/vnc.html?resize=scale&path=novnc/websockify&autoconnect=true&view_only"
width="100%" height="100%" frameborder="0"></iframe>
</div>
</div>
<script> <script>
const consoleElement = document.getElementById('console'); var term = new Terminal();
const fitAddon = new FitAddon.FitAddon();
term.loadAddon(fitAddon);
term.open(document.getElementById('console'));
fitAddon.fit()
addEventListener("transitionend", (event) => {
fitAddon.fit()
});
document.getElementById("console").style.textAlign = "left"
const eventSource = new EventSource('/stream'); const eventSource = new EventSource('/stream');
eventSource.onmessage = (event) => { eventSource.onmessage = (event) => {
document.getElementById("console").innerHTML = event.data + document.getElementById("console").innerHTML term.writeln(event.data)
}; };
addEventListener("resize", (event) => {
fitAddon.fit()
});
</script> </script>
{% endif %} {% endif %}

55
V6.py
View File

@ -54,8 +54,12 @@ def play_quiz2(override=10) -> None:
custom_sleep(uniform(3, 5)) custom_sleep(uniform(3, 5))
js_function = """ js_function = """
function get_correct_answer(){ function get_correct_answer(){
function br(n) { for (var r, t = 0, i = 0; i < n.length; i++)t += n.charCodeAt(i); return r = parseInt(_G.IG.substr(_G.IG.length - 2), 16), t += r, t.toString() } // Ms check function function br(n) {
function namedRAValue() { //allow calls to getRAvalue for (var r, t = 0, i = 0; i < n.length; i++)
t += n.charCodeAt(i);
return r = parseInt(_G.IG.substr(_G.IG.length - 2), 16), t += r, t.toString()
} // Ms check function
function namedRAValue() { //allow calls to getRAValue
return _w.getRAValue() return _w.getRAValue()
}; };
if (br(document.getElementById("rqAnswerOption0").attributes["data-option"].value) == namedRAValue()){ if (br(document.getElementById("rqAnswerOption0").attributes["data-option"].value) == namedRAValue()){
@ -259,7 +263,7 @@ def promo():
if not elm: if not elm:
break break
if i > 3: if i > 3:
log_error("plus de 3 promo cards, probablement une pa skipable") log_error("There is more than 3 promo cards, most likely an unskippable one.")
try: try:
driver.find_element(By.CSS_SELECTOR, driver.find_element(By.CSS_SELECTOR,
'i[class="mee-icon pull-left icon mee-icon-Cancel ng-scope"]').click() 'i[class="mee-icon pull-left icon mee-icon-Cancel ng-scope"]').click()
@ -270,7 +274,7 @@ def promo():
elm.click() elm.click()
except Exception as e: except Exception as e:
driver.execute_script("arguments[0].click();", elm) driver.execute_script("arguments[0].click();", elm)
warning(f"that should't be there (promo), but the workarround seemed to work {e}") warning(f"that shouldn't be there (promo), but the workaround seemed to work {e}")
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])
@ -279,15 +283,15 @@ def promo():
else: else:
try: try:
spotify(driver) spotify(driver)
except: except Exception as e:
warning("no new windows") warning(f"no new windows {format_error(e)}")
driver.get("https://rewards.bing.com") driver.get("https://rewards.bing.com")
driver.refresh() driver.refresh()
custom_sleep(3) custom_sleep(3)
# Find out which type of action to do # Find out which type of action to do
def try_play(nom="inconnu"): def try_play(nom="unknown"):
driver = config.WebDriver.driver driver = config.WebDriver.driver
rgpd_popup(config) rgpd_popup(config)
@ -341,7 +345,7 @@ def try_play(nom="inconnu"):
elif "rqQuestionState" in driver.page_source: elif "rqQuestionState" in driver.page_source:
number = driver.page_source.count("rqAnswerOption") number = driver.page_source.count("rqAnswerOption")
warning(f"recovery détecté. quiz : {number}") warning(f"recovery detected. quiz : {number}")
play(number - 1) play(number - 1)
else: else:
@ -457,26 +461,22 @@ def bing_pc_search(override=randint(35, 40)):
log_error(f"clear la barre de recherche - {format_error(e)}") # what is this message ??? todo log_error(f"clear la barre de recherche - {format_error(e)}") # what is this message ??? todo
# Sends points to database, discord and whatever service you want # Sends current account's points to database
# todo: refactor
def log_points(): def log_points():
driver = config.WebDriver.driver driver = config.WebDriver.driver
account = config.UserCredentials.get_mail() account = config.UserCredentials.get_mail()
def get_points():
driver.get("https://rewards.bing.com") driver.get("https://rewards.bing.com")
custom_sleep(1) custom_sleep(1)
wait_until_visible(By.CSS_SELECTOR, 'span[mee-element-ready="$ctrl.loadCounterAnimation()"]', browser=driver) wait_until_visible(By.CSS_SELECTOR, 'span[mee-element-ready="$ctrl.loadCounterAnimation()"]', browser=driver)
try: try:
point = search('availablePoints\":([\d]+)', driver.page_source)[1] points = search('availablePoints\":([\d]+)', driver.page_source)[1]
except Exception as e: except Exception as err:
log_error( log_error(
f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(e)}") f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(err)}")
error("Can't get points.") error(f"Can't get points. {format_error(err)}")
return -1 return -1
return point
points = get_points()
custom_sleep(uniform(3, 20)) custom_sleep(uniform(3, 20))
account_name = account.split("@")[0] account_name = account.split("@")[0]
@ -509,15 +509,15 @@ def fidelity():
try: try:
button_text = search('<span class="pull-left margin-right-15">([^<^>]+)</span>', button_text = search('<span class="pull-left margin-right-15">([^<^>]+)</span>',
card_elem.get_attribute("innerHTML"))[1] card_elem.get_attribute("innerHTML"))[1]
bouton_card = driver.find_element(By.XPATH, f'//span[text()="{button_text}"]') button_card = driver.find_element(By.XPATH, f'//span[text()="{button_text}"]')
bouton_card.click() button_card.click()
except Exception as e1: except Exception as e1:
try: try:
recover_elem = driver.find_element(By.XPATH, recover_elem = driver.find_element(By.XPATH,
'/html/body/div[1]/div[2]/main/div[2]/div[2]/div[7]/div[3]/div[1]/a') '/html/body/div[1]/div[2]/main/div[2]/div[2]/div[7]/div[3]/div[1]/a')
recover_elem.click() recover_elem.click()
except Exception as e2: except Exception as e2:
log_error(f"fidélité - double erreur - e1 : {format_error(e1)} - e2 {format_error(e2)}") log_error(f"Fidelity: Multiples error - 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[2]) driver.switch_to.window(driver.window_handles[2])
@ -534,17 +534,16 @@ def fidelity():
if driver.current_url != "https://rewards.bing.com": if driver.current_url != "https://rewards.bing.com":
driver.get("https://rewards.bing.com") driver.get("https://rewards.bing.com")
try: try:
pause = driver.find_element(By.CSS_SELECTOR, pause = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]')
f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]') # mettre le truc en pause
pause.click() pause.click()
except Exception as e: except Exception as e:
error(f"erreur lors du click de pause: probablement pas de cartes {e}") error(f"Error while clicking pause. Probably no cards. {e}")
return "no cards" return "no cards"
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]') cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
nb_cartes = len(cartes) nb_cartes = len(cartes)
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]') checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
for i in range(nb_cartes): for i in range(nb_cartes):
cartes[i].click() # affiche la bonne carte cartes[i].click()
checked_txt = checked_list_all[i].get_attribute("innerHTML") checked_txt = checked_list_all[i].get_attribute("innerHTML")
ok = checked_txt.count("StatusCircleOuter checkmark") ok = checked_txt.count("StatusCircleOuter checkmark")
total = checked_txt.count("StatusCircleOuter") total = checked_txt.count("StatusCircleOuter")
@ -652,8 +651,8 @@ def json_start(json_entry, cred: UserCredentials):
config.set_display(SmartDisplay(backend="xvnc", size=(1920, 1080), rfbport=2345, color_depth=24)) config.set_display(SmartDisplay(backend="xvnc", size=(1920, 1080), rfbport=2345, color_depth=24))
config.display.start() config.display.start()
account_id = 0
for account_id in range(5): while config.UserCredentials.is_valid():
start = False start = False
for action in ["unban", "tout", "pc", "mobile", "daily"]: for action in ["unban", "tout", "pc", "mobile", "daily"]:
try: try:
@ -664,6 +663,7 @@ def json_start(json_entry, cred: UserCredentials):
pass pass
if start: if start:
config.WebDriver.set_pc_driver(create_driver()) config.WebDriver.set_pc_driver(create_driver())
config.WebDriver.switch_to_driver("PC")
driver = config.WebDriver.driver driver = config.WebDriver.driver
try: try:
if str(account_id) in json_entry["unban"]: if str(account_id) in json_entry["unban"]:
@ -714,6 +714,7 @@ def json_start(json_entry, cred: UserCredentials):
error(f"CustomStart {e}") error(f"CustomStart {e}")
driver.close() driver.close()
cred.next_account() cred.next_account()
account_id += 1
config.display.stop() config.display.stop()
@ -757,6 +758,7 @@ def log_error(msg):
def check_updated(): def check_updated():
debug(f"updated: {config.has_been_updated()}")
if config.has_been_updated(): if config.has_been_updated():
config.discord.wh.send(f"Updated to {config.version}", username="update", config.discord.wh.send(f"Updated to {config.version}", username="update",
avatar_url="https://cdn-icons-png.flaticon.com/512/1688/1688988.png") avatar_url="https://cdn-icons-png.flaticon.com/512/1688/1688988.png")
@ -765,7 +767,6 @@ def check_updated():
if __name__ == "__main__": if __name__ == "__main__":
config = Config(args) config = Config(args)
check_updated() check_updated()
match config.start: match config.start:
case "json": case "json":
json_start(config.json_entry, config.UserCredentials) json_start(config.json_entry, config.UserCredentials)

View File

@ -16,4 +16,4 @@ services:
- "2345:2345" - "2345:2345"
shm_size: 2gb shm_size: 2gb
volumes: volumes:
- "./:/data" - "./data/:/data"

View File

@ -1,8 +1,7 @@
from discord import Embed, Colour, File from discord import Embed, Colour, File
from modules.Classes.Config import Config from modules.Classes.Config import Config
from modules.Classes.UserCredentials import UserCredentials from modules.Tools.logger import error
from modules.Tools.logger import info, warning, error, critical
from modules.Tools.tools import format_error from modules.Tools.tools import format_error
@ -25,7 +24,7 @@ class DiscordLogger:
img.save("screenshot.png") img.save("screenshot.png")
embed = Embed( embed = Embed(
title="An Error has occured", title="An Error has occurred",
description=str(message), description=str(message),
colour=Colour.red(), colour=Colour.red(),
) )
@ -35,4 +34,3 @@ class DiscordLogger:
self.config.discord.wh.send(embed=embed, username="error", file=file, avatar_url=self.config.discord.avatar_url) self.config.discord.wh.send(embed=embed, username="error", file=file, avatar_url=self.config.discord.avatar_url)
self.config.discord.wh.send(username="error", file=File("page.html"), avatar_url=self.config.discord.avatar_url) self.config.discord.wh.send(username="error", file=File("page.html"), avatar_url=self.config.discord.avatar_url)

View File

@ -1,5 +1,3 @@
import json
from pyotp import TOTP from pyotp import TOTP
from modules.Tools.logger import debug, warning from modules.Tools.logger import debug, warning
@ -12,7 +10,8 @@ class UserCredentials:
self.total = 0 self.total = 0
def add(self, username: str, password: str, tfa: str = None): def add(self, username: str, password: str, tfa: str = None):
debug(f"adding account with data : Username: {username}, Password: {password}, 2FA: {'None' if tfa == '' else tfa}") debug(
f"adding account with data : Username: {username}, Password: {password}, 2FA: {'None' if tfa == '' else tfa}")
self.data[self.total] = { self.data[self.total] = {
"username": username, "username": username,
"password": password, "password": password,
@ -36,7 +35,10 @@ class UserCredentials:
def next_account(self): def next_account(self):
self.current += 1 self.current += 1
if self.is_valid():
debug(f"New credentials: {self.data[self.current]}") debug(f"New credentials: {self.data[self.current]}")
else:
debug("No new credentials.")
def is_valid(self): def is_valid(self):
return self.current < self.total return self.current < self.total

View File

@ -4,7 +4,7 @@ selenium
pillow pillow
pyvirtualdisplay pyvirtualdisplay
undetected_chromedriver undetected_chromedriver
requests requests>=2.31.0
flask flask
flask_sse flask_sse
EasyProcess EasyProcess

View File

@ -1,6 +0,0 @@
from modules.Classes.WordList import WordList
w = WordList("/usr/share/dict/french")
for i in range(100):
print(w.get_word())

View File

@ -1 +1 @@
v6.8.22 v6.8.38