Exemplo n.º 1
0
 def setupGDT(self):
     # setup gdt
     if self.ql.archtype == QL_ARCH.X86:
         self.gdtm = GDTManager(self.ql)
         ql_x86_register_cs(self)
         ql_x86_register_ds_ss_es(self)
         ql_x86_register_fs(self)
         ql_x86_register_gs(self)
     elif self.ql.archtype == QL_ARCH.X8664:
         ql_x8664_set_gs(self.ql)
Exemplo n.º 2
0
    def load(self):
        self.futexm = futex.QlLinuxFutexManagement()

        # ARM
        if self.ql.archtype == QL_ARCH.ARM:
            self.ql.arch.enable_vfp()
            self.ql.hook_intno(self.hook_syscall, 2)
            self.thread_class = thread.QlLinuxARMThread
            self.ql.arch.init_get_tls()

        # MIPS32
        elif self.ql.archtype == QL_ARCH.MIPS:
            self.ql.hook_intno(self.hook_syscall, 17)
            self.thread_class = thread.QlLinuxMIPS32Thread

        # ARM64
        elif self.ql.archtype == QL_ARCH.ARM64:
            self.ql.arch.enable_vfp()
            self.ql.hook_intno(self.hook_syscall, 2)
            self.thread_class = thread.QlLinuxARM64Thread

        # X86
        elif self.ql.archtype == QL_ARCH.X86:
            self.gdtm = GDTManager(self.ql)
            ql_x86_register_cs(self)
            ql_x86_register_ds_ss_es(self)
            self.ql.hook_intno(self.hook_syscall, 0x80)
            self.thread_class = thread.QlLinuxX86Thread

        # X8664
        elif self.ql.archtype == QL_ARCH.X8664:
            self.gdtm = GDTManager(self.ql)
            ql_x86_register_cs(self)
            ql_x86_register_ds_ss_es(self)
            self.ql.hook_insn(self.hook_syscall, UC_X86_INS_SYSCALL)
            # Keep test for _cc
            #self.ql.hook_insn(hook_posix_api, UC_X86_INS_SYSCALL)
            self.thread_class = thread.QlLinuxX8664Thread

        elif self.ql.archtype == QL_ARCH.RISCV:
            self.ql.arch.enable_float()
            self.ql.hook_intno(self.hook_syscall, 8)
            self.thread_class = None

        elif self.ql.archtype == QL_ARCH.RISCV64:
            self.ql.arch.enable_float()
            self.ql.hook_intno(self.hook_syscall, 8)
            self.thread_class = None

        for i in range(NR_OPEN):
            if getattr(self.fd[i], 'close_on_exec', 0):
                self.fd[i] = 0
Exemplo n.º 3
0
    def load(self):
        if self.ql.code:
            return

        if self.ql.archtype == QL_ARCH.ARM64:
            self.ql.arch.enable_vfp()
            self.ql.hook_intno(self.hook_syscall, 2)
            self.ql.hook_intno(self.hook_sigtrap, 7)

        elif self.ql.archtype == QL_ARCH.X8664:
            self.ql.hook_insn(self.hook_syscall, UC_X86_INS_SYSCALL)
            self.gdtm = GDTManager(self.ql)
            ql_x86_register_cs(self)
            ql_x86_register_ds_ss_es(self)
Exemplo n.º 4
0
    def load(self):
        self.futexm = futex.QlLinuxFutexManagement()

        # ARM
        if self.ql.archtype == QL_ARCH.ARM:
            self.ql.arch.enable_vfp()
            self.ql.hook_intno(self.hook_syscall, 2)
            self.thread_class = thread.QlLinuxARMThread
            utils.ql_arm_init_get_tls(self.ql)

        # MIPS32
        elif self.ql.archtype == QL_ARCH.MIPS:
            self.ql.hook_intno(self.hook_syscall, 17)
            self.thread_class = thread.QlLinuxMIPS32Thread

        # ARM64
        elif self.ql.archtype == QL_ARCH.ARM64:
            self.ql.arch.enable_vfp()
            self.ql.hook_intno(self.hook_syscall, 2)
            self.thread_class = thread.QlLinuxARM64Thread

        # X86
        elif self.ql.archtype == QL_ARCH.X86:
            self.gdtm = GDTManager(self.ql)
            ql_x86_register_cs(self)
            ql_x86_register_ds_ss_es(self)
            self.ql.hook_intno(self.hook_syscall, 0x80)
            self.thread_class = thread.QlLinuxX86Thread

        # X8664
        elif self.ql.archtype == QL_ARCH.X8664:
            self.gdtm = GDTManager(self.ql)
            ql_x86_register_cs(self)
            ql_x86_register_ds_ss_es(self)
            self.ql.hook_insn(self.hook_syscall, UC_X86_INS_SYSCALL)
            # Keep test for _cc
            #self.ql.hook_insn(hook_posix_api, UC_X86_INS_SYSCALL)
            self.thread_class = thread.QlLinuxX8664Thread
Exemplo n.º 5
0
 def load(self):
     self.ql.hook_insn(self.hook_syscall, UC_X86_INS_SYSCALL)
     self.gdtm = GDTManager(self.ql)
     ql_x86_register_cs(self)
     ql_x86_register_ds_ss_es(self)