-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
77 lines (68 loc) · 2.26 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from multiprocessing.sharedctypes import Value
from string import ascii_uppercase, digits
from json import JSONDecodeError
from os import system, name
from random import choice
from requests import get
from sys import maxsize
from time import sleep
import bcolors
import config
used_vanity = []
class amountError(Exception):
pass
def clearConsole():
command = 'clear'
if name in ('nt', 'dos'):
command = 'cls'
system(command)
def startupCheck():
check = get(f'https://api.steampowered.com/ISteamUser/ResolveVanityURL/v1/?key={config.steamAPIKey}&vanityurl=')
if check.status_code == 403:
print(f'{bcolors.WAITMSG}Steam API Key is invalid. Please check config.py{bcolors.ENDC}')
exit()
def randomString(size=8, chars=ascii_uppercase + digits + '_' + '-'):
return ''.join(choice(chars) for _ in range(size))
def start(amount):
search(amount)
def search(amount):
for _ in range(maxsize**10):
vanityURL = randomString(amount)
if vanityURL in used_vanity:
vanityURL = randomString(amount)
try:
resp = get(f'http://api.steampowered.com/ISteamUser/ResolveVanityURL/v1/?key={config.steamAPIKey}&vanityurl={vanityURL}').json()
except JSONDecodeError:
start(amount)
except ConnectionError:
start(amount)
if resp['response']['success'] == 1:
print(f'{bcolors.ERRMSG}Vanity URL Taken: {vanityURL}{bcolors.ENDC}')
used_vanity.append(vanityURL)
else:
print(f'{bcolors.OKMSG}Avalible Vanity URL found: {vanityURL}{bcolors.ENDC}')
print("Would you like to keep searching? (Y/N)")
answer = input()
if answer not in ['y', 'n', 'Y', 'N'] or answer in ['N', 'n']:
print("Aborting!")
break
sleep(config.delay)
def main():
clearConsole()
startupCheck()
try:
print('How many characters would you like to search for? (3-32)')
amount = int(input())
if amount > 32 or amount < 3:
raise amountError
except ValueError:
clearConsole()
print(f'How many characters would you like to search for? (3-32) {bcolors.IMPORTANT}(NUMBERS ONLY){bcolors.ENDC}')
amount = int(input())
except amountError:
clearConsole()
print(f'How many characters would you like to search for? {bcolors.IMPORTANT}(3-32){bcolors.ENDC}')
amount = int(input())
finally:
start(amount)
main()