Example #1
0
    def socket(self, emu, argv, ctx={}):
        """
        SOCKET WSAAPI socket(
          int af,
          int type,
          int protocol
        );
        """
        af, typ, protocol = argv

        fam_str = winsock.get_addr_family(af)
        sock_str = winsock.get_sock_type(typ)

        sock = self.netman.new_socket(fam_str, sock_str, protocol, 0)

        fd = sock.get_fd()

        argv[0] = fam_str
        argv[1] = sock_str

        return fd
Example #2
0
    def WSASocket(self, emu, argv, ctx={}):
        """
        SOCKET WSAAPI WSASocket(
          int                 af,
          int                 type,
          int                 protocol,
          LPWSAPROTOCOL_INFO  lpProtocolInfo,
          GROUP               g,
          DWORD               dwFlags
        );
        """
        af, typ, protocol, lpProtocolInfo, g, dwFlags = argv

        fam_str = winsock.get_addr_family(af)
        sock_str = winsock.get_sock_type(typ)

        sock = self.netman.new_socket(fam_str, sock_str, protocol, dwFlags)

        fd = sock.get_fd()

        argv[0] = fam_str
        argv[1] = sock_str

        return fd