Example #1
0
 def test_asm_pointerReatribution3_pie(self):
     self.assertTrue(dis_reasm_test(asm_dir/'ex_pointerReatribution3_pie','ex',
         extra_compile_flags=['-pie'],
         c_compilers=['gcc'],
         cxx_compilers=['g++'],
         optimizations=[''],
         strip=True))
Example #2
0
    def test_virtualDispatch(self): self.assertTrue(dis_reasm_test(ex_dir/'ex_virtualDispatch','ex',reassembly_compiler='g++'))


    # Examples that fail to reassemble

    #thread local storage
    def test_threads(self): self.assertTrue(dis_reasm_test(ex_dir/'ex_threads','ex',reassembly_compiler='g++',skip_reassemble=True))
Example #3
0
 def test_asm_weird_section(self):
     self.assertTrue(
         dis_reasm_test(asm_dir / 'ex_weird_sections',
                        'ex',
                        c_compilers=['gcc'],
                        cxx_compilers=['g++'],
                        optimizations=['']))
Example #4
0
 def test_asm_pointerReatribution3_clang(self):
     self.assertTrue(
         dis_reasm_test(asm_dir / 'ex_pointerReatribution3_clang',
                        'ex',
                        c_compilers=['gcc'],
                        cxx_compilers=['g++'],
                        optimizations=['']))
Example #5
0
 def test_memberPointer(self):
     self.assertTrue(
         dis_reasm_test(
             ex_dir / "ex_memberPointer",
             "ex",
             reassembly_compiler="g++",
             strip=True,
         ))
Example #6
0
 def test_exceptions3(self):
     self.assertTrue(
         dis_reasm_test(
             ex_dir / "ex_exceptions3",
             "ex",
             reassembly_compiler="g++",
             strip=True,
         ))
Example #7
0
 def test_threads(self):
     self.assertTrue(
         dis_reasm_test(
             ex_dir / "ex_threads",
             "ex",
             reassembly_compiler="g++",
             reassemble_function=skip_reassemble,
         ))
Example #8
0
 def test_virtualDispatch(self):
     self.assertTrue(
         dis_reasm_test(
             ex_dir / "ex_virtualDispatch",
             "ex",
             reassembly_compiler="g++",
             strip=True,
         ))
Example #9
0
 def test_ex1_static(self):
     self.assertTrue(
         dis_reasm_test(ex_dir / 'ex1',
                        'ex',
                        skip_reassemble=True,
                        extra_compile_flags=['-static'],
                        c_compilers=['gcc'],
                        cxx_compilers=['g++'],
                        optimizations=['-O0']))
Example #10
0
 def test_asm_weird_section(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_weird_sections",
             "ex",
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
         ))
Example #11
0
 def test_asm_relative_switch_sizes(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_relative_switch_sizes",
             "ex",
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
         ))
Example #12
0
 def test_asm_switch_in_code(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_switch_in_code",
             "ex",
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
         ))
Example #13
0
 def test_loop_instructions(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_loop_instructions",
             "ex",
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
         ))
Example #14
0
 def test_asm_pointerReatribution3_clang(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_pointerReatribution3_clang",
             "ex",
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
         ))
Example #15
0
 def test_arm64_binrats_hello(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "hello",
             "hello",
             c_compilers=["aarch64-linux-gnu-gcc"],
             cxx_compilers=["aarch64-linux-gnu-g++"],
             reassembly_compiler="aarch64-linux-gnu-gcc",
         )
     )
Example #16
0
 def test_asm_relative_switch_through_stack(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_relative_switch_through_stack",
             "ex",
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
             strip=True,
         ))
Example #17
0
 def test_asm_pointerReatribution3_pie(self):
     self.assertTrue(
         dis_reasm_test(
             asm_dir / "ex_pointerReatribution3_pie",
             "ex",
             extra_compile_flags=["-pie"],
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=[""],
         ))
Example #18
0
 def test_ex1_static(self):
     self.assertTrue(
         dis_reasm_test(
             ex_dir / "ex1",
             "ex",
             reassemble_function=skip_reassemble,
             extra_compile_flags=["-static"],
             c_compilers=["gcc"],
             cxx_compilers=["g++"],
             optimizations=["-O0"],
         ))
Example #19
0
 def test_fcf_protection(self):
     # check if the -fcf-protection is supported by the compiler (only newer versions support it)
     current_dir=os.getcwd()
     with cd(ex_dir/'ex1'):
         flag_supported=compile('gcc','g++','',['-fcf-protection'])
     if flag_supported:
         self.assertTrue(dis_reasm_test(ex_dir/'ex1','ex',
             c_compilers=['gcc'],cxx_compilers=['g++'],
             optimizations=[''],
             extra_compile_flags=['-fcf-protection']))
     else:
         print('Flag -fcf-protection not supported')
Example #20
0
 def test_fcf_protection(self):
     # check if the -fcf-protection is supported by the compiler
     # (only newer versions support it)
     with cd(ex_dir / "ex1"):
         flag_supported = compile("gcc", "g++", "", ["-fcf-protection"])
     if flag_supported:
         self.assertTrue(
             dis_reasm_test(
                 ex_dir / "ex1",
                 "ex",
                 c_compilers=["gcc"],
                 cxx_compilers=["g++"],
                 optimizations=[""],
                 extra_compile_flags=["-fcf-protection"],
             ))
     else:
         print("Flag -fcf-protection not supported")
Example #21
0
 def test_pointerReatribution2(self):
     self.assertTrue(
         dis_reasm_test(ex_dir / "ex_pointerReatribution2", "ex"))
Example #22
0
 def test_noreturn(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_noreturn", "ex"))
Example #23
0
 def test_getoptlong(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_getoptlong", "ex"))
Example #24
0
 def test_fprintf(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_fprintf", "ex"))
Example #25
0
 def test_float(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_float", "ex"))
Example #26
0
 def test_false_pointer_array(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_false_pointer_array",
                                    "ex"))
Example #27
0
 def test_exceptions2(self):
     self.assertTrue(
         dis_reasm_test(ex_dir / "ex_exceptions2",
                        "ex",
                        reassembly_compiler="g++"))
Example #28
0
 def test_struct(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_struct", "ex", strip=True))
Example #29
0
 def test_switch(self):
     self.assertTrue(dis_reasm_test(ex_dir / "ex_switch", "ex", strip=True))
Example #30
0
 def test_uninitialized_data(self):
     self.assertTrue(
         dis_reasm_test(ex_dir / "ex_uninitialized_data", "ex", strip=True))