File: README

package info (click to toggle)
libparse-netstat-perl 0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 120 kB
  • ctags: 2
  • sloc: perl: 228; makefile: 2
file content (102 lines) | stat: -rw-r--r-- 2,582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
NAME
    Parse::Netstat - Parse the output of Unix "netstat" command

VERSION
    version 0.04

SYNOPSIS
     use Parse::Netstat qw(parse_netstat);

     my $output = `netstat -anp`;
     my $res = parse_netstat output => $output;

    Sample result:

     [
      200,
      "OK",
      {
        active_conns => [
          {
            foreign_host => "0.0.0.0",
            foreign_port => "*",
            local_host => "127.0.0.1",
            local_port => 1027,
            proto => "tcp",
            recvq => 0,
            sendq => 0,
            state => "LISTEN",
          },
          ...
          {
            foreign_host => "0.0.0.0",
            foreign_port => "*",
            local_host => "192.168.0.103",
            local_port => 56668,
            proto => "udp",
            recvq => 0,
            sendq => 0,
          },
          ...
          {
            flags   => "ACC",
            inode   => 15631,
            path    => "\@/tmp/dbus-VS3SLhDMEu",
            pid     => 4513,
            program => "dbus-daemon",
            proto   => "unix",
            refcnt  => 2,
            state   => "LISTENING",
            type    => "STREAM",
          },
        ],
      }
     ]

DESCRIPTION
    This module provides parse_netstat().

SEE ALSO
FUNCTIONS
  parse_netstat(%args) -> [status, msg, result, meta]
    Parse the output of Unix "netstat" command.

    Arguments ('*' denotes required arguments):

    *   output* => *str*

        Output of netstat command.

        This function only parses program's output. You need to invoke
        "netstat" on your own.

    *   tcp => *bool* (default: 1)

        Whether to parse tcp connections.

    *   udp => *bool* (default: 1)

        Whether to parse udp connections.

    *   unix => *bool* (default: 1)

        Whether to parse unix connections.

    Return value:

    Returns an enveloped result (an array). First element (status) is an
    integer containing HTTP status code (200 means OK, 4xx caller error, 5xx
    function error). Second element (msg) is a string containing error
    message, or 'OK' if status is 200. Third element (result) is optional,
    the actual result. Fourth element (meta) is called result metadata and
    is optional, a hash that contains extra information.

AUTHOR
    Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2012 by Steven Haryanto.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.