Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from MaKraMc/DSLAutomate
Browse files Browse the repository at this point in the history
Update platform to dslquantify
  • Loading branch information
MaKraMc authored May 5, 2024
2 parents 9fc2aae + 57d86a1 commit e522083
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#The Platform you want to use (wdcvip.top/dslvip.com)
platform="dslvip.com"

#Your phone number without country code
WDCUsername="123456789"
WDCPassword="changeme"
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ services:
wdcautomate:
image: ghcr.io/makramc/wdcautomate:latest
environment:
#The Platform you want to use (wdcvip.top/dslvip.com)
- platform="dslvip.com"

#Your phone number with country code
- WDCUsername="123456789"
- WDCPassword="changeme"
Expand Down
9 changes: 7 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Automatically quantify in WDCquantify
# Automatically quantify in DLSQuantify/WDCquantify

This Image uses python selenium and Firefox to automatically sign you in and press the "Quantify" button for you on a specified time.\
To solve the login captcha we use tesseract ocr.
Expand All @@ -15,6 +15,9 @@ You need [docker engine](https://docs.docker.com/engine/install/) or docker desk
To run the container, specify your environment variables and run the image using docker:
> [!NOTE]
> The container runs in London time, just like WDC.
> [!NOTE]
> The container now uses dslvip.com by default. If you want to use wdcvip.top use environment variable `platform` like this: `"platform=wdcvip.top"`.
```bash
docker run -e "HOUR=20" -e "MINUTE=05" -e "WDCUsername=123456789" -e "WDCPassword=changeme" -d ghcr.io/makramc/wdcautomate:latest
```
Expand All @@ -34,6 +37,8 @@ services:
- MINUTE=05
- WDCUsername=123456789
- WDCPassword=yourpassword
#The Platform you want to use (wdcvip.top/dslvip.com)
- platform="dslvip.com"
```
# Contents
Expand All @@ -57,7 +62,7 @@ docker build -t wdcautomate:test .
```

# Disclamer
WDC Quantify is likely a pyramid scheme. Please do not "invest" your hard earned money on this platform.
DSL Quantify/WDC Quantify is likely a ponzi/pyramid scheme. Please do not "invest" your hard earned money on this platform.
I am of course not responsible for any losses on this platform or through my script.

I created this project as a proof of concept and to educate myself and learn about python and docker and had a lot of fun creating it. I do not know if I find the time/resources to maintain this if something ever changes on WDC's website/backend.
Expand Down
12 changes: 11 additions & 1 deletion src/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import re
from os import getenv

def init():
print(r"""
__ _______ _____ _ _
Expand All @@ -6,4 +9,11 @@ def init():
\ \/ \/ / | | | | | / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __/ _ \
\ /\ / | |__| | |____ / ____ \ |_| | || (_) | | | | | | (_| | || __/
\/ \/ |_____/ \_____/_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__\___|
""")
""")

# Get the platform environment variable
platform = getenv("PLATFORM") or "dslvip.com"
platform = re.sub(r'^https?://', '', platform)
platform = platform.split('/')[0]

return platform
32 changes: 24 additions & 8 deletions src/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

from captcha import solveCaptcha

def login(driver):
def login(driver, platform):

#Load the login page
print("Loading WDCVIP.top...", end='', flush=True)
print(f"Loading {platform}...", end='', flush=True)

try:
driver.get('https://wdcvip.top/index.html/pc.html#/login')
driver.get(f'https://{platform}/index.html/pc.html#/login')
except:
print("Error\nCould not load the page. Retrying...")
return False
Expand All @@ -34,7 +34,21 @@ def login(driver):

#Wait for the elements to load
print("Waiting for the whole webpage to load...", end='', flush=True)
HTMLUsername = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'input[type="text"][name="userName"]')))

#Wait for the loading spinner to disappear
WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'div.van-toast.van-toast--loading[style*="display: none"]')))

try:
#Wait for the login form to load
HTMLUsername = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'input[type="text"][name="userName"]')))
HTMLPassword = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'input[type="password"][name="password"]')))
HTMLCaptchaImage = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'img.vcode-img')))

except:
print("Error\nCould not find the login interface.")
driver.quit()
exit("Maybe you used the wrong platform URL? Exiting...")

print("Done")

print("Logging in...")
Expand All @@ -47,13 +61,11 @@ def login(driver):
HTMLUsername.send_keys(WDCUsername)

#Paste the password
HTMLPassword = driver.find_element(By.CSS_SELECTOR, 'input[type="password"][name="password"]')
HTMLPassword.send_keys(WDCPassword)

#Solve the captcha
#We will try to solve the using tessaract OCR. This has a success rate of about 85%.
#If it fails, we will retry the captcha 4 times.
HTMLCaptchaImage = driver.find_element(By.CSS_SELECTOR, 'img.vcode-img')
PNGCaptchaImage = HTMLCaptchaImage.screenshot_as_png

captcha = solveCaptcha(PNGCaptchaImage)
Expand All @@ -66,7 +78,11 @@ def login(driver):
return False
print("Did not recognize captcha. Retrying...")
#Request a new captcha by clicking the image
HTMLCaptchaImage.click()
try:
HTMLCaptchaImage.click()
except:
print("Could not request a new captcha. This can happen if there is a dialog blocking the captcha.\nRetrying...")
return False
#Wait for the new image to load
sleep(3)
PNGCaptchaImage = HTMLCaptchaImage.screenshot_as_png
Expand All @@ -93,7 +109,7 @@ def login(driver):
#Check if we got redirected. If not, we failed to login
if re.search(r'login', driver.current_url):
#Maybe there is hope if we manually navigate to the quantify page
driver.get('https://wdcvip.top/index.html/pc.html#/basic')
driver.get(f'https://{platform}/index.html/pc.html#/basic')
sleep(3)
if re.search(r'login', driver.current_url):
print("Login failed. Retrying...")
Expand Down
10 changes: 5 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
from init import init

def main():
init()
platform = init()
#Print info without new line
print("Loading Firefox...", end='', flush=True)
driver = loadFirefox()
print("Done")

#Try three times to login
logins = 1
isLoggedin = login(driver)
logins = 0
isLoggedin = False
while not isLoggedin:
isLoggedin = login(driver)
isLoggedin = login(driver, platform)
logins += 1
if logins == 3:
driver.quit()
exit("Could not login after 3 tries. Exiting...")

#Do the quantification
quantify(driver)
quantify(driver, platform)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions src/quantify.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import re

def quantify(driver):
def quantify(driver, platform):
print("Loading the quantify page...", end='', flush=True)
j = 0
#Navigate to the "quantify" page. Sometimes we need to try multiple times
while not driver.current_url == 'https://wdcvip.top/index.html/pc.html#/basic':
driver.get('https://wdcvip.top/index.html/pc.html#/basic')
while not driver.current_url == f'https://{platform}/index.html/pc.html#/basic':
driver.get(f'https://{platform}/index.html/pc.html#/basic')
sleep(1)
j += 1
if j == 5:
Expand Down

0 comments on commit e522083

Please sign in to comment.