# 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
    print BLUE + '[-------------------------------------code-------------------------------------]' + CRESET
    if g_uc_mode == UC_MODE_THUMB:
        pc_addr = ARM_REGS[15]['value'] - 2
        reg_disasm( pc_addr, str(uc.mem_read(pc_addr, 12)) )
    elif g_uc_arch == UC_ARCH_ARM:
        pc_addr = ARM_REGS[15]['value'] - 4
        reg_disasm( pc_addr, str(uc.mem_read(pc_addr, 20)) )
    else:
        pc_addr = ARM64_REGS[33]['value'] - 4
        reg_disasm( pc_addr, str(uc.mem_read(pc_addr, 20)) )

    if syscall:
        print BLUE + '[-----------------------------------syscall------------------------------------]' + CRESET 
    else:
        print BLUE + '[------------------------------------------------------------------------------]'+ CRESET

def reg_disasm(pc, data):
    md = Cs(g_cs_arch, g_cs_mode)
    md.detail = True
    totalSize = 0
    dat = ''

    current = 0
    for i in md.disasm(data, 0x0000):
        if i.size:
            _tmp = []
            for _x in str(i.bytes):
                _tmp.append(_x.encode('hex'))
            s = "%s" % ' '.join(_tmp)
        else:

# 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

    print BLUE + '[-------------------------------------code-------------------------------------]' + CRESET
    if g_uc_mode == UC_MODE_THUMB:
        pc_addr = ARM_REGS[15]['value'] - 2
        reg_disasm( pc_addr, str(uc.mem_read(pc_addr, 12)) )
    elif g_uc_arch == UC_ARCH_ARM:
        pc_addr = ARM_REGS[15]['value'] - 4
        reg_disasm( pc_addr, str(uc.mem_read(pc_addr, 20)) )
    else:
        pc_addr = ARM64_REGS[33]['value'] - 4
        reg_disasm( pc_addr, str(uc.mem_read(pc_addr, 20)) )

    if syscall:
        print BLUE + '[-----------------------------------syscall------------------------------------]' + CRESET 
    else:
        print BLUE + '[------------------------------------------------------------------------------]'+ CRESET

def reg_disasm(pc, data):
    md = Cs(g_cs_arch, g_cs_mode)
    md.detail = True
    totalSize = 0
    dat = ''

    current = 0
    for i in md.disasm(data, 0x0000):
        if i.size:
            _tmp = []
            for _x in str(i.bytes):
                _tmp.append(_x.encode('hex'))
            s = "%s" % ' '.join(_tmp)
        else:

            s = -1