Agent-TCLI

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

Build.PL
Changes
lib/Agent/TCLI.pm
lib/Agent/TCLI/Base.pm
lib/Agent/TCLI/Command.pm
lib/Agent/TCLI/Control.pm
lib/Agent/TCLI/Package/Base.pm
lib/Agent/TCLI/Package/Tail.pm
lib/Agent/TCLI/Package/Tail/Line.pm
lib/Agent/TCLI/Package/Tail/Test.pm
lib/Agent/TCLI/Package/UnixBase.pm
lib/Agent/TCLI/Package/XMPP.pm
lib/Agent/TCLI/Parameter.pm
lib/Agent/TCLI/Request.pm
lib/Agent/TCLI/Response.pm
lib/Agent/TCLI/Testee.pm
lib/Agent/TCLI/Transport/Base.pm
lib/Agent/TCLI/Transport/Test.pm
lib/Agent/TCLI/Transport/XMPP.pm
lib/Agent/TCLI/User.pm
lib/auto/Agent/TCLI/Control/config.xml

META.yml  view on Meta::CPAN

    version: 0.030.0062
  Agent::TCLI::Package::Tail:
    file: lib/Agent/TCLI/Package/Tail.pm
    version: 0.030.0059
  Agent::TCLI::Package::Tail::Line:
    file: lib/Agent/TCLI/Package/Tail/Line.pm
    version: 0.030.0059
  Agent::TCLI::Package::Tail::Test:
    file: lib/Agent/TCLI/Package/Tail/Test.pm
    version: 0.030.0059
  Agent::TCLI::Package::UnixBase:
    file: lib/Agent/TCLI/Package/UnixBase.pm
    version: 0.030.0059
  Agent::TCLI::Package::XMPP:
    file: lib/Agent/TCLI/Package/XMPP.pm
    version: 0.030.0059
  Agent::TCLI::Parameter:
    file: lib/Agent/TCLI/Parameter.pm
    version: 0.030.0059
  Agent::TCLI::Request:
    file: lib/Agent/TCLI/Request.pm
    version: 0.030.0062

lib/Agent/TCLI/Control.pm  view on Meta::CPAN

        	"Context is a way of nesting commands, much like a file directory, to make it easier to navigate. There are a few commands, such as 'help' or 'exit' that are global, ".
        	"but most commands are available only within specific contexts. Well written packages will collect groups of similar commands within a context. ".
        	"For instance, if one had package of attack commands, one would put them all in an 'attack' context. Instead of typing 'attack one target=example.com', ".
        	"one could type 'attack' to change to the attack context then type 'one target=example.com' followed by 'two target=example.com' etc. \n\n".
        	"Furthermore, a well written package will support the setting of default parameters for use within a context. One can then say: \n ".
        	"\tattack \n\tset target=example.com \n\tone \n\ttwo \n\t...\n\n".
        	"The full command 'attack one target=example.com' must always be supported, but using context makes it easier to do repetitive tasks manually as well as ".
        	"allow one to navigate through a command syntax that one's forgotten the details of without too much trouble. \n\n".
        	"Context has a sense of depth, as in how many commands one has in front of whatever one is currently typing. ".
        	"An alias to the context command is 'pwd' which stands for Present Working Depth. ".
        	"Though it may make the Unix geeks happy, they should remember that this is not a file directory structure that one is navigating within.",
        'topic'    	=> 'general',
        'command' 	=> 'pre-loaded',
        'contexts' 	=> {'UNIVERSAL' => [ qw( context pwd ) ]},
        'call_style'=> 'state',
        'handler'	=> 'general'
    ),
	 'Verbose' => Agent::TCLI::Command->new(
        'name'      => 'Verbose',
        'help' 		=> "changes the verbosity of output to logs",
        'usage'     => 'Verbose',

lib/Agent/TCLI/Control.pm  view on Meta::CPAN

        'topic' 	=> 'general',
        'command' 	=> 'pre-loaded',
        'contexts'	=> {'UNIVERSAL' => 'status'},
        'call_style'=> 'state',
        'handler'	=> 'general'
    ),
	 '/' => Agent::TCLI::Command->new(
        'name'      => 'root',
        'help' 		=> "exit to root context, use '/command' for a one time switch",
        'usage'     => 'root or /   ',
        'manual'	=> "root, or '/' for the Unix geeks, will change the context back to root. See 'manual context' for more information on context. ".
        	"Unless otherwise noted, changing to root context does not normally clear out any default settings that were established in that context. \n\n".
        	"One can preceed a command directly with a '/' such as '/exit' to force the root context. ".
        	"Sometimes a context may independently process everything said within the context and, if misbehaving, doesn't provide a way to leave the context. ".
        	"Using '/exit' or '/help' should always work. The example package Eliza is known to have trouble saying Goodbye and exiting properly.",
        'topic'     => 'general',
        'command'   => 'pre-loaded',
        'contexts'  => { 'UNIVERSAL' => ['/','root'] },
        'call_style'=> 'state',
        'handler'	=> 'exit',
    ),

lib/Agent/TCLI/Control.pm  view on Meta::CPAN

        'usage'     => 'nothing',
        'topic'     => 'general',
        'contexts'  => {'ROOT' => 'nothing'},
        'command'   =>  sub { return ("You said nothing, try help") },
        'call_style'=> 'sub',
    ),
	 'exit' => Agent::TCLI::Command->new(
        'name'      => 'exit',
        'help' 		=> "exit the current context, returning to previous context",
        'usage'     => 'exit or /exit',
        'manual'	=> "exit, or '..' for the Unix geeks, will change the context back one level. See 'manual context' for more information on context. ".
        	"Unless otherwise noted, leaving a context does not normally clear out any default settings that were established in that context. \n\n",
        'topic'     => 'general',
        'command'   => 'pre-loaded',
        'contexts'  => {'UNIVERSAL' => [ qw(exit ..)] },
        'call_style'=> 'state',
        'handler'	=> 'exit',
    ),
	 'ip' => Agent::TCLI::Command->new(
        'name'      => 'ip',
        'help' 		=> 'Returns the local ip address',

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

  	);
}

sub _init :Init {
	my $self = shift;

	$self->LoadYaml(<<'...');
---
Agent::TCLI::Parameter:
  name: file
  help: The full Unix path of the file name.
  manual: >
    The full Unix path of the file that will be tailed.
  type: Param
---
Agent::TCLI::Parameter:
  name: filter
  help: Optional POE::Filter.
  manual: >
    A POE::Filter that will be applied by POE::Wheel::FollowTail on the file
    being tailed.
  type: Param
---

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

package Agent::TCLI::Package::UnixBase;
#
# $Id: UnixBase.pm 59 2007-04-30 11:24:24Z hacker $
#
=head1 NAME

Agent::TCLI::Package::UnixBase - Base class for Agent::TCLI::Package
objects accessing other Unix commands.

=head1 SYNOPSIS

	use Object::InsideOut qw(Agent::TCLI::Package::UnixBase);

=head1 DESCRIPTION

Base class for Packages needing to run other Unix programs. It provides methods
to asnychronously call Unix programs using POW::Wheel::Run through
POE::Component::Child. This base class comes with simple
event handlers to accept the output and/or errors returned from the wheel.

Typically, one may want their subclass to replace the stdout method
with one that does more processing of the responses. One should use the
methods here as a starting point in such cases.

Commands run through these methods are run in their own processes asychonously.
Other Agent processing continues while the results of the commands are
captured and returned. Package authors need to ensure that their command

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


=cut

use warnings;
use strict;
use Carp;
use Object::InsideOut qw(Agent::TCLI::Package::Base);

use POE qw(Component::Child Filter::Stream);

our $VERSION = '0.030.'.sprintf "%04d", (qw($Id: UnixBase.pm 59 2007-04-30 11:24:24Z hacker $))[2];

=head2 ATTRIBUTES

The following attributes are accessible through standard accessor/mutator
methods unless otherwise noted.

=over

=item child

lib/auto/Agent/TCLI/Control/config.xml  view on Meta::CPAN

<package>
  <Parameter name="local_address" aliases="ip" help="local ip address" manual="" type="Param" />
  <Parameter name="auth" aliases="" help="auth level within control" manual="" type="Param" />
  <Parameter name="user" aliases="" help="control user" manual="" type="Param" />
<Command name="show" call_style="state" command="pre-loaded" handler="show" help="show Control variables" topic="admin" usage="Control show local_address">
  <contexts Control="show" ></contexts>
  <parameters user="1" local_address="1" auth="1"></parameters></Command>
<Command name="root" call_style="state" command="pre-loaded" handler="exit" help="exit to root context, use '/command' for a one time switch" manual="root, or '/' for the Unix geeks, will change the context back to root. See 'manual context' for more...

One can preceed a command directly with a '/' such as '/exit' to force the root context. Sometimes a context may independently process everything said within the context and, if misbehaving, doesn't provide a way to leave the context. Using '/exit' o...
  <contexts>
    <UNIVERSAL>/</UNIVERSAL>
    <UNIVERSAL>root</UNIVERSAL>
  </contexts>
</Command>
<Command name="manual" call_style="state" command="pre-loaded" handler="manual" help="Display detailed help about a command" manual="The manual command provides detailed information about running a command and the parameters the command accepts. Manu...
  <contexts>
    <UNIVERSAL>manual</UNIVERSAL>
    <UNIVERSAL>man</UNIVERSAL>
  </contexts>
</Command>
<Command name="ip" call_style="state" command="pre-loaded" handler="net" help="Returns the local ip address" topic="net" usage="ip">
  <contexts ROOT="ip" />
</Command>
<Command name="status" call_style="state" command="pre-loaded" handler="general" help="Display general TCLI control status" topic="general" usage="status or /status">
  <contexts UNIVERSAL="status" />
</Command>
<Command name="exit" call_style="state" command="pre-loaded" handler="exit" help="exit the current context, returning to previous context" manual="exit, or '..' for the Unix geeks, will change the context back one level. See 'manual context' for more...

" topic="general" usage="exit or /exit">
  <contexts>
    <UNIVERSAL>exit</UNIVERSAL>
    <UNIVERSAL>..</UNIVERSAL>
  </contexts>
</Command>
<Command name="debug_request" call_style="state" command="pre-loaded" handler="general" help="show what the request object contains" topic="admin" usage="debug_request &lt;some other args&gt;">
  <contexts UNIVERSAL="debug_request" />
</Command>

lib/auto/Agent/TCLI/Control/config.xml  view on Meta::CPAN


Furthermore, a well written package will support the setting of default parameters for use within a context. One can then say: 
 	attack 
	set target=example.com 
	one 
	two 
	...

The full command 'attack one target=example.com' must always be supported, but using context makes it easier to do repetitive tasks manually as well as allow one to navigate through a command syntax that one's forgotten the details of without too muc...

Context has a sense of depth, as in how many commands one has in front of whatever one is currently typing. An alias to the context command is 'pwd' which stands for Present Working Depth. Though it may make the Unix geeks happy, they should remember...
  <contexts>
    <UNIVERSAL>context</UNIVERSAL>
    <UNIVERSAL>pwd</UNIVERSAL>
  </contexts>
</Command>
<Command name="help" call_style="state" command="pre-loaded" handler="help" help="Display help about available commands" manual="The help command provides summary information about running a command and the parameters the command accepts. Help with n...
  <contexts UNIVERSAL="help" />
</Command>
<Command name="dumpcmd" call_style="state" command="pre-loaded" handler="dumpcmd" help="Dump the registered command hash information" topic="admin" usage="dumpcmd &lt;cmd&gt;">
  <contexts UNIVERSAL="dumpcmd" />

t/00.load.t  view on Meta::CPAN

use_ok( 'Agent::TCLI::Control' );
use_ok( 'Agent::TCLI::Parameter' );
use_ok( 'Agent::TCLI::Request' );
use_ok( 'Agent::TCLI::Response' );
use_ok( 'Agent::TCLI::User' );
use_ok( 'Agent::TCLI::Transport::Base' );
use_ok( 'Agent::TCLI::Transport::Test' );
use_ok( 'Agent::TCLI::Testee' );
use_ok( 'Agent::TCLI::Transport::XMPP' );
use_ok( 'Agent::TCLI::Package::Base' );
use_ok( 'Agent::TCLI::Package::UnixBase' );
use_ok( 'Agent::TCLI::Package::Tail' );
use_ok( 'Agent::TCLI::Package::XMPP' );
use_ok( 'Agent::TCLI::Package::Tail::Test' );
use_ok( 'Agent::TCLI::Package::Tail::Line' );




( run in 0.770 second using v1.01-cache-2.11-cpan-df04353d9ac )