Example #1
0
 def test_ymm(self):
     """Check ymm on 64 bits arch."""
     ymm = Register(REG.YMM1, 0x112233445566778899aabbccddeeff00)
     self.assertEqual(ymm.getBitSize(), 256)
     ymm.setConcreteValue(
         0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00)
     self.assertEqual(
         ymm.getConcreteValue(),
         0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00)
Example #2
0
 def test_zmm(self):
     """Check zmm on 64 bits arch."""
     zmm = Register(REG.ZMM2, 0)
     self.assertEqual(zmm.getBitSize(), 512)
     zmm.setConcreteValue(
         0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00
     )
     self.assertEqual(
         zmm.getConcreteValue(),
         0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00
     )
Example #3
0
    def test_concrete_value(self):
        """Check concrete value modification."""
        self.assertEqual(self.reg.getConcreteValue(), 0)

        # immutable
        self.reg.setConcreteValue(0x1122334455667788)
        self.assertEqual(self.reg.getConcreteValue(), 0)

        # mutable
        reg2 = Register(self.reg)
        reg2.setConcreteValue(0x1122334455667788)
        self.assertEqual(reg2.getConcreteValue(), 0x1122334455667788)
Example #4
0
    def test_concrete_value(self):
        """Check concrete value modification."""
        self.assertEqual(self.reg.getConcreteValue(), 0)

        # immutable
        self.reg.setConcreteValue(0x1122334455667788)
        self.assertEqual(self.reg.getConcreteValue(), 0)

        # mutable
        reg2 = Register(self.reg)
        reg2.setConcreteValue(0x1122334455667788)
        self.assertEqual(reg2.getConcreteValue(), 0x1122334455667788)
Example #5
0
    def test_set_concrete_value(self):
        """Check register value modification."""
        for reg in (REG.AH, REG.AL):
            # OK
            reg = Register(reg)
            reg.setConcreteValue(0xff)
            # Not OK
            # TODO : Be more specific on the raise exception type
            with self.assertRaises(Exception):
                reg.setConcreteValue(0xff + 1)

        reg = Register(REG.ZF)
        reg.setConcreteValue(1)
        with self.assertRaises(Exception):
            reg.setConcreteValue(2)
Example #6
0
    def test_set_concrete_value(self):
        """Check register value modification."""
        for reg in (REG.AH, REG.AL):
            # OK
            reg = Register(reg)
            reg.setConcreteValue(0xff)
            # Not OK
            # TODO : Be more specific on the raise exception type
            with self.assertRaises(Exception):
                reg.setConcreteValue(0xff + 1)

        reg = Register(REG.ZF)
        reg.setConcreteValue(1)
        with self.assertRaises(Exception):
            reg.setConcreteValue(2)
Example #7
0
 def test_zmm(self):
     """Check zmm on 64 bits arch."""
     zmm = Register(REG.ZMM2, 0)
     self.assertEqual(zmm.getBitSize(), 512)
     zmm.setConcreteValue(0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00)
     self.assertEqual(zmm.getConcreteValue(), 0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00)
Example #8
0
 def test_ymm(self):
     """Check ymm on 64 bits arch."""
     ymm = Register(REG.YMM1, 0x112233445566778899aabbccddeeff00)
     self.assertEqual(ymm.getBitSize(), 256)
     ymm.setConcreteValue(0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00)
     self.assertEqual(ymm.getConcreteValue(), 0x112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00)