示例#1
0
 def __init__(self, ql, clientsocket, exit_point, mappings):
     super(GDBSERVERsession, self).__init__()
     self.ql = ql
     self.clientsocket = clientsocket
     self.netin = clientsocket.makefile('r')
     self.netout = clientsocket.makefile('w')
     self.last_pkt = None
     self.en_vcont = False
     self.pc_reg = self.ql.reg_pc
     self.sp_reg = self.ql.reg_sp
     self.exe_abspath = (os.path.abspath(self.ql.filename[0]))
     self.rootfs_abspath = (os.path.abspath(self.ql.rootfs))
     self.gdb = qldbg.Qldbg()
     self.gdb.initialize(self.ql, exit_point=exit_point, mappings=mappings)
     if self.ql.ostype in (QL_LINUX, QL_FREEBSD):
         self.gdb.bp_insert(self.ql.loader.elf_entry)
     else:
         self.gdb.bp_insert(self.ql.entry_point)
示例#2
0
 def __init__(self, ql, clientsocket, exit_point, mappings):
     super(GDBSERVERsession, self).__init__()
     self.ql             = ql
     self.clientsocket   = clientsocket
     self.netin          = clientsocket.makefile('r')
     self.netout         = clientsocket.makefile('w')
     self.last_pkt       = None
     self.gdb            = qldbg.Qldbg()
     self.gdb.initialize(self.ql, exit_point=exit_point, mappings=mappings)
     self.exe_abspath    = (os.path.abspath(self.ql.filename[0]))
     self.rootfs_abspath = (os.path.abspath(self.ql.rootfs)) 
     
     if self.ql.ostype in (QL_OS.LINUX, QL_OS.FREEBSD) and not self.ql.shellcoder:
         self.entry_point = self.ql.os.elf_entry
     else:
         self.entry_point = self.ql.os.entry_point
         
     self.gdb.bp_insert(self.entry_point)
示例#3
0
    def __init__(self, ql, clientsocket, exit_point, mappings):
        super(GDBSERVERsession, self).__init__()
        self.ql = ql
        self.clientsocket = clientsocket
        self.netin = clientsocket.makefile('r')
        self.netout = clientsocket.makefile('w')
        self.last_pkt = None
        self.gdb = qldbg.Qldbg()
        self.gdb.initialize(self.ql, exit_point=exit_point, mappings=mappings)
        self.exe_abspath = (os.path.abspath(self.ql.filename[0]))
        self.rootfs_abspath = (os.path.abspath(self.ql.rootfs))

        if self.ql.ostype in (QL_OS.LINUX,
                              QL_OS.FREEBSD) and not self.ql.shellcoder:
            self.entry_point = self.ql.os.elf_entry
        else:
            self.entry_point = self.ql.os.entry_point

        self.gdb.bp_insert(self.entry_point)

        #Setup register tables, order of tables is important
        self.tables = {
            QL_ARCH.X86:
            list({
                **x86_reg_map_32,
                **x86_reg_map_misc,
                **x86_reg_map_st
            }.keys()),
            QL_ARCH.X8664:
            list({
                **x86_reg_map_64,
                **x86_reg_map_misc,
                **x86_reg_map_st
            }.keys()),
            QL_ARCH.ARM:
            list({**arm_reg_map}.keys()),
            QL_ARCH.ARM64:
            list({**arm64_reg_map}.keys()),
            QL_ARCH.MIPS:
            list({**mips_reg_map}.keys()),
        }