コード例 #1
0
    def __init__(self, config=None):
        self.config = config
        self.gen_device_id()
        self.logger = logging.getLogger(__name__)

        device_info = {
            "device_id": ApiWrapper.DEVICE_ID,
            "device_brand": 'Apple',
            "device_model": 'iPhone',
            "device_model_boot": 'iPhone8,2',
            "hardware_manufacturer": 'Apple',
            "hardware_model": 'N66AP',
            "firmware_brand": 'iPhone OS',
            "firmware_type": '9.3.3'
        }

        PGoApi.__init__(self, device_info=device_info)

        if not self.config.hashkey is None:
            PGoApi.activate_hash_server(self, self.config.hashkey)
        # Set to default, just for CI...
        self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(
            self)
        self.teleporting = False
        self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

        self.useVanillaRequest = False
コード例 #2
0
ファイル: api_wrapper.py プロジェクト: Gurzeh/PokemonGo-Bot
    def __init__(self, config=None):
        PGoApi.__init__(self)
        # Set to default, just for CI...
        self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(self)
        self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

        self.useVanillaRequest = False
        self.config = config

        if self.config is None or self.config.username is None:
            ApiWrapper.DEVICE_ID = "3d65919ca1c2fc3a8e2bd7cc3f974c34"
            return
        file_salt = None
        did_path = os.path.join(_base_dir, 'data', 'deviceid-%s.txt' % self.config.username)
        if os.path.exists(did_path):
            file_salt = open(did_path, 'r').read()
        if self.config is not None:
            key_string = self.config.username
            if file_salt is not None:
                # Config and file are set, so use those.
                ApiWrapper.DEVICE_ID = hashlib.md5(key_string + file_salt).hexdigest()
            else:
                # Config is set, but file isn't, so make it.
                rand_float = random.SystemRandom().random()
                salt = base64.b64encode((struct.pack('!d', rand_float)))
                ApiWrapper.DEVICE_ID = hashlib.md5(key_string + salt).hexdigest()
                with open(did_path, "w") as text_file:
                    text_file.write("{0}".format(salt))
        else:
            if file_salt is not None:
                # No config, but there's a file, use it.
                ApiWrapper.DEVICE_ID = hashlib.md5(file_salt).hexdigest()
            else:
                # No config or file, so make up a reasonable default.
                ApiWrapper.DEVICE_ID = "3d65919ca1c2fc3a8e2bd7cc3f974c34"
コード例 #3
0
    def __init__(self, config=None):
        self.config = config
        self.gen_device_id()
        self.logger = logging.getLogger(__name__)

        device_info = {
            "device_id": ApiWrapper.DEVICE_ID,
            "device_brand": 'Apple',
            "device_model": 'iPhone',
            "device_model_boot": 'iPhone8,2',
            "hardware_manufacturer": 'Apple',
            "hardware_model": 'N66AP',
            "firmware_brand": 'iPhone OS',
            "firmware_type": '9.3.3'
        }

        PGoApi.__init__(self, device_info=device_info)
         
        if not self.config.hashkey is None:
            PGoApi.activate_hash_server(self,self.config.hashkey)
        # Set to default, just for CI...
        self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(self)
        self.teleporting = False
        self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

        self.useVanillaRequest = False
コード例 #4
0
    def __init__(self, config=None):
        self.config = config
        self.gen_device_id()
        self.capi = float(0.55)
        self.POGOProtos = float(2.6)
        # Check if bot is using lastest POGOProtos, only do so if check_niantic_api is set to true
        # If a new Protos is availible, it mean there's a possibility of a new API
        latestProtos = float(0.0)
        if self.config.check_niantic_api is True:
            if latestProtos > self.POGOProtos:
                link = "https://raw.githubusercontent.com/AeonLucid/POGOProtos/master/.current-version"
                f = urllib.urlopen(link)
                myfile = f.read()
                latestProtos = float(myfile[0:3])
                print(
                    "\033[1;31;40m We have detected a possibility of a new pogo API. Try upgarding it by using ./setup.sh -u command"
                )
                print(
                    "\033[1;31;40m This message might still be shown after updating unless a new commit is done in Github\n"
                )

        device_info = {
            "device_id": ApiWrapper.DEVICE_ID,
            "device_brand": 'Apple',
            "device_model": 'iPhone',
            "device_model_boot": 'iPhone8,2',
            "hardware_manufacturer": 'Apple',
            "hardware_model": 'N66AP',
            "firmware_brand": 'iPhone OS',
            "firmware_type": '9.3.3'
        }

        PGoApi.__init__(self, device_info=device_info)
        if not self.config.hashkey is None:
            PGoApi.activate_hash_server(self, self.config.hashkey)
        # Set to default, just for CI...
        self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(
            self)
        self.teleporting = False
        self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

        self.useVanillaRequest = False
コード例 #5
0
ファイル: api_wrapper.py プロジェクト: zoberg/PokemonGo-Bot
    def __init__(self, config=None):
        PGoApi.__init__(self)
        # Set to default, just for CI...
        self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(
            self)
        self.teleporting = False
        self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

        self.useVanillaRequest = False
        self.config = config

        if self.config is None or self.config.username is None:
            ApiWrapper.DEVICE_ID = "3d65919ca1c2fc3a8e2bd7cc3f974c34"
            return
        file_salt = None
        did_path = os.path.join(_base_dir, 'data',
                                'deviceid-%s.txt' % self.config.username)
        if os.path.exists(did_path):
            file_salt = open(did_path, 'r').read()
        if self.config is not None:
            key_string = self.config.username
            if file_salt is not None:
                # Config and file are set, so use those.
                ApiWrapper.DEVICE_ID = hashlib.md5(key_string +
                                                   file_salt).hexdigest()
            else:
                # Config is set, but file isn't, so make it.
                rand_float = random.SystemRandom().random()
                salt = base64.b64encode((struct.pack('!d', rand_float)))
                ApiWrapper.DEVICE_ID = hashlib.md5(key_string +
                                                   salt).hexdigest()
                with open(did_path, "w") as text_file:
                    text_file.write("{0}".format(salt))
        else:
            if file_salt is not None:
                # No config, but there's a file, use it.
                ApiWrapper.DEVICE_ID = hashlib.md5(file_salt).hexdigest()
            else:
                # No config or file, so make up a reasonable default.
                ApiWrapper.DEVICE_ID = "3d65919ca1c2fc3a8e2bd7cc3f974c34"
コード例 #6
0
ファイル: api_wrapper.py プロジェクト: dtee/PokemonGo-Bot
    def __init__(self, config=None):
        self.config = config
        self.gen_device_id()
        self.capi = float(0.55)
        self.POGOProtos = float(2.6)
        # Check if bot is using lastest POGOProtos, only do so if check_niantic_api is set to true
        # If a new Protos is availible, it mean there's a possibility of a new API
        latestProtos = float(0.0)
        if self.config.check_niantic_api is True:
            if latestProtos > self.POGOProtos:
                link = "https://raw.githubusercontent.com/AeonLucid/POGOProtos/master/.current-version"
                f = urllib.urlopen(link)
                myfile = f.read()
                latestProtos = float(myfile[0:3])
                print("\033[1;31;40m We have detected a possibility of a new pogo API. Try upgarding it by using ./setup.sh -u command")
                print("\033[1;31;40m This message might still be shown after updating unless a new commit is done in Github\n")
        
        device_info = {
            "device_id": ApiWrapper.DEVICE_ID,
            "device_brand": 'Apple',
            "device_model": 'iPhone',
            "device_model_boot": 'iPhone8,2',
            "hardware_manufacturer": 'Apple',
            "hardware_model": 'N66AP',
            "firmware_brand": 'iPhone OS',
            "firmware_type": '9.3.3'
        }

        PGoApi.__init__(self, device_info=device_info)
        if not self.config.hashkey is None:
            PGoApi.activate_hash_server(self,self.config.hashkey)
        # Set to default, just for CI...
        self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(self)
        self.teleporting = False
        self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

        self.useVanillaRequest = False