Пример #1
0
 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)
Пример #2
0
 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))
Пример #3
0
 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)
Пример #4
0
 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')
Пример #5
0
 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 {}
Пример #6
0
 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)
Пример #7
0
 def get_data(self, orig):
     try:
         guess = FileGuess(self.uri)
     except fs.errors.FSError, e:
         self.error = "File load error: %s" % str(e)
         return
Пример #8
0
 def setup(self):
     self.editor = MockHexEditor()
     guess = FileGuess("../test_data/air_defense_v18.atr")
     self.editor.load(guess)
Пример #9
0
 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
Пример #10
0
 def load(self, path, segment="All"):
     guess = FileGuess(path)
     self.editor.load(guess)
     self.editor.find_segment("All")
     return self.editor.segment
Пример #11
0
 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)