From: Ciaran Gultnieks Date: Mon, 15 Apr 2013 12:04:13 +0000 (+0100) Subject: Issue warnings for debuggable apks X-Git-Tag: 0.1~642^2~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=94a33f0a04fac230b64f4d91e4e3b00ec6d5b823;p=fdroidserver.git Issue warnings for debuggable apks --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index a7c71ac0..d10d304c 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -2180,3 +2180,19 @@ class KnownApks: lst.reverse() return lst +def isApkDebuggable(apkfile): + """Returns True if the given apk file is debuggable""" + + p = subprocess.Popen([os.path.join(sdk_path, 'platform-tools', 'aapt'), + 'dump', 'xmltree', apkfile, 'AndroidManifest.xml'], + stdout=subprocess.PIPE) + output = p.communicate()[0] + if p.returncode != 0: + print "ERROR: Failed to get apk manifest information" + sys.exit(1) + for line in output.splitlines(): + if line.find('android:debuggable') != -1 and not line.endswith('0x0'): + return True + return False + + diff --git a/fdroidserver/update.py b/fdroidserver/update.py index bc2d9ac2..28619168 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -329,6 +329,10 @@ def main(): print " WARNING: no SDK version information found" thisinfo['sdkversion'] = 0 + # Check for debuggable apks... + if common.isApkDebuggable(apkfile): + print "WARNING: {0} is debuggable... {1}".format(apkfile, line) + # Calculate the md5 and sha256... m = hashlib.md5() sha = hashlib.sha256()