From infobot-dev@metronomicon.com  Mon Jan 10 22:06:12 2000
Return-Path: <infobot-dev@metronomicon.com>
Received: (from majordomo@localhost)
	by token.metronomicon.com (8.9.3/8.8.7) id WAA02197
	for infobot-dev-list; Mon, 10 Jan 2000 22:06:12 -0500
Received: from verdi.siteprotect.com (verdi.siteprotect.com [209.100.98.18])
	by token.metronomicon.com (8.9.3/8.8.7) with ESMTP id WAA02194
	for <infobot-dev@infobot.org>; Mon, 10 Jan 2000 22:06:11 -0500
Received: from LucidX.com (adsl-63-199-105-209.dsl.lsan03.pacbell.net [63.199.105.209])
	by verdi.siteprotect.com (8.8.5/8.8.5) with ESMTP id VAA02055
	for <infobot-dev@infobot.org>; Mon, 10 Jan 2000 21:08:41 -0600
Message-ID: <387A9ED6.F0740026@LucidX.com>
Date: Mon, 10 Jan 2000 19:09:10 -0800
From: "Samy Kamkar (CommPort5)" <CommPort5@lucidx.com>
Organization: LucidX
X-Mailer: Mozilla 4.08 [en] (X11; I; FreeBSD 3.1-RELEASE i386)
MIME-Version: 1.0
To: infobot-dev@infobot.org
Subject: Current OS versions
Content-Type: multipart/mixed; boundary="------------A7B5D442518768BFC38A7457"
Sender: infobot-dev@metronomicon.com
Precedence: bulk
Status: O

This is a multi-part message in MIME format.
--------------A7B5D442518768BFC38A7457
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Greetings, osvers.pl is a little add-on to Infobot which goes to a CGI
(unix.cgi although it will _actually_ go to
www.LucidX.com/cgi-bin/unix.pl) and that CGI will go out to a couple of
other web sites and grab current OS version numbers.  It goes to
official OS web sites such as freebsd.org and redhat.com, although a lot
of OSs weren't added since it would be difficult for the CGI to
understand what to find for the newer versions of the OS since the HTML
on the page is bound to change.  If anyone can add to unix.cgi, please
do and get it out so it can be used.  To get Infobot to work with
osvers.pl place this in src/Extras.pl:

    if ($message =~ /^\s*(cur|current|)( |)(os|unix|operating(
|)system(s|))( |)ver/) {
        my $os = &vers();
        return $os;
    }

So you know you DO NOT need to use unix.cgi, I just put that their since
that's the real program that does most of the work.  The reason I didn't
incorperate it into osvers.pl is because it would really lag the
connection of the bot that is using it.  So if you wish please mess
around with unix.cgi and send it back if you got a neater/better
version.
Ten four,
-CommPort5

--------------A7B5D442518768BFC38A7457
Content-Type: text/plain; charset=us-ascii; name="unix.cgi"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="unix.cgi"

#!/usr/bin/perl
use CGI qw(:standard);
use LWP::UserAgent;
my ($x, $ua, $url, $html, $response, $res, $name, $num);
$num = "0";
sub add {
$x .= "$name $1/";
}
do {
 if ($num eq "0") { &con("FreeBSD", "http://www.freebsd.org/releases/"); }
 if ($num eq "1") { &con("Red Hat", "http://www.redhat.com/"); }
 if ($num eq "2") { &con("Slackware", "http://www.slackware.com/"); }
 if ($num eq "3") { &con("Caldera", "http://www.caldera.com/"); }
 if ($num eq "4") { &con("Mandrake", "http://www.mandrake.org/en/fdownload.php3"); }
 if ($num eq "5") { &con("OpenBSD", "http://www.openbsd.org/"); }
 if ($num eq "6") { &con("NetBSD", "http://www.netbsd.org/"); }
 if ($num eq "7") { &con("SuSE", "http://www.suse.com/"); }
 sub con {
  $name = $_[0];
  $ua = new LWP::UserAgent;
  $ua->timeout(12);
  $url = $_[1];
  $html = new HTTP::Request('GET',$url);
  $response = $ua->request($html);
  if($response->is_success) {
   $res = $response->content;
   $res =~ s/\n/ /g;
##### FreeBSD #####
   if($name eq "FreeBSD") {
    $res =~ /<B>Release (.*?)<\/B>/;
    &add;
   }
##### Red Hat #####
   if($name eq "Red Hat") {
    $res =~ /<A HREF="\/commerce\/redhatlinux.html">Red Hat Linux (.*?)<\/A>/;
    &add;
   }
##### Slackware #####
   if($name eq "Slackware") {
    $res =~ /<BR>Get (.*?)!<\/A>/;
    &add;
   }
##### Caldera #####
   if($name eq "Caldera") {
    $res =~ /<a href=\/openstore\/openlinux\/ class=nav>OpenLinux (.*?)<\/a><br>/;
    &add;
   }
##### Mandrake #####
   if($name eq "Mandrake") {
    $res =~ /Linux Mandrake (\d\.\d)/;
    &add;
   }
##### OpenBSD #####
   if($name eq "OpenBSD") {
    $res =~ /The current release is <a href=".*">OpenBSD (.*?)<\/a>/;
    &add;
   }
##### NetBSD #####
   if($name eq "NetBSD") {
    $res =~ /Latest release - (.*?)<\/a>/;
    &add;
   }
##### SuSE #####
   if($name eq "SuSE") {
    $res =~ /<IMG ALIGN=RIGHT ALT="SuSE Linux (.*?) Image"/;
    &add;
   }
##### End of OSs #####
  }
 }
 $num++;
}
while($num ne "10");
$x =~ s/(.*?)\/$/$1/;
print header, start_html("Current OS Versions"), p("Current OS Versions: $x\n");

--------------A7B5D442518768BFC38A7457
Content-Type: application/x-perl; name="osvers.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="osvers.pl"

# Yes, I know, I must have spent hours on this.
# Here's a little program I did to go through a CGI
# that I wrote to go to a bunch of official OS sites
# and get the current version of that OS.
# I made it go through the CGI since it would be very
# slow if the infobot user had a slow connection,
# although it's not exactly the speed of light yet.
# www.LucidX.com/cgi-bin/unix.pl is the program
# www.LucidX.com/other/unix.txt is the program in text
# I'm also looking for people who want to just add one
# or two OSs to the CGI. I've check out other sites
# but it's difficult to regex the version since the HTML
# on those pages are bound to change the way they are.
# www.LucidX.com/lame/unix.html is a list of OSs, unix
# based as you can see, which I'm doing for a lame
# school project. The CGI doesn't read off of all of
# those yet and I hope it will soon. Ten four.

# -CommPort5

sub vers {
 use LWP::UserAgent;
 my $ua = new LWP::UserAgent;
 $ua->timeout(60);
 my $url = "http://www.LucidX.com/cgi-bin/unix.pl";
 my $html = new HTTP::Request('GET',$url);
 my $response = $ua->request($html);
 if($response->is_success) {
  my $res = $response->content;
  $res =~ s/\n//g;
  $res =~ /<P>(.*?)<\/P>/;
  return "$1";
 } else {
  return "Can't get versions";
 }
}
1;

--------------A7B5D442518768BFC38A7457--

From infobot-dev@metronomicon.com  Tue Jan 11 13:43:19 2000
Return-Path: <infobot-dev@metronomicon.com>
Received: (from majordomo@localhost)
	by token.metronomicon.com (8.9.3/8.8.7) id NAA03880
	for infobot-dev-list; Tue, 11 Jan 2000 13:42:32 -0500
Received: from fwnau040.usco.com (fwnau040.usco.com [207.92.15.79])
	by token.metronomicon.com (8.9.3/8.8.7) with ESMTP id NAA03877
	for <infobot-dev@infobot.org>; Tue, 11 Jan 2000 13:42:32 -0500
Received: from ntnau210.usco.com (ntnau210.usco.com [172.16.66.43])
	by fwnau040.usco.com (8.9.1/8.8.5) with ESMTP id NAA26262
	for <infobot-dev@infobot.org>; Tue, 11 Jan 2000 13:44:55 -0500 (EST)
Received: by ntnau210.usco.com with Internet Mail Service (5.5.2650.21)
	id <ZAJX8QTA>; Tue, 11 Jan 2000 13:44:54 -0500
Message-ID: <A1335534778DD311991300A0C9F3B3F268C76F@ntnau220.usco.com>
From: "Meltzer, Kevin" <KMeltzer@USCO.com>
To: "'infobot-dev@infobot.org'" <infobot-dev@infobot.org>
Subject: Wuname
Date: Tue, 11 Jan 2000 13:44:49 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: multipart/mixed;
	boundary="----_=_NextPart_000_01BF5C63.F2F8BF20"
Sender: infobot-dev@metronomicon.com
Precedence: bulk
Status: O

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01BF5C63.F2F8BF20
Content-Type: text/plain;
	charset="iso-8859-1"

Since we were having fun for a bit this morning with getting wunames, I
modularized it:

wuname Larry Wall 
or
wuname for Larry Wall 

returns:
wuname for Larry Wall is 'Asthmatic Enemy of God'

Cheers,
Kevin

 <<Wuname.pm>> 

------_=_NextPart_000_01BF5C63.F2F8BF20
Content-Type: application/octet-stream;
	name="Wuname.pm"
Content-Disposition: attachment;
	filename="Wuname.pm"

#!/usr/bin/perl

package Infobot::Module::Wuname;

use strict;
use Infobot::Module;

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

my $anybad;

BEGIN {
  $anybad = 0;
  eval "use LWP::UserAgent";
  $@ and do { $anybad = "Wuname is missing LWP::UserAgent\n"; 
	      print STDERR $anybad; };
}

sub new {
  return undef if $anybad;
  my $class = shift ;
  my $self  = $class->SUPER::new(@_);

  $self->weight(1); 

  $self->name('Wuname');
  $self->regex(qr/^wuname(?:\s+for)?\s+(.*)$/i);
  $self->usage('wuname (for)? Joe Schmoe');
  $self->descrip("Get someones Wuname");

  bless $self, $class;
}

sub action {
  my ($self, $message) = @_;

  return '' unless $self->enabled;
  my $name = $message->get('args')->[0];
  my ($fname, $sname) = split(/\s+/,$name);
  $fname = ucfirst($fname);
  $sname = ucfirst($sname);

  my $result;

  my $url = "http://www.recordstore.com/cgi-bin/wuname/wuname.pl?fname=$fname&sname=$sname";

  my $ua = new LWP::UserAgent;
  $ua->timeout(4);
  $ua->proxy('http','http://wwwproxy1.external.usco.com:8000/');
  my $req =  HTTP::Request->new('GET', $url);
  my $res = $ua->request($req);

  return "there was some error getting a wuname from $url" 
      unless $res->is_success;

  my $content = $res->content;
  $content =~ s/\n//g;
  if ($content =~ /<SPAN class=\"newname\">(.*?)<\/SPAN>/ig) {
	$result = qq(wuname for $fname $sname is "$1");
  }else{
	$result = qq(There was a problem getting the Wuname: $1 $fname $sname);
  }

  return $result;
}
1;

__END__

=head1 NAME

Wuname.pm - Get your Wuname! (whatever that is)

=head1 SYNOPSIS

wuname for Kevin Meltzer
wuname Larry Wall

=head1 PREREQUISITES

LWP::*

=head1 PUBLIC INTERFACE

        wuname [for] <firstname> <lastname>

=head1 DESCRIPTION

Gets the wuname for the given name. This is a name based on names
from the band (sic) Wu-Tang Clan. I don't listen to them, but we
were having fun on #perl one day with this so I whipped this up.

=head1 AUTHORS

Kevin Meltzer ({KM}) <perlguy@perlguy.com>
The Wuname script is located at 
http://www.recordstore.com/cgi-bin/wuname/wuname.pl


------_=_NextPart_000_01BF5C63.F2F8BF20--


