APKinspector / APKInfo.py

The default branch has multiple heads

import sys

if sys.path[0] == "":
	sys.path.append(sys.path[1]+"/androguard/")
	PATH_INSTALL = sys.path[1]+"/androguard"
else:
	sys.path.append(sys.path[0]+"/androguard/")
	PATH_INSTALL = sys.path[0]+"/androguard"

sys.path.append(PATH_INSTALL + "./")
sys.path.append(PATH_INSTALL + "/core")
sys.path.append(PATH_INSTALL + "/core/bytecodes")
sys.path.append(PATH_INSTALL + "/core/predicates")
sys.path.append(PATH_INSTALL + "/core/analysis")
sys.path.append(PATH_INSTALL + "/core/vm")
sys.path.append(PATH_INSTALL + "/core/wm")
sys.path.append(PATH_INSTALL + "/core/protection")
sys.path.append(PATH_INSTALL + "/classification")
 
import androguard, analysis, androlyze
import bytecode

class APK:
    filename = None
    apk = None
    
    def __init__(self, filename):
        self.filename = filename
        self.apk = androlyze.APK(filename)
    
    def isVaildAPK(self):
        return self.apk.is_valid_APK()
    
    def getFilename(self):
        return str(self.apk.get_filename())
        
    def getVersionCode(self):
        return str(self.apk.get_androidversion_code())
    
    def getVersionName(self):
        return str(self.apk.get_androidversion_name())
        
    def getPackage(self):
        return str(self.apk.get_package())
    
    def getReceivers(self):
        retStr = ""
        receivers = self.apk.get_receivers()
        for i in receivers:
            retStr += i +"\n"
        if retStr != "":
            retStr = retStr[:-1]
        return (retStr, len(receivers))
    
    def getServices(self):
        retStr = ""
        services = self.apk.get_services()
        for i in services:
            retStr += i +"\n"
        if retStr != "":
            retStr = retStr[:-1]
        return (retStr, len(services))        

    def getPermissions(self):
        retStr = ""
        permissions = self.apk.get_permissions()
        for i in permissions:
            retStr += i +"\n"
        if retStr != "":
            retStr = retStr[:-1]
        return (retStr, len(permissions))
        
    def getDex(self):
        return self.apk.get_dex()
    
    
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.