我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用idc.AskFile()。
def showOpenDB(self): filePath = AskFile(0, "*.db", "Open DB") if filePath is None: return connect = sqlite3.connect(filePath) cursor = connect.cursor() cursor.execute('SELECT db_id FROM frl_desc') db_id = cursor.fetchone()[0] if db_id is None: fl_log("FridaLink: DB ID in [%s] is None\n" % filePath) return if db_id in self.dbList: dlg = AskYN(0, "DB ID (%s) from [%s] aleady exists\nReload DB?" % (db_id, filePath)) if dlg != 1: return self.dbList[db_id] = DBEntry(db_id, connect) fl_log("FridaLink: DB loaded [ %s | %s ]\n" % (db_id, filePath))
def __init__(self): self.sym_file_path = idc.AskFile(0, "*.map;*.txt", "open symbol file") self.sym_file = None self.seg = idaapi.get_segm_by_name(".text") if self.seg is None: self.seg = idaapi.getnseg(0) self.base = self.seg.startEA
def main(): if _IN_IDA: # # get dyld_shared_cache path from IDA's openFile dialog print "[+] Please choose the original dyld_shared_cache_arm64" dsc_path = idc.AskFile(0, "*.*", "dyld shared cache file") else: dsc_path = sys.argv[1] if not dsc_path or not os.path.exists(dsc_path): raise RuntimeError("Couldn't find the dyld shared cache file..") print "[+] about to parse %s.." % (dsc_path) dsc_file = open(dsc_path, "rb") adrfind = AddrFinder(dsc_file, cache_symbols=False) map_shared_bridges(dsc_file, adrfind) if _IN_IDA: addresses = sorted(set(get_bad_addresses())) else: addresses = sorted(set(eval(open("addrs.txt", "rb").read()))) segments, exports = get_segments_and_exports_for_addresses(addresses, adrfind) # segments = join_neighbors(segments, threshold=0x1000) if _IN_IDA: map_segments(segments, dsc_file) map_exports(exports) idaapi.analyze_area(idc.MinEA(), idc.MaxEA())
def onLoadEnter(self, code=0): filePath = AskFile(0, "*.js", "Load Frida script") if filePath is None: return self.recentScriptFileEnter = filePath with open(self.recentScriptFileEnter, 'r') as file: text_info = textctrl_info_t(text=file.read(), flags=self.textFlags, tabsize=self.textTab) self.SetControlValue(self.src_file_enter, filePath) self.SetControlValue(self.script_enter, text_info) file.close()
def onLoadLeave(self, code=0): filePath = AskFile(0, "*.js", "Load Frida script") if filePath is None: return self.recentScriptFileLeave = filePath with open(self.recentScriptFileLeave, 'r') as file: text_info = textctrl_info_t(text=file.read(), flags=self.textFlags, tabsize=self.textTab) self.SetControlValue(self.src_file_leave, filePath) self.SetControlValue(self.script_leave, text_info) file.close()
def onLoadScript(self, code=0): filePath = AskFile(0, "*.js", "Load Frida script") if filePath is None: return self.recentScriptFile = filePath with open(self.recentScriptFile, 'r') as file: text_info = textctrl_info_t(text=file.read(), flags=self.textFlags, tabsize=self.textTab) self.SetControlValue(self.src_file, filePath) self.SetControlValue(self.script, text_info) file.close()
def onLoad(self, code=0): filePath = AskFile(0, "*.js", "Load Frida script") if filePath is None: return self.recentScriptFile = filePath with open(self.recentScriptFile, 'r') as file: text_info = textctrl_info_t(text=file.read(), flags=self.textFlags, tabsize=self.textTab) self.SetControlValue(self.src_file, filePath) self.SetControlValue(self.script, text_info) file.close()
def run(self): '''Public function.''' self.symbol_path = idc.AskFile(0, '*.pdb', 'Choose PDB file...') self.image_base = idaapi.get_imagebase() print "IPL: Loading PDB data, might take a while..." self.PDBLookup = pdbparse.symlookup.Lookup([(self.symbol_path, self.image_base)]) if not self.PDBLookup: print "IPL: PDBLookup failed to initialize, exiting." return self._rename_functions() return
def pickle_file(s): f = idc.AskFile(s == 2, ".pkl", "Please select destination/source") return f