def main(): P.prepareFilesFromPhone() if not os.path.exists(P.EmuListPath): print "Please copy emu android manifest running this script! Directory path is:\n" + P.EmuListPath return else: P.prepareDirsAndDicts() _wb = Workbook() PB.Output(_wb) P.Output(_wb) SS.Output(_wb) BP.Output(_wb) _wb.save(outXls) print "Generate xls table successed!! --> %s" % outXls
def main(): P.prepareFilesFromPhone() #get ProtectedBroadcast From EmuManifestListPath --> emuProtectedBroadcastTxt P.grepTagToOutputByPath(P.EmuListPath,'protected-broadcast', P.emuProtectedBroadcastTxt) #get ProtectedBroadcast From ManifestListPath --> protectedBroadcastTxt P.grepTagToOutputByPath(P.ManifestListPath,'protected-broadcast', P.ProtectedBroadcastTxt) if not os.path.exists(P.EmuListPath): print "Please copy emu android manifest running this script! Directory path is:\n" + EmuListPath return else: protectedBroadcastDict = getProtectedBroadcastDict(P.ProtectedBroadcastTxt,P.emuProtectedBroadcastTxt) style = P.setStyles(False) style_title = P.setStyles(True) initWorkbook(style, style_title, protectedBroadcastDict)
def main(): if len(sys.argv) < 2: print "The software version can not be empty." return outXls = P.outdir + "/AndroidSecurity_"+sys.argv[1]+time.strftime('_%Y%m%d%H%M%S')+".xls" P.prepareFilesFromPhone() if not os.path.exists(P.EmuListPath): print "Please copy emu android manifest running this script! Directory path is:\n" + P.EmuListPath return else: P.prepareDirsAndDicts() _wb = Workbook() PB.Output(_wb) P.Output(_wb) SS.Output(_wb) BP.Output(_wb) _wb.save(outXls) print "Generate xls table successed!! --> %s" % outXls
def main(): P.prepareFilesFromPhone() os.system("adb shell service list > %s" % (P.SystemServiceTxt)) f = open(P.SystemServiceTxt, 'r') f.readline() while True: line=f.readline() if not line: break if line.find(':') > -1: #print line idx1 = line.find(':') key=line[:idx1] idx1=key.index(' ') key=key[idx1:] key=key.strip() SystemSerivceList.append(key) #print key if not os.path.exists(P.EmuListPath): print "Please copy emu android manifest running this script! Directory path is:\n" + EmuListPath return else: #protectedBroadcastDict = getProtectedBroadcastDict(P.ProtectedBroadcastTxt,P.emuProtectedBroadcastTxt) DictExcel = xlrd.open_workbook(P.DictXls) #print DictExcel.sheet_names() SystemServiceSheet = DictExcel.sheet_by_name(u'systemservice') for rownum in range(SystemServiceSheet.nrows): #print SystemServiceSheet.row_values(rownum) key=SystemServiceSheet.row(rownum)[0].value #print key if not SystemSerivceDict.has_key(key): SystemSerivceDict[key]=SystemServiceSheet.row_values(rownum) style = P.setStyles(False) style_title = P.setStyles(True) initWorkbook(style, style_title, SystemSerivceList,SystemSerivceDict)
def main(): P.prepareFilesFromPhone() P.getProtectLevelFromManifest('permission ', P.protectionLevelTxt) P.getProtectLevelFromManifest('uses-permission', usesProtectionLevelTxt) if not os.path.exists(P.EmuListPath): print "Please copy emu android manifest running this script! Directory path is:\n" + EmuListPath return else: #add by jinshi.song DictExcel = xlrd.open_workbook(P.DictXls) #print DictExcel.sheet_names() BundlePackageSheet = DictExcel.sheet_by_name(u'bundlepackage') for rownum in range(BundlePackageSheet.nrows): #print BundlePackageSheet.row_values(rownum) key=BundlePackageSheet.row(rownum)[1].value #print key if not BundlePackageDict.has_key(key): BundlePackageDict[key]=BundlePackageSheet.row_values(rownum) #P.prepareDirsAndDicts() #P.getProtectLevelFromManifest('permission ', protectionLevelTxt) P.generatePackageInstallationToPathDict() P.generateProtectionLevelToProtectionLevelDict() pkgProtectionLevelDict = genPkgPermissionProtectionLevelDict(P.protectionLevelTxt) pkgPermissionDict = genPkgAndPermssionDict(P.protectionLevelTxt) pkgUsesPermissionDict = genPkgAndPermssionDict(usesProtectionLevelTxt) P.filterCustomOEM() pkgSourceDict = P.genPkgSourceDict(P.outList) #print pkgSourceDict outList = genBundledPkgInfo(pkgPermissionDict, pkgUsesPermissionDict, pkgSourceDict, pkgProtectionLevelDict) style = P.setStyles(False) style_title = P.setStyles(True) style_pkg = setPkgStyle() initWorkbook(style, style_title, style_pkg, outList,BundlePackageDict)