def apkinfo_dialog(self):
        self.apkinfo = MyApkInfoForm()
        self.Init_Apkinfo_text()
        csn_path = self.unpackDir + os.path.sep + "META-INF"
        if os.path.isdir(csn_path):
            f_list = os.listdir(csn_path)

            for file_name in f_list:
                if os.path.splitext(file_name)[1] == '.RSA' or os.path.splitext(file_name)[1] == '.DSA':
                    csn_path = csn_path + os.path.sep + file_name
                    csn = CSN(csn_path)
                    self.apkinfo.ui.edt_file.setText(str(csn.get_size()))
                    self.apkinfo.ui.edt_serial_num.setText(str(csn.getCertificateSN()).upper())
                    self.apkinfo.ui.edt_publisher.setText(str(csn.getCertificateIDN()))
                    self.apkinfo.ui.edt_issuer.setText(str(csn.getCertificateSDN()))
                    break


        dex_path = self.unpackDir + os.path.sep + "classes.dex"
        if os.path.exists(dex_path):
            m = hashlib.md5()
            file = io.FileIO(dex_path, 'r')
            bytes = file.read(1024)
            while(bytes != b''):
                m.update(bytes)
                bytes = file.read(1024)
            file.close()
            dexmd5value = m.hexdigest()
            #print str(dexmd5value).upper()
            self.apkinfo.ui.edt_dexmd5.setText(str(dexmd5value).upper())

        apkpath = unicode(self.loadfile_path, "utf8")
        if os.path.isfile(apkpath) and self.loadfile_path != "":
            pass
        if self.loadfile_path != "":
            #apkpath = unicode(self.loadfile_path, "utf8")

            apkmd5value = self.GetFileMd5(self.loadfile_path)

            # m = hashlib.md5()
            # file = io.FileIO(self.loadfile_path, 'r')
            # bytes = file.read(1024)
            # while(bytes != b''):
            #     m.update(bytes)
            #     bytes = file.read(1024)
            # file.close()
            # apkmd5value = m.hexdigest()
            self.apkinfo.ui.edt_apkmd5.setText(apkmd5value.upper())


        path = self.unpackDir + os.path.sep +"AndroidManifest.xml"

        if os.path.exists(path):
            axml_analysis = AXML(self.unpackDir + os.path.sep +"AndroidManifest.xml")
            if axml_analysis.get_filename_abs() == 'AndroidManifest':
                self.apkinfo.ui.edt_package.setText(axml_analysis.get_package())
                self.apkinfo.ui.edt_version.setText(axml_analysis.get_androidversion_name())
                self.apkinfo.ui.edt_version_num.setText(axml_analysis.get_androidversion_code())
                self.apkinfo.ui.edt_version_need.setText(axml_analysis.getMinSdkVersion())



        self.apkinfo.show()
Beispiel #2
0
    def apkinfo_dialog(self):
        self.apkinfo = MyApkInfoForm()
        self.Init_Apkinfo_text()
        csn_path = self.unpackDir + os.path.sep + "META-INF"
        if os.path.isdir(csn_path):
            f_list = os.listdir(csn_path)

            for file_name in f_list:
                if os.path.splitext(
                        file_name)[1] == '.RSA' or os.path.splitext(
                            file_name)[1] == '.DSA':
                    csn_path = csn_path + os.path.sep + file_name
                    csn = CSN(csn_path)
                    self.apkinfo.ui.edt_file.setText(str(csn.get_size()))
                    self.apkinfo.ui.edt_serial_num.setText(
                        str(csn.getCertificateSN()).upper())
                    self.apkinfo.ui.edt_publisher.setText(
                        str(csn.getCertificateIDN()))
                    self.apkinfo.ui.edt_issuer.setText(
                        str(csn.getCertificateSDN()))
                    break

        dex_path = self.unpackDir + os.path.sep + "classes.dex"
        if os.path.exists(dex_path):
            m = hashlib.md5()
            file = io.FileIO(dex_path, 'r')
            bytes = file.read(1024)
            while (bytes != b''):
                m.update(bytes)
                bytes = file.read(1024)
            file.close()
            dexmd5value = m.hexdigest()
            #print str(dexmd5value).upper()
            self.apkinfo.ui.edt_dexmd5.setText(str(dexmd5value).upper())

        apkpath = unicode(self.loadfile_path, "utf8")
        if os.path.isfile(apkpath) and self.loadfile_path != "":
            pass
        if self.loadfile_path != "":
            #apkpath = unicode(self.loadfile_path, "utf8")

            apkmd5value = self.GetFileMd5(self.loadfile_path)

            # m = hashlib.md5()
            # file = io.FileIO(self.loadfile_path, 'r')
            # bytes = file.read(1024)
            # while(bytes != b''):
            #     m.update(bytes)
            #     bytes = file.read(1024)
            # file.close()
            # apkmd5value = m.hexdigest()
            self.apkinfo.ui.edt_apkmd5.setText(apkmd5value.upper())

        path = self.unpackDir + os.path.sep + "AndroidManifest.xml"

        if os.path.exists(path):
            axml_analysis = AXML(self.unpackDir + os.path.sep +
                                 "AndroidManifest.xml")
            if axml_analysis.get_filename_abs() == 'AndroidManifest':
                self.apkinfo.ui.edt_package.setText(
                    axml_analysis.get_package())
                self.apkinfo.ui.edt_version.setText(
                    axml_analysis.get_androidversion_name())
                self.apkinfo.ui.edt_version_num.setText(
                    axml_analysis.get_androidversion_code())
                self.apkinfo.ui.edt_version_need.setText(
                    axml_analysis.getMinSdkVersion())

        self.apkinfo.show()