Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew17-21 committed Apr 24, 2021
1 parent 5fb8b1c commit 2417aa2
Show file tree
Hide file tree
Showing 12 changed files with 1,043 additions and 2 deletions.
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# Newegg-Shuffle
Python module(s) to help with the Newegg raffle.
# Newegg Shuffle
Python module(s) to help you with the Newegg raffle

# How to use
```
$ git clone https://github.com/Matthew17-21/Newegg-Shuffle
$ cd Newegg-Raffle
$ pip3 install -r requirements.txt
$ python3 main.py
```
- **Checkout the [file structure](https://github.com/Matthew17-21/Newegg-Shuffle#file-structure) below on how to enter & change data**

# File Structure
### /data
- emails.txt
* Enter the emails you'd like to create accounts for.
- proxies.txt
* Proxies that'll be used when creating accounts.
- settings.json

| Key | Type | Description | Options |
| :--:| :---:| :---------: | :-----: |
| output_filename | String | File name where the sessions will be saved | - |
| version | String | Type of captcha you want to solve to create the account | v2 or v3 |
| captcha_solver | String or int | Captcha solving site | Checkout the [documentation.](https://github.com/Matthew17-21/Captcha-Tools#how-to-use) |
| keys | dict | dict containing keys to solving sites | - |
| generate_random | bool | Should the program generate random password. | `true` or `false` |
| choices | array | Array of password choices | - |


### /newegg/*
- Contains the core software code.

# Recommendations
1. **MAKE SURE YOU STORE YOUR SESSIONS SOMEWHERE**
2. Althought not completely necessary, but you should add/delete/randomify events for accertify.
3. Make sure iOS app version is up to date
4. Handle exceptions better
* There are some exceptions, such as those from [captchatools](https://github.com/Matthew17-21/Captcha-Tools#exceptions), that I did not handle.
5. Use proxies (But they aren't required to run the script)
6. If V2 Recaptcha pops up again, use that over V3


# Notes
- Failed captchas are normal.
- Newegg disabled their V2 Recaptcha for creating accounts, making V3 the only option. Because all 3rd party solvers aren't the best at V3 captchas, there will be lots of failed captchas.
* I recommend using anticaptcha for V3, but Capmonster & 2Captcha is also available.
- Only tested on Python 3.7
* *Should* work on other versions, but I can't promise anything.
- This is intended for devs, so try not to change too much code as it might break something.
- This isn't a reflection of how I actually write code so pls don't judge too hard :joy:
* I've been writing in Go lately, hence the structure of the whole thing.
- If you want to create accounts via mobile, change line 79 in `main.py` from `desktop.Create_Account(self, email)` to `mobile.Create_Account(self, email)`
* And vice versa
- There are lots of ways to make this better, cleaner and better on memory. If I find till I'll update this repo.

# FAQ
1. Does this work out of the box?
* Yes, however, you do need change some info.
2. Can I use these accounts for the raffle?
* Yes.
3. Should I use the mobile or desktop module?
* Use the same mode you'll be using to enter raffles.
* Entering raffle via app, use the mobile version to create account.
* Entering raffle via desktop, use the desktop version to create account.
4. How do I use the captchatools?
* Checkout the [documentation.](https://github.com/Matthew17-21/Captcha-Tools)

# Success
![Genning](https://i.imgur.com/lvrTp36.png)
![Success](https://i.imgur.com/8csUoqR.png)

# TO DO
1. [] Clean up code
2. [] Update documentation
1 change: 1 addition & 0 deletions data/emails.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name@domain.com
2 changes: 2 additions & 0 deletions data/proxies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IP:PORT
IP:PORT:USER:PASS
22 changes: 22 additions & 0 deletions data/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"output_filename": "Successfully created accounts.log",
"captcha": {
"version": "v3",
"captcha_solver": "anticaptcha",
"keys": {
"2captcha": "YOUR 2CAPTCHA KEY",
"capmonster": "YOUR CAPMONSTER KEY",
"anticaptcha": "YOUR ANTICAPTCHA KEY"
}
},
"password": {
"generate_random": true,
"choices": [
"NotARandomPassword123!",
"Ifgenerate_randomIsSetToTrue...NoneOfTheseGetUsed!1!",
"Also,IfYouHaventNoticed,!!1!",
"ThereNeedsToBeANumberAndSpecialChar!12!"
]
}

}
79 changes: 79 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import sys
try:
import logging
import json
import threading
from threading import Semaphore
import colorama
from colorama import Fore
from colorama import init
colorama.init()
init(autoreset=True)
from captchatools import captcha_harvesters
from newegg.create_account import desktop, mobile, static_data
except ModuleNotFoundError:
print("Make sure you ran pip3 install -r requirements.txt")
sys.exit(0)


with open("./data/settings.json") as settingsFile:
settings = json.load(settingsFile)
logging.basicConfig(filename=settings["output_filename"], level=logging.INFO)

class Newegg:
def __init__(self):
self.screenlock = Semaphore(value=1)

# Load config
self.settings = settings
if settings["captcha"]["captcha_solver"] == 1 or str( settings["captcha"]["captcha_solver"]).lower() == "capmonster":
api_key = settings["captcha"]["keys"]["capmonster"]
elif settings["captcha"]["captcha_solver"] == 2 or str( settings["captcha"]["captcha_solver"]).lower() == "anticaptcha":
api_key = settings["captcha"]["keys"]["anticaptcha"]
elif settings["captcha"]["captcha_solver"] == 3 or str( settings["captcha"]["captcha_solver"]).lower() == "2captcha":
api_key = settings["captcha"]["keys"]["2captcha"]

if settings["captcha"]["version"] == "v3":
sitekey = static_data.v3_sitekey
elif settings["captcha"]["version"] == "v3":
sitekey = static_data.v2_sitekey


self.captcha_solver = captcha_harvesters(
solving_site=settings["captcha"]["captcha_solver"],
api_key=api_key,
sitekey=sitekey,
captcha_url="https://secure.newegg.com/identity/signup?tk=",
min_score=0.7, action="Register", captcha_type=settings["captcha"]["version"]
)

# Start the bot.
self.main()

def main(self):
num_tasks = eval(input(Fore.BLUE + "Enter amount of tasks at a time: " + Fore.WHITE + " "))
self.sema = threading.Semaphore(value=num_tasks)
threads = []

with open("./data/emails.txt") as email_file:
for line in email_file.readlines():
email = line.split(':')[0].strip("\n")
self.sema.acquire()
thread = threading.Thread(target=self.create,args=(email,))
threads.append(thread)
thread.start()

def create(self,email):
task = desktop.Create_Account(self, email)
data = task.start()

# Log Data
logging.info("{}:{}".format(
email,
json.dumps(data)
))
self.sema.release()



Newegg()
174 changes: 174 additions & 0 deletions newegg/create_account/Accertify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
import base64
import random
import time
import string
import urllib.parse
import json


def get_payload(signupURL):
UBASessionID = generate_uba_sessionID()
pageID = random.randint(1000000000000000, 9999999999999999)
events = get_events(signupURL, pageID, UBASessionID)

return {
"eventSource":"web", # <--- Static
"deviceTransactionID":"NEWEGG{}".format(''.join(random.choices(string.digits, k=21))), #Accertify2.js
"uBAID": ''.join(random.choices(string.ascii_lowercase + string.digits, k=36)), #Accertify2.js <---- Need to find how to scrape beacon
"uBAEvents":events,
"uBASessionID":UBASessionID,
"pageID":pageID
}


def generate_uba_sessionID():
temp = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
temp2 = ""
t = round(time.time()) * 1000
for _ in range(len(temp)):
e = int((t + 16 * random.uniform(0, 1)) % 16) | 0
temp2 += hex(e)[2:]
return temp2

def get_events(singupURL, pageID, sessionID):
timeMS = round(time.time() * 1000)
timeMS2 = round(time.time() * 1000)
EVENTS = [
{
"loc":singupURL,
"pid":pageID,
"sid":None,
"bsid":sessionID,
"ts":timeMS,
"type":"mtrk",
"pay":{
"t":timeMS,
"fd":1044.27,
"sd":1557.69,
"bb":[
random.randint(500,800),
random.randint(100,300),
random.randint(1000,1400),
random.randint(100,300)
],
"s":[
{
"t":0,
"x":1324,
"y":274,
"fd":945.72,
"sd":829.03,
"c":15,
"a":9139.97,
"mx":119066.74,
"mn":62.5
},
{
"t":260,
"x":771,
"y":613,
"fd":652.69,
"sd":648.64,
"c":24,
"a":2455.57,
"mx":8766.41,
"mn":90.91
},
{
"t":551,
"x":769,
"y":693,
"fd":80.32,
"sd":80.02,
"c":22,
"a":330.8,
"mx":1004.99,
"mn":83.33
}
],
"c":50,
"sc":3
}
},
{
"loc":singupURL,
"pid":pageID,
"sid":None,
"bsid":sessionID,
"ts":timeMS2,
"type":"mclk",
"pay":{
"t":timeMS2,
"m":{
"_":[
{
"t":0,
"b":0,
"x":random.randint(500,800),
"y":random.randint(500,800)
}
]
},
"c":1
}
},
{
"loc":singupURL,
"pid":pageID,
"sid":None,
"bsid":sessionID,
"ts":round(time.time() * 1000),
"type":"meta",
"pay":{
"t":round(time.time() * 1000),
"m":{
"_":{
"i":None,
"n":None,
"t":"submit"
}
}
}
}
]

# Start time will be a time before the current time to make it seem more real
# The ragne will be between 30s-60s
start = round(time.time()) - random.randint(30,60)
second = start + random.randint(3,10)
third = second + random.randint(3,10)

startTime = start * 1000
secondTime = second * 1000
thirdTime = third * 1000

# Update Location, timestamp, pid & bsid
EVENTS[0]["ts"] = startTime
EVENTS[0]["pay"]["t"] = startTime

EVENTS[1]["ts"] = secondTime
EVENTS[1]["pay"]["t"] = secondTime

EVENTS[2]["ts"] = thirdTime
EVENTS[2]["pay"]["t"] = thirdTime


# URL encode raw array
urlEncoded = encode(str(json.dumps(EVENTS))).encode("utf-8")
b64Encoded = base64.b64encode(urlEncoded).decode("utf-8")
semi = {"ts": round( time.time() * 1000 ), "pay": b64Encoded}
b64Encoded2 = base64.urlsafe_b64encode(json.dumps(semi).encode()).decode()

semiFinal = {
"ts":round( time.time() * 1000 ),
"pays":[
b64Encoded2,
None,
None
]
}
final = base64.urlsafe_b64encode(json.dumps(semiFinal).encode()).decode()
return final

def encode(string):
return urllib.parse.quote(string)
Loading

0 comments on commit 2417aa2

Please sign in to comment.