Agent-TCLI-Package-Net

 view release on metacpan or  search on metacpan

lib/Agent/TCLI/Package/Net/HTTP.pm  view on Meta::CPAN

  default: 1
  help: The number of times to retry when successful.
  manual: >
    This parameter will cause the specified number or retry attampts
    This will only happen upon successful completion of the
    first request. The default is 1.
  type: Param
---
Agent::TCLI::Command:
  name: http
  call_style: session
  command: tcli_http
  contexts:
    ROOT: http
  handler: establish_context
  help: http web cient environment
  manual: >
    Currently the http commands available only support limited capabilities.
    One can request a url and verify that a desired response code was
    received, but HTML content is not processed.
  topic: net
  usage: http tget url=http:\example.com\request resp=404
---
Agent::TCLI::Command:
  name: tget
  call_style: session
  command: tcli_http
  contexts:
    http: tget
  handler: get
  help: makes a requests and expects a specific response code
  manual: >
    Tget makes an http request for the supplied url and checks to see that the
    supplied response code is returned by the http server. This is useful in
    test scripts to ensure that a request has been responeded to properly.
  parameters:
    url:
    response_code:
    retry_interval:
    retry_count:
  required:
    url:
  topic: net
  usage: tget tget url=http:\example.com\request resp=404
---
Agent::TCLI::Command:
  call_style: session
  command: tcli_http
  contexts:
    http: cget
  handler: get
  help: makes a requests and returns response code
  manual: >
    Cget makes an http request for the supplied url and returns the
    response code that is returned by the http server. This is useful in
    checking what responses a server may be sending back.
  name: cget

lib/Agent/TCLI/Package/Net/HTTPD.pm  view on Meta::CPAN

---
Agent::TCLI::Parameter:
  name: ports
  help: Show the active HTTPD ports
  manual: >
    This will show the active httpd ports.
  type: Switch
---
Agent::TCLI::Command:
  name: httpd
  call_style: session
  command: tcli_httpd
  contexts:
    ROOT: httpd
  handler: establish_context
  help: simple http web server
  manual: >
    httpd provides a simple web server that can respond to and log requests.
    By default it responds with a Status code 404 to all requests. One may add
    a select few other status code responses using regular expression pattern
    matching if desired. One cannot change content, only status codes.
    Httpd is useful for network testing situations where the response codes
    are being monitored by the network.
  topic: net
  usage: httpd spawn port=8080
---
Agent::TCLI::Command:
  name: spawn
  call_style: session
  command: tcli_httpd
  contexts:
    httpd: spawn
  handler: spawn
  help: starts an http server on a particular port
  manual: >
    The spawn command starts an httpd listener on a particular port. One
    may enable more than one httpd listener so long as they are
    using different ports.
    The script must have root priviledges if the port is less than 1024.

lib/Agent/TCLI/Package/Net/HTTPD.pm  view on Meta::CPAN

    port:
    address:
    hostname:
  required:
    port:
  topic: net
  usage: httpd spawn port=8080
---
Agent::TCLI::Command:
  name: stop
  call_style: session
  command: tcli_httpd
  contexts:
    httpd: stop
  handler: stop
  help: Stops a running http server on a particular port
  manual: >
    The stop command stops an httpd listener running on the specified port. It
    will return an error if the port cannot be found in the list of servers
    running.
  parameters:
    port:
  required:
    port:
  topic: net
  usage: httpd stop port=8080
---
Agent::TCLI::Command:
  name: uri
  call_style: session
  command: tcli_httpd
  contexts:
    httpd: uri
  handler: establish_context
  help: adds or removes a uri regex from the httpd
  manual: >
    The httpd can be set to respond to different uri queries with this command.
  topic: net
  usage: httpd uri add regex=^/good/.* response=OK200
---
Agent::TCLI::Command:
  name: uri_add
  call_style: session
  command: tcli_httpd
  contexts:
    httpd:
      uri: add
  handler: uri
  help: adds a uri regex from the httpd
  manual: >
    Adds a uri regular expression and the desired response to the handler table.
    Regular expressions are applied in order of their entry into the table and
    the first match is the one that wins. One cannot delete the default

lib/Agent/TCLI/Package/Net/HTTPD.pm  view on Meta::CPAN

  parameters:
    regex:
    response:
  required:
    regex:
  topic: net
  usage: httpd uri add regex=^/good/.* response=OK200
---
Agent::TCLI::Command:
  name: uri_delete
  call_style: session
  command: tcli_httpd
  contexts:
    httpd:
      uri: delete
  handler: uri
  help: removes a uri regex from the httpd
  manual: >
    This command removes an existing regex from the uri handler list.
    It must match exactly to the existing uri regex that was added. It
    does not allow removal of the default NA404 response.
  parameters:
    regex:
  required:
    regex:
  topic: net
  usage: httpd uri add regex=^/good/.* response=OK200
---
Agent::TCLI::Command:
  name: set
  call_style: session
  command: tcli_httpd
  contexts:
    httpd: set
  handler: settings
  help: adjust default settings
  parameters:
    logging:
    address:
    port:
    hostname:
    regex:
    response:
  topic: net
  usage: httpd set hostname=example.com
---
Agent::TCLI::Command:
  name: show
  call_style: session
  command: tcli_httpd
  contexts:
    httpd: show
  handler: show
  help: show tail default settings and state
  parameters:
    logging:
    address:
    port:
    hostname:

lib/Agent/TCLI/Package/Net/Ping.pm  view on Meta::CPAN

  default: 1
  class: numeric
  help: The number of times to retry when no response is received
  manual: >
    This parameter will cause the specified number or retry attampts
    This will only happen if there is no response from prior requests.
  type: Param
---
Agent::TCLI::Command:
  name: ping
  call_style: session
  command: tcli_ping
  contexts:
    ROOT: ping
  handler: ping
  help: check to see if a host is alive
  manual: >
    Ping will send an ICMP echo to a target, hoping to get an ICMP
    response before a timeout. One can ping multiple hosts concurrently.
  parameters:
    target:
    timeout:
    retry_count:
  required:
    target:
  topic: network
  usage: ping target example.com
---
Agent::TCLI::Command:
  name: set
  call_style: session
  command: tcli_ping
  contexts:
    ping: set
  handler: settings
  help: set defaults for pings attacks
  parameters:
    target:
    timeout:
    retry_count:
  topic: network
  usage: ping set target=target.example.com
---
Agent::TCLI::Command:
  name: show
  call_style: session
  command: tcli_ping
  contexts:
    ping: show
  handler: show
  help: show current settings
  parameters:
    target:
    timeout:
    retry_count:
  topic: network

lib/Agent/TCLI/Package/Net/SMTP.pm  view on Meta::CPAN

  type: Param
---
Agent::TCLI::Parameter:
  name: textfile
  constraints:
    - ASCII
  help: A file of plain text for the message body.
  manual: >
    The textfile will be used as the message body for sending an email. It
    should not include headers. If the file cannot be found, the request will
    fail. Use Unix style path names.
  type: Param
---
Agent::TCLI::Parameter:
  name: msgfile
  constraints:
    - ASCII
  help: A file of plain text for the message body.
  manual: >
    The msgfile will be used as the entire message for sending an email. It
    should include headers. If the file cannot be found, the request will
    fail. Use Unix style path names. The to and from must still be defined,
    though they need not match what is in the msg.
  type: Param
---
Agent::TCLI::Command:
  name: smtp
  call_style: session
  command: tcli_smtp
  contexts:
    ROOT: smtp
  handler: establish_context
  help: smtp client to send mail
  manual: >
    Send mail to aSMTP server
  topic: net
  usage: smtp send to=joe@example.com from=jane@example.com subject=Hi body="hi"
---
Agent::TCLI::Command:
  name: send
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: send
  handler: send
  help: send a mail message
  manual: >
    Send mail to a SMTP server. There are many parameters that are required to
    properly construct the message.
  parameters:
    to:

lib/Agent/TCLI/Package/Net/SMTP.pm  view on Meta::CPAN

    subject:
    server:
    port:
  required:
    to:
  topic: net
  usage: smtp send to=joe@example.com from=jane@example.com subject=Hi body="hi"
---
Agent::TCLI::Command:
  name: sendtext
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: sendtext
  handler: send
  help: send a mail message
  manual: >
    Send mail to a SMTP server when the body is from a text file on the local
    host system.
  parameters:
    to:

lib/Agent/TCLI/Package/Net/SMTP.pm  view on Meta::CPAN

    server:
    port:
  required:
    to:
    textfile:
  topic: net
  usage: smtp sendtext to=joe@example.com from=jane@example.com subject=Hi textfile="/tmp/hello.txt"
---
Agent::TCLI::Command:
  name: sendmsg
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: sendmsg
  handler: send
  help: send a mail message
  manual: >
    Send mail to a SMTP server when the body is from a text file on the local
    host system.
  parameters:
    to:

lib/Agent/TCLI/Package/Net/SMTP.pm  view on Meta::CPAN

    server:
    port:
  required:
    to:
    msgfile:
  topic: net
  usage: smtp sendmsg to=joe@example.com msgfile="/tmp/hello.msg"
---
Agent::TCLI::Command:
  name: set
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: set
  handler: settings
  help: set defaults for smtp messages
  parameters:
    to:
    from:
    body:
    timeout:
    subject:
    server:
    port:
  topic: network
  usage: smtp set server=mx.example.com
---
Agent::TCLI::Command:
  name: show
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: show
  handler: show
  help: show current settings
  parameters:
    to:
    from:
    body:
    timeout:

lib/Agent/TCLI/Package/Net/Traceroute.pm  view on Meta::CPAN

  help: the target ip address
  manual: >
    The target IP address for the attack. The target may
    be specified as a domain name or as a dotted quad.
  type: Param
  class: NetAddr::IP
  show_method: addr
---
Agent::TCLI::Command:
  name: traceroute
  call_style: session
  command: tcli_trace
  contexts:
    ROOT: traceroute
  handler: trace
  help: determine route to a host
  manual: >
    Trace the route to a host either using UDP (the default) or ICMP query
    packets. This operates the same way the normal unix traceroute program
    works.
  parameters:

lib/Agent/TCLI/Package/Net/Traceroute.pm  view on Meta::CPAN

    timeout:
    querytimeout:
    queries:
    baseport:
    useicmp:
  topic: network
  usage: traceroute target example.com
---
Agent::TCLI::Command:
  name: set
  call_style: session
  command: tcli_trace
  contexts:
    traceroute: set
  handler: settings
  help: set defaults for traceroutes
  parameters:
    target:
    firsthop:
    max_ttl:
    timeout:
    querytimeout:
    queries:
    baseport:
    useicmp:
  topic: network
  usage: traceroute set target=target.example.com
---
Agent::TCLI::Command:
  name: show
  call_style: session
  command: tcli_trace
  contexts:
    traceroute: show
  handler: show
  help: show current settings
  parameters:
    target:
    firsthop:
    max_ttl:
    timeout:

t/TCLI.Package.Net.HTTP.t  view on Meta::CPAN

is(ref($test_c1),'HASH', '$test1->commands is a hash');

my $test_c1_0 = $test_c1->{'http'};

is($test_c1_0->name,'http', '$test_c1_0->name get from init args');
is($test_c1_0->usage,'http tget url=http:\example.com\request resp=404', '$test_c1_0->usage get from init args');
is($test_c1_0->help,'http web cient environment', '$test_c1_0->help get from init args');
is($test_c1_0->topic,'net', '$test_c1_0->topic get from init args');
is($test_c1_0->command,'tcli_'.$testee, '$test_c1_0->command get from init args');
is($test_c1_0->handler,'establish_context', '$test_c1_0->handler get from init args');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style get from init args');


$t->is_body('http','Context now: http','Context now: http');
$t->not_ok('tget','tget no args');
$t->ok('tget url=http://testing.erichacker.com/404.html resp=404',
		'tget for 404' );
$t->like_body('tget url=http://testing.erichacker.com/404.html resp=200',
		qr(failed), 'tget failed for bad request');
$t->like_body('tget url=http://testing.erichacker.com/ resp=200',
		qr(ok), 'tget for 200');

t/TCLI.Package.Net.HTTPD.t  view on Meta::CPAN

is(ref($test_c1),'HASH', '$test1->commands is a hash');

my $test_c1_0 = $test_c1->{'httpd'};

is($test_c1_0->name,'httpd', '$test_c1_0->name get from init args');
is($test_c1_0->usage,'httpd spawn port=8080', '$test_c1_0->usage get from init args');
is($test_c1_0->help,'simple http web server', '$test_c1_0->help get from init args');
is($test_c1_0->topic,'net', '$test_c1_0->topic get from init args');
is($test_c1_0->command,'tcli_'.$testee, '$test_c1_0->command get from init args');
is($test_c1_0->handler,'establish_context', '$test_c1_0->handler get from init args');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style get from init args');


$t->is_body('httpd','Context now: httpd','Context now: httpd');
$t->ok('spawn' );
$t->ok('stop' );

$t->like_body('show port',qr(8080),'show default port');
$t->ok('set port 8000');
$t->like_body('show port',qr(8000),'show set port');
$t->not_ok('set port eight');

t/TCLI.Package.Net.Ping.t  view on Meta::CPAN

is($test1->name,'tcli_ping', '$test1->name initialized');
my $test_c1 = $test1->commands();
is(ref($test_c1),'HASH', '$test1->commands is a hash');
my $test_c1_0 = $test_c1->{'ping'};
is($test_c1_0->name,'ping', '$test_c1_0->name loaded ok');
is($test_c1_0->usage,'ping target example.com', '$test_c1_0->usage ok');
is($test_c1_0->help,'check to see if a host is alive', '$test_c1_0->help ok');
is($test_c1_0->topic,'network', '$test_c1_0->topic ok');
is($test_c1_0->command,'tcli_ping', '$test_c1_0->command ok');
is($test_c1_0->handler,'ping', '$test_c1_0->handler ok');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style ok');

$ping->like_body( 'ping show timeout',qr(timeout.*?10), 'ping show timeout');
$ping->like_body( 'ping show retry_count',qr(retry_count.*?1), 'ping show retry count');
$ping->like_body( 'ping show target',qr(#!undefined), 'ping show target not set');
$ping->ok( 'ping set target 127.0.0.1', 'ping set target');
$ping->like_body( 'ping show target',qr(target.*?127.0.0.1), 'ping show target');
$ping->ok( 'ping set timeout 30', 'ping set timeout');
$ping->like_body( 'ping show timeout',qr(timeout.*?30), 'ping show timeout');
$ping->ok( 'ping set retry_count 3', 'ping set retry_count');
$ping->like_body( 'ping show retry_count',qr(retry_count.*?3), 'ping show retry count');

t/TCLI.Package.Net.SMTP.t  view on Meta::CPAN

is(ref($test_c1),'HASH', '$test1->commands is a hash');

my $test_c1_0 = $test_c1->{'smtp'};

is($test_c1_0->name,'smtp', '$test_c1_0->name ');
is($test_c1_0->usage,'smtp send to=joe@example.com from=jane@example.com subject=Hi body="hi"', '$test_c1_0->usage');
is($test_c1_0->help,'smtp client to send mail', '$test_c1_0->help ');
is($test_c1_0->topic,'net', '$test_c1_0->topic get');
is($test_c1_0->command,'tcli_'.$testee, '$test_c1_0->command  ');
is($test_c1_0->handler,'establish_context', '$test_c1_0->handler  ');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style ');


$t->is_body('smtp','Context now: smtp','Context now: smtp');
$t->ok('set to=testing@example.com');
$t->like_body('show to',qr(testing\@example.com));
$t->ok('set from=testee@example.com');
$t->like_body('show from',qr(testee\@example.com));
$t->ok('set subject="Test Message"');
$t->like_body('show subject',qr(Test Message));

t/TCLI.Package.Net.Traceroute.t  view on Meta::CPAN

is($test1->name,'tcli_trace', '$test1->name initialized');
my $test_c1 = $test1->commands();
is(ref($test_c1),'HASH', '$test1->commands is a hash');
my $test_c1_0 = $test_c1->{'traceroute'};
is($test_c1_0->name,'traceroute', '$test_c1_0->name loaded ok');
is($test_c1_0->usage,'traceroute target example.com', '$test_c1_0->usage ok');
is($test_c1_0->help,'determine route to a host', '$test_c1_0->help ok');
is($test_c1_0->topic,'network', '$test_c1_0->topic ok');
is($test_c1_0->command,'tcli_trace', '$test_c1_0->command ok');
is($test_c1_0->handler,'trace', '$test_c1_0->handler ok');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style ok');

#defaults
$tracer->like_body( 'traceroute show firsthop',qr(firsthop: 1), 'traceroute show firsthop');
$tracer->like_body( 'traceroute show timeout',qr(timeout.*?0), 'traceroute show timeout');
$tracer->like_body( 'traceroute show querytimeout',qr(querytimeout.*?3), 'traceroute show querytimeout');
$tracer->like_body( 'traceroute show target',qr(!undefined), 'traceroute show target not set');
$tracer->like_body( 'traceroute show queries',qr(queries.*?3), 'traceroute show queries');
$tracer->like_body( 'traceroute show max_ttl',qr(max_ttl.*?30), 'traceroute show max_ttl');
$tracer->like_body( 'traceroute show baseport',qr(baseport.*?33434), 'traceroute show baseport');
$tracer->like_body( 'traceroute show useicmp',qr(!undefined), 'traceroute show useicmp not set');



( run in 0.696 second using v1.01-cache-2.11-cpan-49f99fa48dc )