def parseNetstatCmd(self, tcp=True, udp=True, ipv4=True, ipv6=True, <EOL>include_listen=True, only_listen=False,<EOL>show_users=False, show_procs=False,<EOL>resolve_hosts=False, resolve_ports=False, <EOL>resolve_users=True):
headers = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', <EOL>'<STR_LIT>', '<STR_LIT>','<STR_LIT>', '<STR_LIT>', <EOL>'<STR_LIT:state>']<EOL>args = []<EOL>proto = []<EOL>if ipv4:<EOL><INDENT>proto.append('<STR_LIT>')<EOL><DEDENT>if ipv6:<EOL><INDENT>proto.append('<STR_LIT>')<EOL><DEDENT>if len(proto) > <NUM_LIT:0>:<EOL><INDENT>args.append('<STR_LIT>')<EOL>args.append('<STR_LIT:U+002C>'.join(proto))<EOL><DEDENT>if tcp:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>if udp:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>if only_listen:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>elif include_listen:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>regexp_str = ('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>if show_users:<EOL><INDENT>args.append('<STR_LIT>')<EOL>regexp_str += '<STR_LIT>'<EOL>headers.extend(['<STR_LIT:user>', '<STR_LIT>'])<EOL><DEDENT>if show_procs:<EOL><INDENT>args.append('<STR_LIT>')<EOL>regexp_str += '<STR_LIT>'<EOL>headers.extend(['<STR_LIT>', '<STR_LIT>'])<EOL><DEDENT>if not resolve_hosts:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>if not resolve_ports:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>if not resolve_users:<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>lines = self.execNetstatCmd(*args)<EOL>stats = []<EOL>regexp = re.compile(regexp_str)<EOL>for line in lines[<NUM_LIT:2>:]:<EOL><INDENT>mobj = regexp.match(line)<EOL>if mobj is not None:<EOL><INDENT>stat = list(mobj.groups())<EOL>if stat[<NUM_LIT:1>] == '<STR_LIT:0>':<EOL><INDENT>stat[<NUM_LIT:1>] = '<STR_LIT:4>'<EOL><DEDENT>if stat[<NUM_LIT:8>] == '<STR_LIT>':<EOL><INDENT>stat[<NUM_LIT:8>] = None<EOL><DEDENT>if show_procs:<EOL><INDENT>proc = stat.pop().split('<STR_LIT:/>')<EOL>if len(proc) == <NUM_LIT:2>:<EOL><INDENT>stat.extend(proc)<EOL><DEDENT>else:<EOL><INDENT>stat.extend([None, None])<EOL><DEDENT><DEDENT>stats.append(stat)<EOL><DEDENT><DEDENT>return {'<STR_LIT>': headers, '<STR_LIT>': stats}<EOL>
Execute netstat command and return result as a nested dictionary.

        @param tcp:            Include TCP ports in ouput if True.
        @param udp:            Include UDP ports in ouput if True.
        @param ipv4:           Include IPv4 ports in output if True.
        @param ipv6:           Include IPv6 ports in output if True.
        @param include_listen: Include listening ports in output if True.
        @param only_listen:    Include only listening ports in output if True.
        @param show_users:     Show info on owning users for ports if True.
        @param show_procs:     Show info on PID and Program Name attached to
                               ports if True.
        @param resolve_hosts:  Resolve IP addresses into names if True.
        @param resolve_ports:  Resolve numeric ports to names if True.
        @param resolve_users:  Resolve numeric user IDs to user names if True.
        @return:               List of headers and list of rows and columns.