def test_cmd_patch_qword(self): before = gdb_start_silent_cmd_last_line("display/8bx $pc") after = gdb_start_silent_cmd_last_line("patch qword $pc 0x4242424242424242", after=["display/8bx $pc",]) self.assertNoException(after) r = difflib.SequenceMatcher(None, before, after).ratio() self.assertTrue( r > 0.50 ) return
def test_cmd_patch_qword(self): before = gdb_start_silent_cmd_last_line("display/8bx $pc") after = gdb_start_silent_cmd_last_line("patch qword $pc 0x4242424242424242", after=["display/8bx $pc",]) self.assertNoException(after) r = difflib.SequenceMatcher(None, before, after).ratio() self.assertTrue( r > 0.50 ) return
def test_cmd_edit_flags(self): # force enable flag res = gdb_start_silent_cmd_last_line("edit-flags +carry") self.assertNoException(res) self.assertIn("CARRY ", res) # force disable flag res = gdb_start_silent_cmd_last_line("edit-flags -carry") self.assertNoException(res) self.assertIn("carry ", res) # toggle flag res = gdb_start_silent_cmd_last_line("edit-flags ~carry") self.assertNoException(res) self.assertIn("CARRY ", res) return
def test_cmd_patch_qword(self): res = gdb_start_silent_cmd_last_line( "patch qword $pc 0xcccccccccccccccc", after=[ "display/8bx $pc", ]) self.assertNoException(res) self.assertRegex(res, r"(0xcc\s*)(\1\1\1\1\1\1)0xcc") return
def test_cmd_patch_byte(self): res = gdb_start_silent_cmd_last_line("patch byte $pc 0xcc", after=[ "display/8bx $pc", ]) self.assertNoException(res) self.assertRegex(res, r"0xcc\s*0x[^c]{2}") return
def test_cmd_edit_flags(self): # force enable flag res = gdb_start_silent_cmd_last_line("edit-flags +carry") self.assertNoException(res) self.assertIn(b"CARRY ", res) # force disable flag res = gdb_start_silent_cmd_last_line("edit-flags -carry") self.assertNoException(res) self.assertIn(b"carry ", res) # toggle flag before = gdb_start_silent_cmd_last_line("edit-flags") self.assertNoException(before) after = gdb_start_silent_cmd_last_line("edit-flags ~carry") self.assertNoException(after) s = difflib.SequenceMatcher(None, before, after) self.assertTrue(s.ratio() > 0.90) return
def test_cmd_edit_flags(self): # force enable flag res = gdb_start_silent_cmd_last_line("edit-flags +carry") self.assertNoException(res) self.assertIn("CARRY ", res) # force disable flag res = gdb_start_silent_cmd_last_line("edit-flags -carry") self.assertNoException(res) self.assertIn("carry ", res) # toggle flag before = gdb_start_silent_cmd_last_line("edit-flags") self.assertNoException(before) after = gdb_start_silent_cmd_last_line("edit-flags ~carry") self.assertNoException(after) s = difflib.SequenceMatcher(None, before, after) self.assertTrue(s.ratio() > 0.90) return
def test_cmd_patch_string(self): res = gdb_start_silent_cmd_last_line( "patch string $sp \"Gef!Gef!Gef!Gef!\"", after=[ "grep Gef!Gef!Gef!Gef!", ]) self.assertNoException(res) self.assertIn("Gef!Gef!Gef!Gef!", res) return
def test_cmd_patch_string(self): res = gdb_start_silent_cmd_last_line("patch string $sp \"Gef!Gef!Gef!Gef!\"", after=["grep Gef!Gef!Gef!Gef!",]) self.assertNoException(res) self.assertIn("Gef!Gef!Gef!Gef!", res) return