| 401 | del ql |
| 402 | |
| 403 | def test_mcu_hackme_stm32f429(self): |
| 404 | ql = Qiling(["../examples/rootfs/mcu/stm32f429/bof.elf"], |
| 405 | archtype=QL_ARCH.CORTEX_M, ostype=QL_OS.MCU, env=stm32f429, verbose=QL_VERBOSE.DISABLED) |
| 406 | |
| 407 | ql.hw.create('rcc') |
| 408 | ql.hw.create('usart2') |
| 409 | ql.hw.create('usart3') |
| 410 | |
| 411 | snapshot = ql.save(hw=True) |
| 412 | |
| 413 | ql.restore(snapshot) |
| 414 | ql.hw.usart3.send(b'hbckme\nabc\n') |
| 415 | ql.run(count=20000) |
| 416 | |
| 417 | self.assertEqual(ql.hw.usart2.recv(), b'') |
| 418 | self.assertEqual(ql.hw.usart3.recv(), b'Wrong password!\n') |
| 419 | |
| 420 | ql.restore(snapshot) |
| 421 | ql.hw.usart3.send(b'hackme\naaaaaaaaaaaaaaaaaaaa\xa9\x05\n') |
| 422 | ql.run(count=40000) |
| 423 | |
| 424 | self.assertEqual(ql.hw.usart2.recv(), b'Nice Hack!\n') |
| 425 | self.assertEqual(ql.hw.usart3.recv(), b'Welcome to the world of Hacking!\naaaaaaaaaaaaaaaaaaaa\xa9\x05\n') |
| 426 | |
| 427 | def test_mcu_fastmode_stm32f429(self): |
| 428 | ql = Qiling(["../examples/rootfs/mcu/stm32f429/bof.elf"], |