The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Netcat - A wrapper class for nc Swiss army knife of networking

DESCRIPTION

A simple interface for using netcat command line utility. You can run TCP, UDP or UNIX domain servers and clients.

SYNOPSIS

use Net::Netcat;

my $nc = Net::Netcat->new('/usr/bin/nc');

my $result = $nc->exec(); croak $nc->errstr unless $result;

$nc->exec();

$nc->options{ '-s' => 'source IP', '-p' => 'source port', };

$nc->exec()

        # All options in OpenBSD netcat
        ipv4only            => '-4',
        ipv6only            => '-6',
        staylistening       => '-k',
        listenmode          => '-l',
        nodns               => '-n',
        randomports         => '-r',
        md5sign             => '-S',
        rfc854telnet        => '-y',
        unixsocket          => '-U',
        udpsocket           => '-u',
        verbose             => '-v',
        scanmode            => '-z',
        tcprecvbuff         => '-I length',
        tcpsendbuff         => '-O length',
        delaypkt            => '-i interval',
        sourceport          => '-p source_port',
        sourceip            => '-s source',
        toskeyword          => '-T tos',
        timeout             => '-w timeout',
        port                => '-port port',
        dest                => '-dest destination_to_connect_to'

        $nc->options{'-v' => 1,'-4' => 1, '-l' => 1, 'port' => 2300};
        $nc->exec();

METHODS

new('/usr/bin/nc')

        Contructs Net::Netcat object.It takes a path of netcat command.
        You can omit this argument and this module searches netcat command within PATH environment variable.

        I tested and developed this on OpenBSD 5.2 netcat. This is
substantially different from Linux netcat. So kindly sene me bug
reports.

        There seems to be a bug in netcat with UNIX domain sockets and
the verbose flag. So don't use that combo. Usually you have to
terminate the command with the Ctrl-C keyboard interrupt signal. You
could also redirect the output to a file if desired.

options( @options )

        Specify netcat command options directly 

execute()

        Executes netcat command with specified options.

exec()

An alias of execute()

stdout()

        Get netcat command output to stdout.

stderr()

        Get netcat command output to stderr.

        Specify output file name and output options.

        Avaiable options are:
destination
        The destination IP address to connect to or in case of UNIX
domain sockets the destination socket file to connect to
port
        The port to connect to
author
        Set the author.
comment
        Set the comment.

AUTHOR

        Girish Venkatachalam, <girish at gayatri-hitech.com> 

BUGS

        Please report any bugs or feature requests to
        C<bug-text-cowsay at rt.cpan.org>, or through the web interface at
        L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=text-cowsay>.
        I will be notified, and then you'll automatically be notified of progress on
        your bug as I make changes.

SUPPORT

        You can find documentation for this module with the perldoc command.

        perldoc Net::Netcat

        You can also look for information at:
  • AnnoCPAN: Annotated CPAN documentation

            L<http://annocpan.org/dist/Net-Netcat>
  • CPAN Ratings

            L<http://cpanratings.perl.org/d/Net-Netcat>
  • RT: CPAN's request tracker

            L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Netcat>
  • Search CPAN

            L<http://search.cpan.org/dist/Net-Netcat>

ACKNOWLEDGEMENTS

The author of Netcat Hobbit who remains anonymous to this day.

COPYRIGHT & LICENSE

        Copyright 2012 Girish Venkatachalam, all rights reserved.

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