NAME

Net::Scan::SSH::Server::SupportedAuth - detect supported authentication method of SSH server

SYNOPSIS

use Net::Scan::SSH::Server::SupportedAuth qw(:flag);

my $scanner = Net::Scan::SSH::Server::SupportedAuth->new(host => 'localhost');

### get result as hash
my $sa_hash = $scanner->scan_as_hash;
#  $sa_hash = {'1' => {'password' => 0,'publickey' => 0},
#              '2' => {'password' => 0,'publickey' => 1}};

### get result as bit flag
my $sa = $scanner->scan;

sub checker {
    my($label, $boolean) = @_;
    printf "%-26s: %s\n", $label, $boolean ? 't' : 'f';
}
checker("2-publickey only",
        ($sa->{2} == $AUTH_IF{publickey} && $sa->{1} == 0) );
checker("any-publickey",
        (($sa->{1} | $sa->{2}) & $AUTH_IF{publickey}) );
checker("2-publickey or 2-password",
        ($sa->{2} & ( $AUTH_IF{publickey} | $AUTH_IF{password} )) );

DESCRIPTION

Net::Scan::SSH::Server::SupportedAuth connect SSH server and probe protocol version and supported authentication method (publickey or password).

METHODS

new

$scanner = Net::Scan::SSH::Server::SupportedAuth->new( %option )

This method constructs a new "Net::Scan::SSH::Server::SupportedAuth" instance and returns it. %option is to specify SSH server.

key   value
========================================================
host  "hostname" or "IP address" (default: '127.0.0.1')
port  "port number" (default: '22')

scan

$sa = $scanner->scan;

Do scan and return hash reference which contains information of supported authentication method.

$sa = { VERSION => AUTH_FLAGS, VERSION => AUTH_FLAGS, ... }

VERSION    : SSH protocol version. 1 or 2.
AUTH_FLAGS : 32bit bit flags. to compare with %Net::Scan::SSH::Server::SupportedAuth::AUTH_IF.

scan_as_hash

$sa_hash = $scanner->scan_as_hash;

Do scan and return human readable hash reference which contains information of supported authentication method.

$sa_hash = { VERSION => { password => 0 or 1, publickey => 0 or 1, },
             VERSION => { password => 0 or 1, publickey => 0 or 1, },
             ... }

VERSION    : SSH protocol version. 1 or 2.

dump

$string = $scanner->dump;

Do scan and return as string.

SEE ALSO

Net::SSH::Perl http://www.openssh.com/

AUTHOR

HIROSE Masaaki, <hirose31@gmail.com>

BUGS

Please report any bugs or feature requests to bug-net-scan-ssh-server-supportedauth@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2007 HIROSE Masaaki, All Rights Reserved.

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