Example #1
0
 def test_screenlock(self):
     for sample in self.samples:
         cfg = imp.reload(inception.cfg)
         cfg.startaddress = 0x00000000
         mod_name = sample[0]
         #print(mod_name)
         filepath = sample[1]
         try:
             module = importlib.machinery.SourceFileLoader(mod_name, filepath).load_module()
         except ImportError:
             assert(module)
         cfg.filemode = True
         cfg.filename = path.join(path.dirname(__file__), 'samples/') + mod_name + '.bin'
         foundtarget = False
         for target in cfg.targets:
             if target['OS'] == module.OS:
                 foundtarget = [target]
         self.assertTrue(foundtarget)
         sys.stdout = StringIO() # Suppress output
         address, page = screenlock.attack(foundtarget)
         sys.stdout = sys.__stdout__ # Restore output
         #print(address & 0x00000fff)
         #print(module.offset)
         self.assertEqual(address & 0x00000fff, module.offset)
         self.assertEqual(page, module.page)
Example #2
0
 def test_screenlock(self):
     for sample in self.samples:
         settings = imp.reload(inception.settings)
         settings.startaddress = 0x00000000
         mod_name = sample[0]
         filepath = sample[1]
         #util.msg('T', 'Testing sample {0}'.format(mod_name))
         try:
             module = imp.load_source(mod_name, filepath)
         except ImportError:
             assert (module)
         settings.filemode = True
         settings.filename = path.join(path.dirname(__file__),
                                       '../samples/') + mod_name + '.bin'
         foundtarget = False
         for target in settings.targets:
             if target['OS'] == module.OS:
                 foundtarget = [target]
         self.assertTrue(foundtarget)
         #util.msg('T', 'Found target: {0}'.format(foundtarget[0]['OS']))
         sys.stdout = StringIO()  # Supress output
         address, page = screenlock.attack(foundtarget)
         sys.stdout = sys.__stdout__  # Restore output
         self.assertEqual(address & 0x00000fff, module.offset)
         self.assertEqual(page, module.page)
Example #3
0
 def test_screenlock(self):
     for sample in self.samples:
         cfg = imp.reload(inception.cfg)
         cfg.startaddress = 0x00000000
         mod_name = sample[0]
         filepath = sample[1]
         try:
             module = imp.load_source(mod_name, filepath)
         except ImportError:
             assert (module)
         cfg.filemode = True
         cfg.filename = path.join(path.dirname(__file__),
                                  'samples/') + mod_name + '.bin'
         foundtarget = False
         for target in cfg.targets:
             if target['OS'] == module.OS:
                 foundtarget = [target]
         self.assertTrue(foundtarget)
         sys.stdout = StringIO()  # Suppress output
         address, page = screenlock.attack(foundtarget)
         sys.stdout = sys.__stdout__  # Restore output
         self.assertEqual(address & 0x00000fff, module.offset)
         self.assertEqual(page, module.page)
Example #4
0
 def test_screenlock(self):
     for sample in self.samples:
         settings = imp.reload(inception.settings)
         settings.startaddress = 0x00000000
         mod_name = sample[0]
         filepath = sample[1]
         #util.msg('T', 'Testing sample {0}'.format(mod_name))
         try:
             module = imp.load_source(mod_name, filepath)
         except ImportError:
             assert(module)
         settings.filemode = True
         settings.filename = path.join(path.dirname(__file__), '../samples/') + mod_name + '.bin'
         foundtarget = False
         for target in settings.targets:
             if target['OS'] == module.OS:
                 foundtarget = [target]
         self.assertTrue(foundtarget)
         #util.msg('T', 'Found target: {0}'.format(foundtarget[0]['OS']))
         sys.stdout = StringIO() # Suppress output
         address, page = screenlock.attack(foundtarget)
         sys.stdout = sys.__stdout__ # Restore output
         self.assertEqual(address & 0x00000fff, module.offset)
         self.assertEqual(page, module.page)