feat: update to last psa apk structure

This commit is contained in:
Florian Bezannier
2022-11-01 15:39:50 +01:00
committed by Florian BEZANNIER
parent 421f109ee9
commit 581b3f43c5
+9 -3
View File
@@ -24,14 +24,20 @@ class ApkParser:
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")