forked from ankanban/Pokemon_Go_API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import requests | ||
from requests.packages.urllib3.exceptions import InsecureRequestWarning | ||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) | ||
|
||
api_url='https://pgorelease.nianticlabs.com/plfe/rpc' | ||
login_url='https://sso.pokemon.com/sso/oauth2.0/authorize?client_id=mobile-app_pokemon-go&redirect_uri=https%3A%2F%2Fwww.nianticlabs.com%2Fpokemongo%2Ferror' | ||
login_oauth='https://sso.pokemon.com/sso/oauth2.0/accessToken' | ||
|
||
proxies = { | ||
'http': 'http://127.0.0.1:8888', | ||
'https': 'http://127.0.0.1:8888', | ||
} | ||
use_proxy=False | ||
debug=True | ||
|
||
google=True | ||
pub=None | ||
|
||
s=requests.session() | ||
if use_proxy: | ||
s.proxies.update(proxies) | ||
s.verify=False | ||
s.headers.update({'User-Agent':'Niantic App'}) | ||
#public | ||
API_URL = 'https://pgorelease.nianticlabs.com/plfe/rpc' | ||
LOGIN_URL = 'https://sso.pokemon.com/sso/login?service=https%3A%2F%2Fsso.pokemon.com%2Fsso%2Foauth2.0%2FcallbackAuthorize' | ||
LOGIN_OAUTH = 'https://sso.pokemon.com/sso/oauth2.0/accessToken' | ||
PTC_CLIENT_SECRET = 'w8ScCUXJQc6kXKw8FiOhd8Fixzht18Dq3PEVkUCP5ZPxtgyWsbTvWHFLm2wNY0JR' | ||
|
||
SESSION = requests.session() | ||
SESSION.headers.update({'User-Agent': 'Niantic App'}) | ||
if use_proxy: | ||
SESSION.proxies.update(proxies) | ||
SESSION.verify = False | ||
import requests | ||
from requests.packages.urllib3.exceptions import InsecureRequestWarning | ||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) | ||
|
||
api_url='https://pgorelease.nianticlabs.com/plfe/rpc' | ||
login_url='https://sso.pokemon.com/sso/oauth2.0/authorize?client_id=mobile-app_pokemon-go&redirect_uri=https%3A%2F%2Fwww.nianticlabs.com%2Fpokemongo%2Ferror' | ||
login_oauth='https://sso.pokemon.com/sso/oauth2.0/accessToken' | ||
|
||
proxies = { | ||
'http': 'http://127.0.0.1:8888', | ||
'https': 'http://127.0.0.1:8888', | ||
} | ||
use_proxy=True | ||
debug=True | ||
distance=0 | ||
google=True | ||
pub=None | ||
|
||
s=requests.session() | ||
if use_proxy: | ||
s.proxies.update(proxies) | ||
s.verify=False | ||
s.headers.update({'User-Agent':'Niantic App'}) | ||
#public | ||
API_URL = 'https://pgorelease.nianticlabs.com/plfe/rpc' | ||
LOGIN_URL = 'https://sso.pokemon.com/sso/login?service=https%3A%2F%2Fsso.pokemon.com%2Fsso%2Foauth2.0%2FcallbackAuthorize' | ||
LOGIN_OAUTH = 'https://sso.pokemon.com/sso/oauth2.0/accessToken' | ||
PTC_CLIENT_SECRET = 'w8ScCUXJQc6kXKw8FiOhd8Fixzht18Dq3PEVkUCP5ZPxtgyWsbTvWHFLm2wNY0JR' | ||
|
||
SESSION = requests.session() | ||
SESSION.headers.update({'User-Agent': 'Niantic App'}) | ||
if use_proxy: | ||
SESSION.proxies.update(proxies) | ||
SESSION.verify = False | ||
DEBUG = True |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import logic | ||
import stops | ||
import api | ||
import time | ||
import pokemon_pb2 | ||
import location | ||
import config | ||
|
||
def start_private_show(access_token,ltype,loc): | ||
location.set_location(loc) | ||
print '[+] Token:',access_token[:40]+'...' | ||
prot1=logic.gen_first_data(access_token,ltype) | ||
local_ses=api.get_rpc_server(access_token,prot1) | ||
new_rcp_point='https://%s/rpc'%(local_ses.rpc_server,) | ||
work_stop(local_ses,new_rcp_point) | ||
|
||
def work_stop(local_ses,new_rcp_point): | ||
proto_all=logic.all_stops(local_ses) | ||
all_stops=api.use_api(new_rcp_point,proto_all) | ||
maps = pokemon_pb2.maps() | ||
maps.ParseFromString(all_stops) | ||
data_list=location.get_near(maps) | ||
data_list = sorted(data_list, key = lambda x: x[1]) | ||
print '[+] found: %s Pokestops within %s m'%(len(data_list),config.distance,) | ||
if local_ses is not None and data_list is not None: | ||
print '[+] starting show' | ||
for t in data_list: | ||
print '[!] farming pokestop..' | ||
work_with_stops(t,local_ses.ses,new_rcp_point) | ||
|
||
def work_with_stops(current_stop,ses,new_rcp_point): | ||
Kinder= logic.gen_stop_data(ses,current_stop) | ||
tmp_api=api.use_api(new_rcp_point,Kinder) | ||
if tmp_api is not None: | ||
map = pokemon_pb2.map() | ||
map.ParseFromString(tmp_api) | ||
st= map.sess[0].status | ||
if st==4: | ||
print "[!] +%s"%map.sess[0].amt | ||
elif st==3: | ||
print "[!] used" | ||
elif st==2: | ||
print "[!] charging" | ||
elif st==1: | ||
print "[!] teleport.." | ||
time.sleep(14) | ||
work_with_stops(current_stop,ses,new_rcp_point) | ||
else: | ||
print "[?]:",st | ||
else: | ||
print '[-] tmp_api empty' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import pokemon_pb2 | ||
import base64 | ||
import struct | ||
import config | ||
from math import radians, cos, sin, asin, sqrt | ||
from geopy.distance import vincenty | ||
from geopy.geocoders import GoogleV3 | ||
|
||
COORDS_LATITUDE = 0 | ||
COORDS_LONGITUDE = 0 | ||
COORDS_ALTITUDE = 0 | ||
FLOAT_LAT = 0 | ||
FLOAT_LONG = 0 | ||
|
||
def get_location_coords(): | ||
return (COORDS_LATITUDE, COORDS_LONGITUDE, COORDS_ALTITUDE) | ||
|
||
def set_location(location_name): | ||
geolocator = GoogleV3() | ||
loc = geolocator.geocode(location_name) | ||
|
||
print('[!] Your given location: {}'.format(loc.address.encode('utf-8'))) | ||
print('[!] lat/long/alt: {} {} {}'.format(loc.latitude, loc.longitude, loc.altitude)) | ||
set_location_coords(loc.latitude, loc.longitude, loc.altitude) | ||
|
||
def set_location_coords(lat, long, alt): | ||
global COORDS_LATITUDE, COORDS_LONGITUDE, COORDS_ALTITUDE | ||
global FLOAT_LAT, FLOAT_LONG | ||
FLOAT_LAT = lat | ||
FLOAT_LONG = long | ||
COORDS_LATITUDE = f2i(lat) | ||
COORDS_LONGITUDE = f2i(long) | ||
COORDS_ALTITUDE = f2i(alt) | ||
|
||
def i2f(int): | ||
return struct.unpack('<Q', struct.pack('<d', int))[0] | ||
|
||
def f2h(float): | ||
return hex(struct.unpack('<Q', struct.pack('<d', float))[0]) | ||
|
||
def f2i(float): | ||
return struct.unpack('<Q', struct.pack('<d', float))[0] | ||
|
||
def l2f(float): | ||
return struct.unpack('d', struct.pack('Q', int(bin(float), 0)))[0] | ||
|
||
def h2f(hex): | ||
return struct.unpack('<d', struct.pack('<Q', int(hex,16)))[0] | ||
|
||
def get_near(map): | ||
ms=[] | ||
for cell in [map]: | ||
for block in cell.b: | ||
for obj in block.c: | ||
for stop in obj.s: | ||
if is_near(stop.lat,stop.lon,COORDS_LATITUDE,COORDS_LONGITUDE): | ||
ms.append((stop.name,stop.lat,stop.lon)) | ||
return ms | ||
|
||
def is_near(locx,locy,myx,myy): | ||
tmp1 = (l2f(locx), l2f(locy)) | ||
tmp2 = (l2f(myx), l2f(myy)) | ||
res=vincenty(tmp1, tmp2).meters | ||
return res<config.distance |
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