11import pytest
22
3- from unicorn import Uc , UC_ARCH_MIPS , UC_MODE_32 , UC_MODE_BIG_ENDIAN
43from unicorn .mips_const import UC_MIPS_REG_PC
54
65from shellblocks .shellcode_step import ShellcodeStep
1615 (0xbc000000 , 0xbcf00010 ),
1716 (0x91000000 , 0x91000118 ),
1817])
19- def test_goto_sanity (temp_dir_path , goto_page_and_address ):
18+ def test_goto_sanity (get_mu , temp_dir_path , compiler_arch , goto_page_and_address ):
2019 # Generate shellcode
2120 # ------------------
2221 shellcode_address = 0xbfc00000
@@ -31,13 +30,13 @@ def test_goto_sanity(temp_dir_path, goto_page_and_address):
3130 0x1000
3231 )
3332
34- out_file = step .generate (temp_dir_path / step .nickname )
33+ out_file = step .generate (temp_dir_path / step .nickname , compiler_arch )
3534 shellcode = out_file .read_bytes ()
3635
3736 # Try to run shellcode
3837 # --------------------
3938
40- mu = Uc ( UC_ARCH_MIPS , UC_MODE_32 | UC_MODE_BIG_ENDIAN )
39+ mu = get_mu ( )
4140 mu .mem_map (shellcode_address , 0x2000 )
4241
4342 # write machine code to be emulated to memory
@@ -54,7 +53,7 @@ def test_goto_sanity(temp_dir_path, goto_page_and_address):
5453 (0xbcf00010 ),
5554 (0x91000118 ),
5655])
57- def test_goto_is_pic (temp_dir_path , shellcode_run_addr ):
56+ def test_goto_is_pic (get_mu , temp_dir_path , compiler_arch , shellcode_run_addr ):
5857 # Generate shellcode
5958 # ------------------
6059 shellcode_address = 0xbfc00000
@@ -71,13 +70,13 @@ def test_goto_is_pic(temp_dir_path, shellcode_run_addr):
7170 0x1000
7271 )
7372
74- out_file = step .generate (temp_dir_path / step .nickname )
73+ out_file = step .generate (temp_dir_path / step .nickname , compiler_arch )
7574 shellcode = out_file .read_bytes ()
7675
7776 # Try to run shellcode
7877 # --------------------
7978
80- mu = Uc ( UC_ARCH_MIPS , UC_MODE_32 | UC_MODE_BIG_ENDIAN )
79+ mu = get_mu ( )
8180 mu .mem_map (shellcode_run_sector , 0x2000 )
8281
8382 # write machine code to be emulated to memory
0 commit comments