[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file under "non-essential" (WServer)

This module (for 0.49+) looks up the software version (if it can) of a
specified webserver.  It requires the LWP::Simple module.

> webserver at www.infobot.org?
www.infobot.org is running "Apache/1.3.6 (Unix)  (Red Hat/Linux)"

> server for www.microsoft.com 
www.microsoft.com is running "Microsoft-IIS/5.0"

> What server is at http://www.novell.com?
http://www.novell.com is running "Netscape-Enterprise/3.5-For-NetWare"

Does novell still sell their own webserver?

package Infobot::Module::WServer;

use strict;
use Infobot::Module;

$Infobot::Module::WServer::VERSION = "0.01_00";
$Infobot::Module{"WServer"} = $Infobot::Module::WServer::VERSION;
@Infobot::Module::WServer::ISA = qw(Infobot::Module);

my $any_bad;

  eval { require LWP::Simple };
  $@ and $any_bad = "LWP::Simple";
  warn "Infobot::Module::WServer requires $any_bad" if $any_bad;

sub Infobot::Module::WServer::new {
  my $class = shift ;
  return undef if $any_bad;

  my $self  = $class->SUPER::new(@_);
  $self->usage('webserver at <site>');
  $self->descrip("Tries to lookup server running at site");

  bless $self, $class;

sub Infobot::Module::WServer::action {
    my ($self, $message) = @_;
    return undef unless $self->enabled;

    my $url = $message->get('args')->[0];
    my $orig = $url;
    $url = "http://".$url if ($url!~/^http:\/\//);
    $self->status(2,"looking up $url");
    # isn't good variable naming fundamental?
    my @stuff = LWP::Simple::head($url);
    if (@stuff) {
      return("$orig is running \"$stuff[$#stuff]\"");
    } else {
      return("Couldn't figure it out, sorry");



=head1 NAME

WServer -- looks up the server software for a given webserver.


webserver at http://www.microsoft.com

server for www.infobot.org

what webserver is at www.securetty.org?




	Shows the server software running at location specified.

=head1 AUTHORS

Jay Jacobs (teckle) <jjacobs@securetty.org>