def steploop(self): """ Continue stepi'ing in a loop until shouldRunAgain() returns false (like RunForever mode or something) """ if self.getMode("NonBlocking", False): e_threads.firethread(self.doStepLoop)() else: self.doStepLoop()
def wait(self): """ Wait for the trace target to have something happen... If the trace is in NonBlocking mode, this will fire a thread to wait for you and return control immediately. """ if self.getMode("NonBlocking"): e_threads.firethread(self._doWait)() return self._doWait()
def actStepi(self, thing): firethread(self.trace.stepi)()
def actBreak(self, thing): if self.trace.getMeta('PendingBreak'): return self.trace.setMeta('PendingBreak', True) firethread(self.trace.sendBreak)()
def actContinue(self, thing): firethread(self.trace.run)()
def actDetach(self, thing): if self.trace.isAttached(): firethread(self.trace.detach)()
def actAttach(self, *args, **kwargs): pid = getProcessPid(trace=self.trace) if pid != None: firethread(self.trace.attach)(pid)
def main(): parser = argparse.ArgumentParser(prog='vivbin', usage='%(prog)s [options] <workspace|binaries...>') parser.add_argument('-M', '--module', dest='modname', default=None, action='store', help='run the file listed as an analysis module in non-gui mode and exit') parser.add_argument('-A', '--skip-analysis', dest='doanalyze', default=True, action='store_false', help='Do *not* do an initial auto-analysis pass') parser.add_argument('-B', '--bulk', dest='bulk', default=False, action='store_true', help='Do *not* start the gui, just load, analyze and save') parser.add_argument('-C', '--cprofile', dest='cprof', default=False, action='store_true', help='Output vivisect performace profiling (cProfile) info') parser.add_argument('-O', '--option', dest='option', default=None, action='store', help='<secname>.<optname>=<optval> (optval must be json syntax)') parser.add_argument('-p', '--parser', dest='parsemod', default=None, action='store', help='Manually specify the parser module (pe/elf/blob/...)') parser.add_argument('-s', '--storage', dest='storage_name', default=None, action='store', help='Specify a storage module by name') parser.add_argument('-v', '--verbose', dest='verbose', default=False, action='store_true', help='Enable verbose mode') parser.add_argument('-V', '--version', dest='version', default=None, action='store', help='Add file version (if available) to save file name') parser.add_argument('file', nargs='*') args = parser.parse_args() vw = viv_cli.VivCli() vw.verbose = args.verbose if args.option is not None: vw.config.parseConfigOption(args.option) if args.storage_name is not None: vw.setMeta("StorageModule", args.storage_name) # If we're not gonna load files, no analyze if args.file is None: args.doanalyze = False # Load in any additional files... needanalyze = False if args.file is not None: for fname in args.file: if args.parsemod == None: args.parsemod = viv_parsers.guessFormatFilename(fname) start = time.time() if args.parsemod == 'viv': vw.loadWorkspace(fname) else: needanalyze = True vw.loadFromFile(fname, fmtname=args.parsemod) end = time.time() print('Loaded (%.4f sec) %s' % (end - start, fname)) if args.bulk: if args.doanalyze: if args.cprof: cProfile.run("vw.analyze()") else: start = time.time() vw.analyze() end = time.time() print "ANALYSIS TIME: %s" % (end-start) if args.modname is not None: module = imp.load_module("custom_analysis", file(modname, "rb"), modname, ('.py', 'U', 1)) module.analyze(vw) print('stats: %r' % (vw.getStats(),)) print("Saving workspace: %s" % (vw.getMeta('StorageName'))) vw.saveWorkspace() else: import vivisect.qt.main as viv_qt_main # If we are interactive, lets turn on extended output... vw.verbose = True if args.doanalyze and needanalyze: e_threads.firethread(vw.analyze)() viv_qt_main.main(vw)
def returnPressedSlot(self): cmd = str(self.input.text()) self.input.clear() self.addHistory(cmd) self.output.addText('> %s\n' % cmd) firethread(self.onecmd)(cmd)
module = imp.load_module("custom_analysis", file(modname, "rb"), modname, ('.py', 'U', 1)) module.analyze(vw) print('stats: %r' % (vw.getStats(),)) print("Saving workspace: %s" % (vw.getMeta('StorageName'))) vw.saveWorkspace() else: import vivisect.qt.main as viv_qt_main # If we are interactive, lets turn on extended output... vw.verbose = True if args.doanalyze and needanalyze: e_threads.firethread(vw.analyze)() viv_qt_main.main(vw) if __name__ == '__main__': try: # psyco makes disasm much faster (2-3X) import psyco #psyco.log() psyco.full() except ImportError: pass main()
def main(): parser = argparse.ArgumentParser( prog='vivbin', usage='%(prog)s [options] <workspace|binaries...>') parser.add_argument( '-M', '--module', dest='modname', default=None, action='store', help= 'run the file listed as an analysis module in non-gui mode and exit') parser.add_argument('-A', '--skip-analysis', dest='doanalyze', default=True, action='store_false', help='Do *not* do an initial auto-analysis pass') parser.add_argument( '-B', '--bulk', dest='bulk', default=False, action='store_true', help='Do *not* start the gui, just load, analyze and save') parser.add_argument( '-C', '--cprofile', dest='cprof', default=False, action='store_true', help='Output vivisect performace profiling (cProfile) info') parser.add_argument( '-O', '--option', dest='option', default=None, action='store', help='<secname>.<optname>=<optval> (optval must be json syntax)') parser.add_argument( '-p', '--parser', dest='parsemod', default=None, action='store', help='Manually specify the parser module (pe/elf/blob/...)') parser.add_argument('-s', '--storage', dest='storage_name', default=None, action='store', help='Specify a storage module by name') parser.add_argument('-v', '--verbose', dest='verbose', default=False, action='count', help='Enable verbose mode (multiples matter: -vvvv)') parser.add_argument( '-V', '--version', dest='version', default=None, action='store', help='Add file version (if available) to save file name') parser.add_argument('-c', '--config', dest='config', default=None, action='store_true', help='Path to a directory to use for config data') parser.add_argument('-a', '--autosave', dest='autosave', default=False, action='store_true', help='Autosave configuration data') parser.add_argument('file', nargs='*') args = parser.parse_args() vw = viv_cli.VivCli(confdir=args.config, autosave=args.autosave) # setup logging vw.verbose = min(args.verbose, 4) logger.setLevel(loglevels[vw.verbose]) if args.option is not None: if args.option in ('-h', '?'): logger.critical(vw.config.reprConfigPaths()) sys.exit(-1) try: vw.config.parseConfigOption(args.option) except e_config.ConfigNoAssignment as e: logger.critical(vw.config.reprConfigPaths() + "\n") logger.critical(e) logger.critical( "syntax: \t-O <secname>.<optname>=<optval> (optval must be json syntax)" ) sys.exit(-1) except Exception as e: logger.critical(vw.config.reprConfigPaths()) logger.critical("With entry: %s", args.option) logger.critical(e) sys.exit(-1) if args.storage_name is not None: vw.setMeta("StorageModule", args.storage_name) # If we're not gonna load files, no analyze if args.file is None: args.doanalyze = False # Load in any additional files... needanalyze = False if args.file is not None: for fname in args.file: if args.parsemod is None: args.parsemod = viv_parsers.guessFormatFilename(fname) start = time.time() if args.parsemod == 'viv': vw.loadWorkspace(fname) else: needanalyze = True vw.loadFromFile(fname, fmtname=args.parsemod) end = time.time() logger.info('Loaded (%.4f sec) %s', (end - start), fname) if args.bulk: if args.doanalyze: if args.cprof: cProfile.run("vw.analyze()") else: start = time.time() vw.analyze() end = time.time() logger.debug("ANALYSIS TIME: %s", (end - start)) if args.modname is not None: with open(args.modname, 'rb') as f: module = imp.load_module("custom_analysis", f, args.modname, ('.py', 'U', 1)) module.analyze(vw) logger.info('stats: %r', vw.getStats()) logger.info("Saving workspace: %s", vw.getMeta('StorageName')) vw.saveWorkspace() else: import vivisect.qt.main as viv_qt_main # If we are interactive, lets turn on extended output... if args.doanalyze and needanalyze: e_threads.firethread(vw.analyze)() viv_qt_main.main(vw)
def main(): parser = argparse.ArgumentParser( prog='vivbin', usage='%(prog)s [options] <workspace|binaries...>') parser.add_argument( '-M', '--module', dest='modname', default=None, action='store', help= 'run the file listed as an analysis module in non-gui mode and exit') parser.add_argument('-A', '--skip-analysis', dest='doanalyze', default=True, action='store_false', help='Do *not* do an initial auto-analysis pass') parser.add_argument( '-B', '--bulk', dest='bulk', default=False, action='store_true', help='Do *not* start the gui, just load, analyze and save') parser.add_argument( '-C', '--cprofile', dest='cprof', default=False, action='store_true', help='Output vivisect performace profiling (cProfile) info') parser.add_argument( '-O', '--option', dest='option', default=None, action='store', help='<secname>.<optname>=<optval> (optval must be json syntax)') parser.add_argument( '-p', '--parser', dest='parsemod', default=None, action='store', help='Manually specify the parser module (pe/elf/blob/...)') parser.add_argument('-s', '--storage', dest='storage_name', default=None, action='store', help='Specify a storage module by name') parser.add_argument('-v', '--verbose', dest='verbose', default=False, action='store_true', help='Enable verbose mode') parser.add_argument( '-V', '--version', dest='version', default=None, action='store', help='Add file version (if available) to save file name') parser.add_argument('file', nargs='*') args = parser.parse_args() vw = viv_cli.VivCli() vw.verbose = args.verbose if args.option is not None: vw.config.parseConfigOption(args.option) if args.storage_name is not None: vw.setMeta("StorageModule", args.storage_name) # If we're not gonna load files, no analyze if args.file is None: args.doanalyze = False # Load in any additional files... needanalyze = False if args.file is not None: for fname in args.file: if args.parsemod == None: args.parsemod = viv_parsers.guessFormatFilename(fname) start = time.time() if args.parsemod == 'viv': vw.loadWorkspace(fname) else: needanalyze = True vw.loadFromFile(fname, fmtname=args.parsemod) end = time.time() print('Loaded (%.4f sec) %s' % (end - start, fname)) if args.bulk: if args.doanalyze: if args.cprof: cProfile.run("vw.analyze()") else: start = time.time() vw.analyze() end = time.time() print "ANALYSIS TIME: %s" % (end - start) if args.modname is not None: module = imp.load_module("custom_analysis", file(modname, "rb"), modname, ('.py', 'U', 1)) module.analyze(vw) print('stats: %r' % (vw.getStats(), )) print("Saving workspace: %s" % (vw.getMeta('StorageName'))) vw.saveWorkspace() else: import vivisect.qt.main as viv_qt_main # If we are interactive, lets turn on extended output... vw.verbose = True if args.doanalyze and needanalyze: e_threads.firethread(vw.analyze)() viv_qt_main.main(vw)