blob: 6924e427ec4855f525c2923498b230277694f403 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-
# Tests minimalistes pour valider la gestion des erreurs relevées.
from chrysacase import ChrysalideTestCase
from pychrysalide.analysis import LoadedBinary
from pychrysalide.analysis.contents import MemoryContent
from pychrysalide.arch import vmpa
from pychrysalide.format import FlatFormat
from pychrysalide.glibext import BinPortion
class TestFlatFormat(ChrysalideTestCase):
"""TestCase for format.FlatFormat."""
def testSimpleFlatFormatContent(self):
"""Load a simple content for a flat format."""
data = b'\x00\x00\x00\xef'
cnt = MemoryContent(data)
fmt = FlatFormat(cnt)
fmt.set_machine('armv7')
base = vmpa(0, 0)
p = BinPortion(BinPortion.BPC_CODE, base, cnt.size)
p.rights = BinPortion.PAC_READ | BinPortion.PAC_EXEC
fmt.register_user_portion(p)
binary = LoadedBinary(fmt)
binary.analyze_and_wait()
self.assertTrue(list(binary.processor.instrs)[0].keyword == 'svc')
|