# Path: shellcodes/thumb/syscall.py
# def get(no):
# 
# Path: shellcodes/arm/syscall.py
# def get(no):
# 
# Path: shellcodes/arm64/syscall.py
# def get(no):


from optparse import OptionParser
from unicorn import *
from unicorn.arm_const import *
from unicorn.arm64_const import *
from capstone import *
from capstone.arm import *
from struct import unpack
from ARMSCGen import *
from shellcodes.thumb import syscall as th_syscall
from shellcodes.arm   import syscall as arm_syscall
from shellcodes.arm64 import syscall as arm64_syscall
    from pygments import highlight
    from pygments.lexers import get_lexer_by_name
    from pygments.formatters import TerminalFormatter
import os, sys

    reg_dump(uc, True)
    _print_reg = ''
    if g_uc_arch == UC_ARCH_ARM64:
        _print_reg = 'X'
        syscall_no =  get_reg( uc, UC_ARM64_REG_X8 ) 
        syscall_name = arm64_syscall.get( syscall_no )
        PC =  get_reg( uc, UC_ARM64_REG_PC ) 
    else:
        _print_reg = 'R'
        syscall_no =  get_reg( uc, UC_ARM_REG_R7 ) 
        PC =  get_reg( uc, UC_ARM_REG_PC ) 
        if g_uc_mode == UC_MODE_THUMB:
            syscall_name = th_syscall.get( syscall_no )
        else:
            syscall_name = arm_syscall.get( syscall_no )

    msg =  BLUE + "syscall: " + CRESET + RED + syscall_name + CRESET
    print msg

    for n in xrange(3):
        _reg =  get_reg( uc, g_target_regs[n]['reg'] )
        _value = get_mem( uc, _reg, 0x10 )
        if _value == bytearray(0x10):
            msg = CRESET + GREEN + "     "+_print_reg+str(n)+": " + CRESET + WHITE + \
            hex(_reg) + CRESET
        else:
            (_hex, _val) = hdump(_value)
            msg = CRESET + GREEN + "     "+_print_reg+str(n)+": " + CRESET + _hex + '  ' + \
            WHITE + _val + CRESET

# Path: shellcodes/thumb/syscall.py
# def get(no):
# 
# Path: shellcodes/arm/syscall.py
# def get(no):
# 
# Path: shellcodes/arm64/syscall.py
# def get(no):


# Path: sctest/sctest.py
from optparse import OptionParser
from unicorn import *
from unicorn.arm_const import *
from unicorn.arm64_const import *
from capstone import *
from capstone.arm import *
from struct import unpack
from ARMSCGen import *
from shellcodes.thumb import syscall as th_syscall
from shellcodes.arm   import syscall as arm_syscall
from shellcodes.arm64 import syscall as arm64_syscall
    from pygments import highlight
    from pygments.lexers import get_lexer_by_name
    from pygments.formatters import TerminalFormatter
import os, sys


    reg_dump(uc, True)
    _print_reg = ''
    if g_uc_arch == UC_ARCH_ARM64:
        _print_reg = 'X'
        syscall_no =  get_reg( uc, UC_ARM64_REG_X8 ) 
        syscall_name = arm64_syscall.get( syscall_no )
        PC =  get_reg( uc, UC_ARM64_REG_PC ) 
    else:
        _print_reg = 'R'
        syscall_no =  get_reg( uc, UC_ARM_REG_R7 ) 
        PC =  get_reg( uc, UC_ARM_REG_PC ) 
        if g_uc_mode == UC_MODE_THUMB:
            syscall_name = th_syscall.get( syscall_no )
        else:
            syscall_name = arm_syscall.get( syscall_no )

    msg =  BLUE + "syscall: " + CRESET + RED + syscall_name + CRESET
    print msg

    for n in xrange(3):
        _reg =  get_reg( uc, g_target_regs[n]['reg'] )
        _value = get_mem( uc, _reg, 0x10 )
        if _value == bytearray(0x10):
            msg = CRESET + GREEN + "     "+_print_reg+str(n)+": " + CRESET + WHITE + \
            hex(_reg) + CRESET
        else:
            (_hex, _val) = hdump(_value)
            msg = CRESET + GREEN + "     "+_print_reg+str(n)+": " + CRESET + _hex + '  ' + \
            WHITE + _val + CRESET

        print msg