Skip to content

Commit

Permalink
fixed api_req()_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mila432 committed Jul 16, 2016
1 parent 0e874c3 commit 4005354
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 92 deletions.
184 changes: 93 additions & 91 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,92 +1,94 @@
import base64
import time
import re
from random import randint
import random


import config
import login
import public
import logins
try:
import pokemon_pb2
import logic
import stops
import api
config.pub=False
except:
import public_proto_pb2
config.pub=True

def generate_random_long():
return long(random.choice(range(0,10000000)))

#https://github.com/tejado
def start_work(access_token,ltype):
print '[+] Token:',access_token[:40]+'...'
api_endpoint =public.get_api_endpoint(access_token,ltype)
if api_endpoint is not None:
print('[+] Received API endpoint: {}'.format(api_endpoint))
profile = public.get_profile(api_endpoint, access_token)
if profile is not None:
print('[+] Login successful')

profile = profile.payload[0].profile
print('[+] Username: {}'.format(profile.username))

creation_time = datetime.fromtimestamp(int(profile.creation_time)/1000)
print('[+] You are playing Pokemon Go since: {}'.format(
creation_time.strftime('%Y-%m-%d %H:%M:%S'),
))
print('[+] Poke Storage: {}'.format(profile.poke_storage))
print('[+] Item Storage: {}'.format(profile.item_storage))
for curr in profile.currency:
print('[+] {}: {}'.format(curr.type, curr.amount))
else:
print('[-] Ooops...')
else:
print('[-] RPC server offline')
exit()

def start_private_show(access_token,ltype):
print '[+] Token:',access_token[:40]+'...'
prot1=logic.gen_first_data(access_token)
new_api= api.get_rpc_server(access_token,prot1)
login_data=api.use_api(new_api,prot1)
cis= api.get_session(login_data)
#for t in stops.get_static():
#print '[!] farming pokestop..'
#walking=logic.simulate_walking(cis,t)
#use_api(new_api,walking)
#time.sleep(1)
#Kinder_pre=logic.gen_stop_data_pre(cis,t)
#use_api(new_api,Kinder_pre)
#Kinder= logic.gen_stop_data(cis,t)
#api.use_api(new_api,Kinder)
#time.sleep(3)

def main():
if config.google:
print '[!] Using google as login..'
google_data= login.login_google(logins.google_mail,logins.google_password)
if google_data is not None:
access_token=google_data['id_token']
ltype='google'
else:
access_token=None
else:
print '[!] I am a poketrainer..'
access_token= login.login_pokemon(logins.pokemon_username,logins.pokemon_password)
ltype='ptc'
if access_token is not None:
print '[!] using:',config.pub
if config.pub:
start_work(access_token,ltype)
else:
start_private_show(access_token,ltype)
else:
print '[-] access_token bad'

if __name__ == '__main__':
import base64
import time
import re
import random


import config
import login
import public
import logins
try:
import pokemon_pb2
import logic
import stops
import api
config.pub=False
except:
import public_proto_pb2
config.pub=True

def generate_random_long():
return long(random.choice(range(0,10000000)))

#https://github.com/tejado
def start_work(access_token,ltype):
print '[+] Token:',access_token[:40]+'...'
api_endpoint =public.get_api_endpoint(access_token,ltype)
if api_endpoint is not None:
print('[+] Received API endpoint: {}'.format(api_endpoint))
profile = public.get_profile(api_endpoint, access_token,ltype)
if profile is not None:
print('[+] Login successful')

profile = profile.payload[0].profile
print('[+] Username: {}'.format(profile.username))

creation_time = datetime.fromtimestamp(int(profile.creation_time)/1000)
print('[+] You are playing Pokemon Go since: {}'.format(
creation_time.strftime('%Y-%m-%d %H:%M:%S'),
))
print('[+] Poke Storage: {}'.format(profile.poke_storage))
print('[+] Item Storage: {}'.format(profile.item_storage))
for curr in profile.currency:
print('[+] {}: {}'.format(curr.type, curr.amount))
else:
print('[-] Ooops...')
else:
print('[-] RPC server offline')
exit()

def start_private_show(access_token,ltype):
print '[+] Token:',access_token[:40]+'...'
prot1=logic.gen_first_data(access_token)
new_rcp_point,hash,lv,id= api.get_rpc_server(access_token,prot1)
print new_rcp_point
exit()
login_data=api.use_api(new_rcp_point,prot1)
#cis= api.get_session(login_data)
if ses is not None:
for t in stops.get_static():
print '[!] farming pokestop..'
#walking=logic.simulate_walking(cis,t)
#api.use_api(new_rcp_point,walking)
#time.sleep(1)
#Kinder_pre=logic.gen_stop_data_pre(cis,t)
#use_api(new_rcp_point,Kinder_pre)
Kinder= logic.gen_stop_data(ses,t)
api.use_api(new_rcp_point,Kinder)
time.sleep(3)

def main():
if config.google:
print '[!] Using google as login..'
google_data= login.login_google(logins.google_mail,logins.google_password)
if google_data is not None:
access_token=google_data['id_token']
ltype='google'
else:
access_token=None
else:
print '[!] I am a poketrainer..'
access_token= login.login_pokemon(logins.pokemon_username,logins.pokemon_password)
ltype='ptc'
if access_token is not None:
print '[!] using:',config.pub
if config.pub:
start_work(access_token,ltype)
else:
start_private_show(access_token,ltype)
else:
print '[-] access_token bad'

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion public.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_api_endpoint(access_token,ltype):
return None


def get_profile(api_endpoint, access_token):
def get_profile(api_endpoint, access_token,ltype):
req = public_proto_pb2.RequestEnvelop()

req1 = req.requests.add()
Expand Down

0 comments on commit 4005354

Please sign in to comment.