本文整理汇总了Python中idc.AskFile方法的典型用法代码示例。如果您正苦于以下问题:Python idc.AskFile方法的具体用法?Python idc.AskFile怎么用?Python idc.AskFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idc
的用法示例。
在下文中一共展示了idc.AskFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_db
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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
示例2: on_export
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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
示例3: on_import
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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
示例4: save_db
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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)
示例5: importb
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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')
示例6: export
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
def export(self):
#将所选择的buffer保存到文件
exportFile = idc.AskFile(1, "*.*", "Export Buffer")
f = open(exportFile, 'wb')
f.write(self.buffer)
f.close()
示例7: run
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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
示例8: main
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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"
示例9: prepare
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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)
示例10: run
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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))
示例11: getInputFilepath
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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
示例12: main
# 需要导入模块: import idc [as 别名]
# 或者: from idc import AskFile [as 别名]
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())