Example #1
0
def test_asm(test_target, syntax, source, result, target):
    try:
        output = pwny.asm(source, syntax=syntax, target=test_target)
    except RuntimeError:
        # Toolchain wasn't found. Unfortunate, but unavoidable on travis-ci atm.
        pytest.skip('No suitable binutils was found for %s' % target)
    assert output == result, 'Got %r, expected %r' % (output, result)
Example #2
0
def test_asm(test_target, syntax, source, result, target):
    try:
        output = pwny.asm(source, syntax=syntax, target=test_target)
    except RuntimeError:
        # Toolchain wasn't found. Unfortunate, but unavoidable on travis-ci atm.
        pytest.skip('No suitable binutils was found for %s' % target)
    assert output == result, 'Got %r, expected %r' % (output, result)
Example #3
0
def test_asm_nasm_unsupported_arch():
    pwny.asm('mov al, [0xced]', syntax=pwny.AsmSyntax.nasm, target=target_arm_64_le)
Example #4
0
def test_asm_unsupported_target():
    pwny.asm('mov al, [0xced]', target=target_unknown_32)
Example #5
0
def test_asm_syntax_error():
    pwny.asm('mov ced, 3')
Example #6
0
def test_asm_unsupported_target():
    pwny.asm('mov al, [0xced]', target=target_unknown_32)
Example #7
0
def test_asm_syntax_error():
    pwny.asm('mov ced, 3', target=target_x86_32)
Example #8
0
def test_asm_unsupported_target():
    pwny.asm(SOURCE_ASM, target=target_arm_32)
Example #9
0
def test_asm_with_target_x86_64():
    assert pwny.asm(SOURCE_ASM, target=target_x86_64) == RESULT_BIN_64
Example #10
0
def test_asm_syntax_error():
    pwny.asm('mov ced, 3')
Example #11
0
def test_asm_with_default_target():
    # Note: set up sets default arch to x86 32bit
    assert pwny.asm(SOURCE_ASM) == RESULT_BIN_32
Example #12
0
def test_asm_unsupported_target():
    pwny.asm(SOURCE_ASM, target=target_arm_32)
Example #13
0
def test_asm_with_target_x86_64():
    assert pwny.asm(SOURCE_ASM, target=target_x86_64) == RESULT_BIN_64
Example #14
0
def test_asm_with_default_target():
    # Note: set up sets default arch to x86 32bit
    assert pwny.asm(SOURCE_ASM) == RESULT_BIN_32
Example #15
0
def test_asm_nasm_unsupported_arch():
    pwny.asm('mov al, [0xced]',
             syntax=pwny.AsmSyntax.nasm,
             target=target_arm_64_le)