Skip to content

Commit

Permalink
feat: update to last psa apk structure
Browse files Browse the repository at this point in the history
  • Loading branch information
flobz committed Nov 1, 2022
1 parent 421f109 commit 581b3f4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions psa_car_controller/psa/setup/apk_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ def __get_cultures_code(file, country_code):
cultures = json.loads(file)
return cultures[country_code]["languages"][0]

def __get_parameters_path(self):
language, country = self.culture.split("_")
return "res/raw-{}-r{}/parameters.json".format(language, country)

def retrieve_content_from_apk(self):
a = APK(self.filename)
package_name = a.get_package()
resources = a.get_android_resources() # .get_strings_resources()
self.client_id = resources.get_string(package_name, "PSA_API_CLIENT_ID_PROD")[1]
self.client_secret = resources.get_string(package_name, "PSA_API_CLIENT_SECRET_PROD")[1]
resources = a.get_android_resources()
self.host_brandid_prod = resources.get_string(package_name, "HOST_BRANDID_PROD")[1]
self.culture = self.__get_cultures_code(a.get_file("res/raw/cultures.json"), self.country_code)
parameters = json.loads(a.get_file(self.__get_parameters_path()))
self.client_id = parameters["cvsClientId"]
self.client_secret = parameters["cvsSecret"]

# Get Customer id
self.site_code = BRAND[package_name]["brand_code"] + "_" + self.country_code + "_ESP"
pfx_cert = a.get_file("assets/MWPMYMA1.pfx")
Expand Down

0 comments on commit 581b3f4

Please sign in to comment.