mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-11 15:13:27 +02:00
update: force all "SDK Version" values to int when parsing aapt
This commit is contained in:
parent
dd695c650e
commit
09bbca4a51
@ -1148,16 +1148,16 @@ def scan_apk_aapt(apk, apkfile):
|
|||||||
logging.error(line.replace('sdkVersion:', '')
|
logging.error(line.replace('sdkVersion:', '')
|
||||||
+ ' is not a valid minSdkVersion!')
|
+ ' is not a valid minSdkVersion!')
|
||||||
else:
|
else:
|
||||||
apk['minSdkVersion'] = m.group(1)
|
apk['minSdkVersion'] = int(m.group(1))
|
||||||
elif line.startswith("targetSdkVersion:"):
|
elif line.startswith("targetSdkVersion:"):
|
||||||
m = re.match(APK_SDK_VERSION_PAT, line)
|
m = re.match(APK_SDK_VERSION_PAT, line)
|
||||||
if m is None:
|
if m is None:
|
||||||
logging.error(line.replace('targetSdkVersion:', '')
|
logging.error(line.replace('targetSdkVersion:', '')
|
||||||
+ ' is not a valid targetSdkVersion!')
|
+ ' is not a valid targetSdkVersion!')
|
||||||
else:
|
else:
|
||||||
apk['targetSdkVersion'] = m.group(1)
|
apk['targetSdkVersion'] = int(m.group(1))
|
||||||
elif line.startswith("maxSdkVersion:"):
|
elif line.startswith("maxSdkVersion:"):
|
||||||
apk['maxSdkVersion'] = re.match(APK_SDK_VERSION_PAT, line).group(1)
|
apk['maxSdkVersion'] = int(re.match(APK_SDK_VERSION_PAT, line).group(1))
|
||||||
elif line.startswith("native-code:"):
|
elif line.startswith("native-code:"):
|
||||||
apk['nativecode'] = []
|
apk['nativecode'] = []
|
||||||
for arch in line[13:].split(' '):
|
for arch in line[13:].split(' '):
|
||||||
@ -1193,12 +1193,14 @@ def scan_apk_aapt(apk, apkfile):
|
|||||||
def _sanitize_sdk_version(value):
|
def _sanitize_sdk_version(value):
|
||||||
"""Sanitize the raw values from androguard to handle bad values
|
"""Sanitize the raw values from androguard to handle bad values
|
||||||
|
|
||||||
minSdkVersion/targetSdkVersion/maxSdkVersion must be integers,
|
minSdkVersion/targetSdkVersion/maxSdkVersion must be integers, but
|
||||||
but that doesn't stop devs from doing strange things like
|
that doesn't stop devs from doing strange things like setting them
|
||||||
setting them using Android XML strings.
|
using Android XML strings. This method makes the Androguard output
|
||||||
|
match the output from `aapt dump badging`: bad values are ignored.
|
||||||
|
|
||||||
https://gitlab.com/souch/SMSbypass/blob/v0.9/app/src/main/AndroidManifest.xml#L29
|
https://gitlab.com/souch/SMSbypass/blob/v0.9/app/src/main/AndroidManifest.xml#L29
|
||||||
https://gitlab.com/souch/SMSbypass/blob/v0.9/app/src/main/res/values/strings.xml#L27
|
https://gitlab.com/souch/SMSbypass/blob/v0.9/app/src/main/res/values/strings.xml#L27
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
sdk_version = int(value)
|
sdk_version = int(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user