Skip to content

Commit

Permalink
Generate unique device info. (#1769)
Browse files Browse the repository at this point in the history
* Generate unique device info.

* Credit to Noctem.
  • Loading branch information
sebastienvercammen committed Jan 27, 2017
1 parent 8cdbbb6 commit c78556c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pogom/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

from .models import parse_map, GymDetails, parse_gyms, MainWorker, WorkerStatus
from .fakePogoApi import FakePogoApi
from .utils import now, get_tutorial_state, complete_tutorial
from .utils import (now, get_tutorial_state, complete_tutorial,
generate_device_info)
from .transform import get_new_coords
import schedulers

Expand Down Expand Up @@ -711,7 +712,8 @@ def search_worker_thread(args, account_queue, account_failures,
if args.mock != '':
api = FakePogoApi(args.mock)
else:
api = PGoApi()
device_info = generate_device_info()
api = PGoApi(device_info=device_info)

# New account - new proxy.
if args.proxy:
Expand Down
48 changes: 48 additions & 0 deletions pogom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pprint
import time
import random
from uuid import uuid4
from s2sphere import CellId, LatLng

from . import config
Expand Down Expand Up @@ -875,3 +876,50 @@ def complete_tutorial(api, account, tutorial_state):
account['username'])
time.sleep(random.uniform(2, 4))
return True


# Generate random device info.
# Original by Noctem.
IPHONES = {'iPhone5,1': 'N41AP',
'iPhone5,2': 'N42AP',
'iPhone5,3': 'N48AP',
'iPhone5,4': 'N49AP',
'iPhone6,1': 'N51AP',
'iPhone6,2': 'N53AP',
'iPhone7,1': 'N56AP',
'iPhone7,2': 'N61AP',
'iPhone8,1': 'N71AP',
'iPhone8,2': 'N66AP',
'iPhone8,4': 'N69AP',
'iPhone9,1': 'D10AP',
'iPhone9,2': 'D11AP',
'iPhone9,3': 'D101AP',
'iPhone9,4': 'D111AP'}


def generate_device_info():
device_info = {'device_brand': 'Apple', 'device_model': 'iPhone',
'hardware_manufacturer': 'Apple',
'firmware_brand': 'iPhone OS'}
devices = tuple(IPHONES.keys())

ios8 = ('8.0', '8.0.1', '8.0.2', '8.1', '8.1.1',
'8.1.2', '8.1.3', '8.2', '8.3', '8.4', '8.4.1')
ios9 = ('9.0', '9.0.1', '9.0.2', '9.1', '9.2', '9.2.1',
'9.3', '9.3.1', '9.3.2', '9.3.3', '9.3.4', '9.3.5')
ios10 = ('10.0', '10.0.1', '10.0.2', '10.0.3', '10.1', '10.1.1')

device_info['device_model_boot'] = random.choice(devices)
device_info['hardware_model'] = IPHONES[device_info['device_model_boot']]
device_info['device_id'] = uuid4().hex

if device_info['hardware_model'] in ('iPhone9,1', 'iPhone9,2',
'iPhone9,3', 'iPhone9,4'):
device_info['firmware_type'] = random.choice(ios10)
elif device_info['hardware_model'] in ('iPhone8,1', 'iPhone8,2',
'iPhone8,4'):
device_info['firmware_type'] = random.choice(ios9 + ios10)
else:
device_info['firmware_type'] = random.choice(ios8 + ios9 + ios10)

return device_info

0 comments on commit c78556c

Please sign in to comment.