#!perl -w use strict; use IO::Socket; if( @ARGV < 5 ) { print "\nUsage: b0t.pl [host] [port] [chan] [nick] [message]\n"; print "e.g. b0t.pl irc.epiknet.com 6667 b0tchan b0t hi\n"; exit; } my $line = ""; my $server = $ARGV[0]; my $port = $ARGV[1]; my $chan = "\#" . $ARGV[2]; my $nick = $ARGV[3]; my $command = $ARGV[4]; my $remote = IO::Socket::INET -> new ( Proto => "tcp", PeerAddr => $server , PeerPort => $port ); print "[~] Connection to " . $server . " on port " . $port . "\n"; unless( $remote ) { die " [-] Failure\n"; } print " [+] Success\n"; while( $line = <$remote> ) { if( $line =~ /(NOTICE AUTH).*(checking ident)/i ) { print $remote "NICK " . $nick . "\n"; print $remote "USER " . $nick . " " . $nick . " " . $nick . " +:" . $nick . "\n"; last; } } sleep( 1 ); print $remote "JOIN " . $chan . "\n"; while( $line = <$remote> ) { if ( $line =~ /^PING/ ) { print $remote "PONG :" . (split(/ :/, $line))[1] . "\n"; print $remote "JOIN " . $chan . "\n"; next; } if ( $line =~ /366/ ) { last; } } print "[+] Sending message\n"; print $remote "PRIVMSG " . $chan . " :" . $command . "\n"; print $remote "QUIT\n"; close $remote; print "[+] Quitting\n";
Readmore tags added by davido per consideration.
In reply to Re: Perl and Robots
by Isothop
in thread Perl and Robots
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |