#!/usr/local/bin/perl # BgTA SCRIPT use strict; use vars qw($VERSION %IRSSI %FEATURES); use Irssi; # Define Script Version $VERSION = '0.0.1'; %IRSSI = ( authors => '[^BgTA^]', contact => 'raul@bgta.net', name => 'BgTA Script', description => 'Byte\'s Gallery of the TAilor Script', license => 'Public Domain', ); # /bgversion command sub cmd_bgversion { my ($data, $server, $witem) = @_; print("\cC4BgTA Script v. ".$VERSION); foreach my $key (sort keys %IRSSI) { print("\cC4$key: \cC0".$IRSSI{$key}) unless $key =~ /name/i; } return 1; } Irssi::command_bind bgversion => \&cmd_bgversion; # /bghelp command $FEATURES{'help'} = "/bghelp \c0 List the BgTA Script FEATURES"; sub cmd_bghelp { my ($data, $server, $witem) = @_; print("\cC4BgTA Script v. ".$VERSION); foreach my $key (sort keys %FEATURES) { print("\cC4$key: \cC0".$FEATURES{$key}) unless $key =~ /name/i; } return 1; } Irssi::command_bind bghelp => \&cmd_bghelp; # GOOGLE $FEATURES{'google'} = "/bggoogle \cC7search_string \t \cC5Search one result in Google.com"; sub cmd_bggoogle { my ($data, $server, $witem) = @_; return unless $witem; use Net::Google; # Put here the Google Key. See Google->Tools & Services use constant LOCAL_GOOGLE_KEY => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $witem->command("me Google Searching [$data]..."); my $google = Net::Google->new(key=>LOCAL_GOOGLE_KEY); my $search = $google->search(max_results => 100); $search->query($data); my @tresults = @{$search->results()}; if(!defined($tresults[0])) { $witem->command("me NO RESULTS"); return; } my $title = $tresults[0]->title(); $title =~ s/<[^<]*>//ig; $witem->command("me ".$title."\cC2: ".$tresults[0]->URL()); return; } Irssi::command_bind bggoogle => \&cmd_bggoogle; # PHP Documentation $FEATURES{'php'} = "/bgphp \cC7function_name \t \cC5Search a PHP Function URL and Definition"; $FEATURES{'phpwb'} = "/bgphpwb \cC7function_name \t \cC5Search a PHP Function URL and Definition AND Kick BAN With the URL"; sub cmd_bgphp { my ($data, $server, $witem) = @_; return unless $witem; use LWP; my $Navigator = new LWP::UserAgent({ "agent" => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", "timeout" => "180", }); $data =~ s/\_/\-/ig; my $Page = $Navigator->get('http://www.php.net/manual/es/function.'.$data.'.php'); my $content = $Page->content if $Page->is_success; if($Page->is_success && $content =~ /([^<]*)([^<]*)<\/B\n> ([^<]*)/i) { $witem->command("me PHP Function $data:"); $witem->command("me Location: \cC5 http://www.php.net/manual/es/function.".$data.'.php'); if($content =~ /