python类AF_NETLINK的实例源码

socketcall_call.py 文件源码 项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def createText(self):
        syscall = self.function.name
        name = self.name
        argtype = self.type
        value = self.value
        if syscall == "socket":
            if name == "family":
                return SOCKET_FAMILY.get(value, value)
            if name == "type":
                return SOCKET_TYPE.get(value, value)
            if name == "protocol":
                return SOCKET_PROTOCOL.get(value, value)
        if syscall == "setsockopt":
            if name == "level":
                return SETSOCKOPT_LEVEL.get(value, value)
            if name == "optname":
                return SETSOCKOPT_OPTNAME.get(value, value)
            if name == "optval":
                optlen = self.function["optlen"].value
                if optlen == 4:
                    text = self.function.process.readStruct(self.value, c_int)
                    return self.formatPointer("<%s>" % text, self.value)
        if argtype == "struct sockaddr*":
            address = self.value
            addr = self.function.process.readStruct(address, sockaddr)
            family = addr.family
            if family == AF_INET:
                return self.readStruct(self.value, sockaddr_in)
            elif family == AF_FILE:
                return self.readStruct(self.value, sockaddr_un)
            elif family == AF_NETLINK:
                return self.readStruct(self.value, sockaddr_nl)
            else:
                family = SOCKET_FAMILY.get(family, family)
                return self.formatPointer("<sockaddr family=%s>" % family, address)
        return None
Netlink.py 文件源码 项目:enigma2 作者: OpenLD 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self):
        NETLINK_KOBJECT_UEVENT = 15 # hasn't landed in socket yet, see linux/netlink.h
        socket.socket.__init__(self, socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)
        self.bind((os.getpid(), -1))
Netlink.py 文件源码 项目:enigma2 作者: Openeight 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        NETLINK_KOBJECT_UEVENT = 15 # hasn't landed in socket yet, see linux/netlink.h
        socket.socket.__init__(self, socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)
        self.bind((os.getpid(), -1))
Netlink.py 文件源码 项目:enigma2 作者: BlackHole 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self):
        NETLINK_KOBJECT_UEVENT = 15 # hasn't landed in socket yet, see linux/netlink.h
        socket.socket.__init__(self, socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)
        self.bind((os.getpid(), -1))
socketcall.py 文件源码 项目:python-ptrace 作者: vstinner 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def formatSockaddr(argument, argtype):
    address = argument.value
    value = argument.function.process.readStruct(address, sockaddr)
    family = value.family
    if family == AF_INET:
        return argument.readStruct(address, sockaddr_in)
    if family == AF_INET6:
        return argument.readStruct(address, sockaddr_in6)
    if family == AF_FILE:
        return argument.readStruct(address, sockaddr_un)
    if RUNNING_LINUX:
        if family == AF_NETLINK:
            return argument.readStruct(address, sockaddr_nl)
    family = SOCKET_FAMILY.get(family, family)
    return argument.formatPointer("<sockaddr family=%s>" % family, address)
Netlink.py 文件源码 项目:enigma2-openpli-fulan 作者: Taapat 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self):
        NETLINK_KOBJECT_UEVENT = 15 # hasn't landed in socket yet, see linux/netlink.h
        socket.socket.__init__(self, socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)
        self.bind((os.getpid(), -1))


问题


面经


文章

微信
公众号

扫码关注公众号