Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(0, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(1, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(2, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(3, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(32, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(64, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0x12345678, 32), self.astCtxt.bv(0x12345678, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(0, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(1, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(2, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(3, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(32, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(64, 32)),
self.astCtxt.bvrol(self.astCtxt.bv(0xf2345678, 32), self.astCtxt.bv(0x12345678, 32)),
]
self.Triton.enableMode(MODE.SYMBOLIC_INDEX_ROTATION, False)
self.check_ast(tests)
self.Triton.enableMode(MODE.SYMBOLIC_INDEX_ROTATION, True)
self.check_ast(tests)
def test_taint_through_pointers(self):
ctx = TritonContext()
ctx.setArchitecture(ARCH.X86_64)
ctx.enableMode(MODE.TAINT_THROUGH_POINTERS, False)
ctx.taintRegister(ctx.registers.rax)
self.assertTrue(ctx.isRegisterTainted(ctx.registers.rax))
inst = Instruction(b"\x48\x0F\xB6\x18") # movzx rbx,BYTE PTR [rax]
inst.setAddress(0)
ctx.processing(inst)
self.assertFalse(ctx.isRegisterTainted(ctx.registers.rbx))
###########
ctx = TritonContext()
ctx.setArchitecture(ARCH.X86_64)
ctx.enableMode(MODE.TAINT_THROUGH_POINTERS, True)
def setUp(self):
"""Define the arch and modes."""
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.Triton.enableMode(MODE.ALIGNED_MEMORY, True)
self.Triton.enableMode(MODE.TAINT_THROUGH_POINTERS, True)
super(TestSymbolicEngineAlignedAndTaintPtr, self).setUp()
def setUp(self):
"""Define the arch and modes."""
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.Triton.enableMode(MODE.ALIGNED_MEMORY, True)
self.Triton.enableMode(MODE.ONLY_ON_SYMBOLIZED, True)
super(TestSymbolicEngineAlignedOnlySymbolized, self).setUp()
def test_1(self):
ctx = TritonContext()
ctx.setArchitecture(ARCH.X86_64)
ctx.setMode(MODE.ONLY_ON_TAINTED, False)
self.assertEqual(ctx.isModeEnabled(MODE.ONLY_ON_TAINTED), False)
inst = Instruction(b"\x48\x89\xc3") # mov rbx, rax
self.assertTrue(ctx.processing(inst))
self.assertTrue(checkAstIntegrity(inst))
self.assertEqual(len(inst.getReadRegisters()), 1)
self.assertEqual(len(inst.getWrittenRegisters()), 2)
ctx.setMode(MODE.ONLY_ON_TAINTED, True)
self.assertEqual(ctx.isModeEnabled(MODE.ONLY_ON_TAINTED), True)
self.assertTrue(ctx.processing(inst))
self.assertTrue(checkAstIntegrity(inst))
self.assertEqual(len(inst.getSymbolicExpressions()), 0)
for i in l:
if i[1] > 0:
print '%s: %s' %(i[0], '{:,}'.format(i[1]))
print '============================================================='
return
if __name__ == '__main__':
# Triton Context
ctx = getTritonContext()
# Start JIT at the entry point
startAnalysisFromEntry()
# Use AST Dictionaries
ctx.enableMode(MODE.AST_DICTIONARIES, True)
# Add callbacks
insertCall(cb_fini, INSERT_POINT.FINI)
# Run Program
runProgram()