Python idc.AskFile() Examples
The following are 12
code examples of idc.AskFile().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
idc
, or try the search function
.
Example #1
Source File: DIE.py From DIE with MIT License | 6 votes |
def load_db(self): try: db_file = idc.AskFile(0, "*.ddb", "Load DIE Db File") if db_file is not None: self.die_db.load_db(db_file) if self.die_db is not None: self.show_db_details() except DbFileMismatch as mismatch: idaapi.msg("Error while loading DIE DB: %s\n" % mismatch) except Exception as ex: logging.exception("Error while loading DB: %s", ex) return False ########################################################################### # Function View
Example #2
Source File: IDASynergy.py From IDASynergy with MIT License | 5 votes |
def on_export(self): Warning("This export option generates an .ivz file that you have to distribute manually.\nIDASynergy won't automatically synchronize unless a local repository is synched\nto a versioning server and the 'IDASynergy SVN Commit' menu option is used.") exp_file = idc.AskFile(1, "*.ivz", "Exported data filename") print time.time() self.remove_hooks() self.data_io.export_to_file(exp_file) self.insert_hooks() return 1
Example #3
Source File: IDASynergy.py From IDASynergy with MIT License | 5 votes |
def on_import(self): imp_file = idc.AskFile(0, "*.ivz", "Select file to import") self.remove_hooks() self.data_io.import_from_file(imp_file, self.insert_hooks) return 1
Example #4
Source File: DIE.py From DIE with MIT License | 5 votes |
def save_db(self): db_file = idc.AskFile(1, "*.ddb", "Save DIE Db File") if db_file is None: return self.die_db.save_db(db_file)
Example #5
Source File: 16_输入与输出.py From IDAPython_Note with MIT License | 5 votes |
def importb(self): #将文件中的内容导入到buffer中 fileName = idc.AskFile(0, "*.*", 'Import File') try: self.buffer = open(fileName, 'rb').read() except: sys.stdout.write('ERROR:Cannot access file')
Example #6
Source File: 16_输入与输出.py From IDAPython_Note with MIT License | 5 votes |
def export(self): #将所选择的buffer保存到文件 exportFile = idc.AskFile(1, "*.*", "Export Buffer") f = open(exportFile, 'wb') f.write(self.buffer) f.close()
Example #7
Source File: main.py From ida_pdb_loader with MIT License | 5 votes |
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
Example #8
Source File: sorter.py From IDAmetrics with BSD 2-Clause "Simplified" License | 5 votes |
def main(): message = "First of all you need to specify folder with test cases." idc.Warning(message) fname = idc.AskFile(0, "*.*", "Please specify first trace file in test cases folder \ to start prioritization") if fname == None: print "You need to specify any file in test cases folder to start prioritization" return 0 fname = os.path.dirname(fname) if fname == None: return 0 print "Starting prioritization of " + fname start_prior(fname) print "Done"
Example #9
Source File: IDAMetrics_dynamic.py From IDAmetrics with BSD 2-Clause "Simplified" License | 5 votes |
def prepare(metrics_used): fname = idc.AskFile(0, ".out", "Choose a trace file") if fname == None: print "You need to specify trace to get dynamic metrics" return 0 print "Start trace analysis" metrics_dynamic = Metrics_dynamic() metrics_dynamic.get_dynamic_metrics(fname, metrics_used)
Example #10
Source File: shellcode_hash_search.py From flare-ida with Apache License 2.0 | 5 votes |
def run(self): try: logger.debug("Starting up") dbFile = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'shellcode_hashes', 'sc_hashes.db')) logger.debug('Trying default db path: %s', dbFile) if not os.path.exists(dbFile): if using_ida7api: dbFile = idaapi.ask_file(False, "*.db", "Select shellcode hash database") else: dbFile = idc.AskFile(0, "*.db", "Select shellcode hash database") if (dbFile is None) or (not os.path.isfile(dbFile)): logger.debug("No file select. Stopping now") return self.dbstore = DbStore(dbFile) logger.debug("Loaded db file: %s", dbFile) if QT_AVAILABLE: self.launchGuiInput() else: self.launchManualPrompts() searcher = ShellcodeHashSearcher(self.dbstore, self.params) logger.debug('Starting to run the searcher now') searcher.run() logger.debug("Done") except RejectionException: logger.info('User canceled action') except Exception as err: logger.exception("Exception caught: %s", str(err))
Example #11
Source File: jayutils.py From flare-ida with Apache License 2.0 | 5 votes |
def getInputFilepath(): '''Returns None if the uesr cancels. Updates the filepath in the idb on success''' if using_ida7api: return getInputFilepath_ida7() filePath = idc.GetInputFilePath() if not os.path.exists(filePath): print ('IDB input file not found. Prompting for new one: %s' % filePath) filePath = idc.AskFile(False, '*.*', 'Enter path to idb input file') if filePath is not None: idc.SetInputFilePath(filePath) return filePath
Example #12
Source File: dsc_fix.py From dsc_fix with GNU General Public License v3.0 | 5 votes |
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())