コード例 #1
0
def create_graph(input, output):
    if input != None and output != None:

        ret_type = androconf.is_android(input)
        vm = None
        a = None
        if ret_type == "APK":
            a = apk.APK(input)
            if a.is_valid_APK():
                vm = dvm.DalvikVMFormat(a.get_dex())
            else:
                print "INVALID APK"
        elif ret_type == "DEX":
            try:
                vm = dvm.DalvikVMFormat(open(input, "rb").read())
            except Exception, e:
                print "INVALID DEX", e

        vmx = analysis.VMAnalysis(vm)
        gvmx = ganalysis.GVMAnalysis(vmx, a)

        create_directories(vm, output)

        dd = data.Data(vm, vmx, gvmx, a)

        buff = dd.export_methodcalls_to_gml()
        androconf.save_to_disk(buff, output + "/" + "methodcalls.graphml")
コード例 #2
0
    def getGexf(self, gexfOut):
        """
        Use Androgexf in androguard to generate graph
        """
        try:
            self.gexfOut = gexfOut
            vm = dvm.DalvikVMFormat(self.apkObj.get_dex())

            vmx = analysis.VMAnalysis(vm)
            gvmx = ganalysis.GVMAnalysis(vmx, self.apkObj)

            b = gvmx.export_to_gexf()
            androconf.save_to_disk(b, self.gexfOut)
        except Exception:
            ex = traceback.format_exc()
            self.log.exce(ex)
コード例 #3
0
ファイル: androgexf.py プロジェクト: appknox/androguard-old
def main(options, arguments):
    if options.input != None and options.output != None:
        ret_type = androconf.is_android(options.input)

        vm = None
        a = None
        if ret_type == "APK":
            a = apk.APK(options.input)
            if a.is_valid_APK():
                vm = dvm.DalvikVMFormat(a.get_dex())
            else:
                print("INVALID APK")
        elif ret_type == "DEX":
            try:
                vm = dvm.DalvikVMFormat(read(options.input))
            except Exception as e:
                print("INVALID DEX", e)

        vmx = analysis.VMAnalysis(vm)
        gvmx = ganalysis.GVMAnalysis(vmx, a)

        b = gvmx.export_to_gexf()
        androconf.save_to_disk(b, options.output)
コード例 #4
0
ファイル: androgexf.py プロジェクト: 0xr0ot/androguard
def main(options, arguments) :
    if options.input != None and options.output != None :
        ret_type = androconf.is_android( options.input )
        
        vm = None
        a = None
        if ret_type == "APK"  :
            a = apk.APK( options.input )
            if a.is_valid_APK() :
                vm = dvm.DalvikVMFormat( a.get_dex() )
            else :
                print "INVALID APK"
        elif ret_type == "DEX" :
            try :
                vm = dvm.DalvikVMFormat( open(options.input, "rb").read() )
            except Exception, e :
                print "INVALID DEX", e

        vmx = analysis.VMAnalysis( vm )
        gvmx = ganalysis.GVMAnalysis( vmx, a )

        b = gvmx.export_to_gexf()
        androconf.save_to_disk( b, options.output )
コード例 #5
0
ファイル: apkviewer.py プロジェクト: zhengyuqin/lobotomy
def main(options, arguments):
    if options.input != None and options.output != None:

        ret_type = androconf.is_android(options.input)
        vm = None
        a = None
        if ret_type == "APK":
            a = apk.APK(options.input)
            if a.is_valid_APK():
                vm = dvm.DalvikVMFormat(a.get_dex())
            else:
                print "INVALID APK"
        elif ret_type == "DEX":
            try:
                vm = dvm.DalvikVMFormat(open(options.input, "rb").read())
            except Exception, e:
                print "INVALID DEX", e

        vmx = analysis.VMAnalysis(vm)
        gvmx = ganalysis.GVMAnalysis(vmx, a)

        create_directories(vm, options.output)

        #        dv.export_to_gml( options.output )

        dd = data.Data(vm, vmx, gvmx, a)

        buff = dd.export_apk_to_gml()
        androconf.save_to_disk(buff, options.output + "/" + "apk.graphml")

        buff = dd.export_methodcalls_to_gml()
        androconf.save_to_disk(buff,
                               options.output + "/" + "methodcalls.graphml")

        buff = dd.export_dex_to_gml()
        for i in buff:
            androconf.save_to_disk(buff[i],
                                   options.output + "/" + i + ".graphml")
コード例 #6
0
ファイル: apkviewer.py プロジェクト: adrooy/works
def main(options, arguments) :
    if options.input != None and options.output != None :

        ret_type = androconf.is_android( options.input )
        vm = None
        a = None
        if ret_type == "APK"  :
            a = apk.APK( options.input )
            if a.is_valid_APK() :
                vm = dvm.DalvikVMFormat( a.get_dex() )
            else :
                print "INVALID APK"
        elif ret_type == "DEX" :
            try :
                vm = dvm.DalvikVMFormat( open(options.input, "rb").read() )
            except Exception, e :
                print "INVALID DEX", e


        vmx = analysis.VMAnalysis( vm )
        gvmx = ganalysis.GVMAnalysis( vmx, a )

        create_directories( vm, options.output )

#        dv.export_to_gml( options.output )

        dd = data.Data(vm, vmx, gvmx, a)

        buff = dd.export_apk_to_gml()
        androconf.save_to_disk( buff, options.output + "/" + "apk.graphml" )
        
        buff = dd.export_methodcalls_to_gml()
        androconf.save_to_disk( buff,  options.output + "/" + "methodcalls.graphml" )

        buff = dd.export_dex_to_gml()
        for i in buff :
            androconf.save_to_disk( buff[i], options.output + "/" + i + ".graphml" )
コード例 #7
0
 def saveGexf(self, where, resultsFileName):
     gexfFileName = '%s%s' % (resultsFileName, '.gexf')
     gexfSavePath = os.path.join(where, gexfFileName)
     b = self._stadynaMcg.export_to_gexf()
     androconf.save_to_disk(b, gexfSavePath)
コード例 #8
0
 def saveGexf(self, where, resultsFileName):
     gexfFileName = '%s%s' % (resultsFileName, '.gexf')
     gexfSavePath = os.path.join(where, gexfFileName)
     b = self._stadynaMcg.export_to_gexf()
     androconf.save_to_disk(b, gexfSavePath)