def cfg_init(): log.info("Loading PGScout configuration...") parse_args() # MrMime config mrmime_cfg = { 'pgpool_system_id': args.pgpool_system_id, 'exception_on_captcha': True } if args.pgpool_url: mrmime_cfg['pgpool_url'] = args.pgpool_url log.info("Attaching to PGPool at {}".format(args.pgpool_url)) init_mr_mime(mrmime_cfg) # Collect hash keys args.hash_key_provider = CyclicResourceProvider() for hk in args.hash_key: args.hash_key_provider.add_resource(hk) # Collect proxies args.proxies = check_proxies(cfg_get('proxies_file')) args.proxy_provider = CyclicResourceProvider() for proxy in args.proxies: args.proxy_provider.add_resource(proxy)
def cfg_init(): log.info("Loading PGScout configuration...") parse_args() # MrMime config mrmime_cfg = { 'pgpool_system_id': args.pgpool_system_id, 'exception_on_captcha': True } if args.pgpool_url: mrmime_cfg['pgpool_url'] = args.pgpool_url log.info("Attaching to PGPool at {}".format(args.pgpool_url)) init_mr_mime(mrmime_cfg) # Collect hash keys args.hash_key_provider = CyclicResourceProvider() for hk in args.hash_key: args.hash_key_provider.add_resource(hk) # Collect proxies args.proxies = check_proxies(cfg_get('proxies_file')) args.proxy_provider = CyclicResourceProvider() for proxy in args.proxies: args.proxy_provider.add_resource(proxy) args.low_prio_pokemon = [] if args.low_prio_file: with open(args.low_prio_file) as f: args.low_prio_pokemon = read_pokemon_ids_from_file(f) if args.low_prio_pokemon: log.info("{} low priority Pokemon loaded from {}".format(len(args.low_prio_pokemon), args.low_prio_file)) t = Thread(target=watch_low_prio_file, args=(args.low_prio_file,)) t.daemon = True t.start()
def cfg_init(shadowcheck=False): global args log.info("Loading PGNumbra configuration.") parse_args() # Provide hash keys args.hash_key_provider = CyclicResourceProvider() for hk in args.hash_key: args.hash_key_provider.add_resource(hk) mrmime_cfg = {'pgpool_system_id': get_pgpool_system_id()} if args.pgpool_url: mrmime_cfg['pgpool_url'] = args.pgpool_url log.info("Attaching to PGPool at {}".format(args.pgpool_url)) if shadowcheck: # This test must include nearby Pokemon to work properly. args.include_nearby = True mrmime_cfg['pgpool_auto_update'] = False if cfg_get('pgpool_min_level') > 1 or cfg_get('pgpool_max_level') < 40: log.info("Only checking accounts with trainer level {} to {}.".format( cfg_get('pgpool_min_level'), cfg_get('pgpool_max_level'))) if cfg_get('max_good'): log.info("Stopping after {} GOOD accounts.".format( cfg_get('max_good'))) init_mr_mime(user_cfg=mrmime_cfg)
def __setattr__(self, key, value): if key == 'hash_key': # Workaround to directly set one hash key. self._hash_key_provider.set_single_resource(value) self._hash_key = value elif key == 'proxy_url': # Workaround to directly set one proxy. if self._proxy_provider is None: self._proxy_provider = CyclicResourceProvider(value) else: self._proxy_provider.set_single_resource(value) self._proxy_url = value else: # Default: just set the property the normal way super(POGOAccount, self).__setattr__(key, value)
def cfg_init(shadowcheck=False): log.info("Loading PGNumbra configuration.") parse_args() # Provide hash keys args.hash_key_provider = CyclicResourceProvider() for hk in args.hash_key: args.hash_key_provider.add_resource(hk) mrmime_cfg = {'pgpool_system_id': get_pgpool_system_id()} if args.pgpool_url: mrmime_cfg['pgpool_url'] = args.pgpool_url log.info("Attaching to PGPool at {}".format(args.pgpool_url)) if shadowcheck: # This test must include nearby Pokemon to work properly. args.include_nearby = True mrmime_cfg['pgpool_auto_update'] = False init_mr_mime(user_cfg=mrmime_cfg)
resources.append(resource) except IOError: log.exception('Could not load {} from {}.'.format(resource_file)) exit(1) return resources # =========================================================================== log.info("PGScout starting up.") init_mr_mime() init_proxies() hash_key_provider = CyclicResourceProvider() hash_key = cfg_get('hash_key') if hash_key and len(hash_key) > 0: hash_key_provider.add_resource(hash_key) log.info("Loaded single hash key from config.") hash_keys = cfg_get('hash_keys') if hash_keys and len(hash_keys) > 0: for hk in hash_keys: hash_key_provider.add_resource(hk) log.info("Loaded {} hash keys from config.".format(len(hash_keys))) hash_keys = init_resoures_from_file('hash keys', 'hash_key_file') if hash_keys and len(hash_keys) > 0: for hk in hash_keys:
def __init__(self, auth_service, username, password, hash_key=None, hash_key_provider=None, proxy_url=None, proxy_provider=None): self.auth_service = auth_service self.username = username self.password = password # Get myself a copy of the config self.cfg = _mr_mime_cfg.copy() # Initialize hash keys self._hash_key = None if hash_key_provider and not hash_key_provider.is_empty(): self._hash_key_provider = hash_key_provider elif hash_key: self._hash_key_provider = CyclicResourceProvider(hash_key) self._hash_key = hash_key else: self._hash_key_provider = None # Initialize proxies self._proxy_url = None if proxy_provider and not proxy_provider.is_empty(): self._proxy_provider = proxy_provider elif proxy_url: self._proxy_provider = CyclicResourceProvider(proxy_url) self._proxy_url = proxy_url else: self._proxy_provider = None # Captcha self.captcha_url = None # Inventory information self.inbox = {} self.inventory = None self.inventory_balls = 0 self.inventory_lures = 0 self.inventory_total = 0 self.incubators = [] self.pokemon = {} self.eggs = [] # Current location self.latitude = None self.longitude = None self.altitude = None # Count number of rareless scans (to detect shadowbans) self.rareless_scans = None self.shadowbanned = None # Last log message (for GUI/console) self.last_msg = "" # --- private fields self._reset_api() # Will be set to true if a request returns a BAD_REQUEST response which equals a ban self._bad_request_ban = False # Tutorial state and warn/ban flags self._player_state = {} # Trainer statistics self._player_stats = None # PGPool self._pgpool_auto_update_enabled = mrmime_pgpool_enabled( ) and self.cfg['pgpool_auto_update'] self._last_pgpool_update = time.time() self.callback_egg_hatched = None
def proxy_url(self, new_proxy_url): if self._proxy_provider is None: self._proxy_provider = CyclicResourceProvider(new_proxy_url) else: self._proxy_provider.set_single_resource(new_proxy_url) self._proxy_url = new_proxy_url
def hash_key(self, new_key): if self._hash_key_provider is None: self._hash_key_provider = CyclicResourceProvider(new_key) else: self._hash_key_provider.set_single_resource(new_key) self._hash_key = new_key
def __init__(self, auth_service, username, password, hash_key=None, hash_key_provider=None, proxy_url=None, proxy_provider=None): self.auth_service = auth_service self.username = username self.password = password # Initialize hash keys self._hash_key = None if hash_key_provider and not hash_key_provider.is_empty(): self._hash_key_provider = hash_key_provider elif hash_key: self._hash_key_provider = CyclicResourceProvider(hash_key) self._hash_key = hash_key else: self._hash_key_provider = None # Initialize proxies self._proxy_url = None if proxy_provider and not proxy_provider.is_empty(): self._proxy_provider = proxy_provider elif proxy_url: self._proxy_provider = CyclicResourceProvider(proxy_url) self._proxy_url = proxy_url else: self._proxy_provider = None self.cfg = _mr_mime_cfg.copy() # Tutorial state and warn/ban flags self.player_state = {} # Trainer statistics self.player_stats = {} self.captcha_url = None # Inventory information self.inventory = None self.inventory_balls = 0 self.inventory_total = 0 # Location self.latitude = None self.longitude = None self.altitude = None # Last log message (for GUI/console) self.last_msg = "" # --- private fields self._api = PGoApi(device_info=self._generate_device_info()) self._download_settings_hash = None self._asset_time = 0 self._item_templates_time = 0 # Timestamp when last API request was made self._last_request = 0 # Timestamp of last get_map_objects request self._last_gmo = self._last_request # Timestamp for incremental inventory updates self._last_timestamp_ms = None # Timestamp when previous user action is completed self._last_action = 0 self._map_cells = []
def __init__(self, auth_service, username, password, hash_key=None, hash_key_provider=None, proxy_url=None, proxy_provider=None): self.auth_service = auth_service self.username = username self.password = password # Get myself a copy of the config self.cfg = _mr_mime_cfg.copy() # Initialize hash keys self._hash_key = None if hash_key_provider and not hash_key_provider.is_empty(): self._hash_key_provider = hash_key_provider elif hash_key: self._hash_key_provider = CyclicResourceProvider(hash_key) self._hash_key = hash_key else: self._hash_key_provider = None # Initialize proxies self._proxy_url = None if proxy_provider and not proxy_provider.is_empty(): self._proxy_provider = proxy_provider elif proxy_url: self._proxy_provider = CyclicResourceProvider(proxy_url) self._proxy_url = proxy_url else: self._proxy_provider = None # Captcha self.captcha_url = None # Inventory information self.inbox = {} self.inventory = None self.inventory_balls = 0 self.inventory_total = 0 self.incubators = [] self.pokemon = {} self.eggs = [] # Current location self.latitude = None self.longitude = None self.altitude = None # Count number of rareless scans (to detect shadowbans) self.rareless_scans = 0 self.shadowbanned = False # Last log message (for GUI/console) self.last_msg = "" # --- private fields self._api = PGoApi(device_info=self._generate_device_info()) self._download_settings_hash = None self._asset_time = 0 self._item_templates_time = 0 # Will be set to true if a request returns a BAD_REQUEST response which equals a ban self._bad_request_ban = False # Timestamp when last API request was made self._last_request = 0 # Timestamp of last get_map_objects request self._last_gmo = self._last_request # Timestamp for incremental inventory updates self._last_timestamp_ms = None # Timestamp when previous user action is completed self._last_action = 0 # Tutorial state and warn/ban flags self._player_state = {} # Trainer statistics self._player_stats = None # PGPool self._last_pgpool_update = 0