def setup(self): self.editor = MockHexEditor() guess = FileGuess("../test_data/reassembly-test.xex") self.editor.load(guess) print(self.editor.document.segments) self.segment = self.editor.document.segments[0][6:6 + 0x125] print(self.segment)
def load_baseline(self, uri, confirm_callback=None): if confirm_callback is None: confirm_callback = lambda a: True try: guess = FileGuess(uri) except Exception, e: log.error("Problem loading baseline file %s: %s" % (uri, str(e))) raise DocumentError(str(e))
def perform(self, event=None): e = self.active_editor val = prompt_for_dec(e.window.control, 'Enter file size in bytes', 'New Blank File', 256) val = 256 if val is not None and val > 0: uri = "blank://%d" % val guess = FileGuess(uri) self.task.new(guess)
def perform(self, event): uri = self.active_editor.document.metadata.uri message = "Revert file from\n\n%s?" % uri result = event.task.confirm(message=message, title='Revert File?') if result: try: guess = FileGuess(uri) document = event.task.window.application.guess_document(guess) self.active_editor.load(document) except fs.errors.FSError, e: event.task.error("Can't revert from %s:\n\n%s" % (uri, str(e)), 'Revert Error')
def load_filesystem_extra_metadata(self): """ Find any extra metadata associated with the document, typically used to load an extra file off the disk. If successful, return a dict to be processed by init_extra_metadata """ uri = self.get_filesystem_extra_metadata_uri() if uri is None: return {} try: guess = FileGuess(uri) except fs.errors.FSError, e: log.error("File load error: %s" % str(e)) return {}
def perform(self, event=None): task = event.task.window.application.find_or_create_task_of_type(self.task_id) guess = FileGuess.get_packaged_file(self.name) task.new(guess)
def get_data(self, orig): try: guess = FileGuess(self.uri) except fs.errors.FSError, e: self.error = "File load error: %s" % str(e) return
def setup(self): self.editor = MockHexEditor() guess = FileGuess("../test_data/air_defense_v18.atr") self.editor.load(guess)
def setup(self): self.editor = MockHexEditor() guess = FileGuess("../test_data/pytest.atr") self.editor.load(guess) self.disasm = self.get_disasm() self.fast = self.disasm.fast
def load(self, path, segment="All"): guess = FileGuess(path) self.editor.load(guess) self.editor.find_segment("All") return self.editor.segment
def perform(self, event=None): task = event.task.window.application.find_or_create_task_of_type( self.task_id) log.debug("Loading %s as %s" % (self.uri, task)) guess = FileGuess(self.uri) task.new(guess)