#!/usr/bin/perl use DBI; use IO::Socket; ################################################################### $myName="acid.rizon.net"; $myPass="fupass"; $myTagline="Rizon Network Service"; $remoteIP="127.0.0.1"; $remotePort=27888; $mysqlHost="localhost"; $mysqlUser="acid"; $mysqlPass="die"; $mysqlDB="acid"; $log="acidictive.log"; ################################################################### $tmp=fork; if($tmp) { exit; } $db=DBI->connect("DBI:mysql:$mysqlDB:$mysqlHost",$mysqlUser,$mysqlPass); $db->{mysql_auto_reconnect} = 1; $irc=new IO::Socket::INET(PeerAddr=>$remoteIP,PeerPort=>$remotePort,Proto=>"tcp"); local $SIG{HUP} = sub { &rehash }; ################################################################### if(!$irc) { print "Couldn't connect to $remoteIP:$remotePort\n"; exit; } %nick=(); $hasSynched=0; &setConfig; &out("PASS $myPass :TS"); &out("CAPAB :EX IE HOPS HUB AOPS KLN GLN"); &out("SERVER $myName 1 :$myTagline"); &out("SVINFO 5 5 0 :"); foreach $key (keys %spamnick) { &introduceNick($key,$spamnick{$key}->{user},$spamnick{$key}->{host},$spamnick{$key}->{vhost},$spamnick{$key}->{name}); &setupNick($key); } sub setupNick { if(length($spamnick{$_[0]}->{nickpass})) { &out(":$_[0] PRIVMSG NickServ :identify $spamnick{$_[0]}->{nickpass}"); } if($spamnick{$_[0]}->{isoper}) { &out(":$_[0] OPER someuser somepass"); } if(length($spamnick{$_[0]}->{chans})) { my @t_chans = split(/\;/,$spamnick{$_[0]}->{chans}); for(my $i=0;$i || exit; $dat=~s/[\n,\t,\r]//g; # $debugOut=console; if($debugOut eq "console") { print "DEBUG: [$dat]\n"; } elsif(defined($debugOut)) { print $irc ":".$nickType{main}." PRIVMSG $debugOut :$dat\n"; } my @s=split(/ /,$dat); $s[0]=~s/^://; $s[10]=~s/^://; $command=lc($s[1]); if(time() > ($last+$config{spamcycle})) { &spamCycle; } if(lc($s[0]) eq "nick") #IN: [NICK Macleod 3 1083310686 +iph SpIkE d66-183-60-218.bchsia.telus.net Rizon-9b184f5.2fc699fc.bchsia.telus.net irc.cyberwatch.us 0 :Brad Baranyai] #IN: [NICK Wonderwall 4 1212206793 +ix ~zor1982 Rizon-9B7ED583.singnet.com.sg irc.gamepad.ca 0 bb116-14-12-134.singnet.com.sg :zor] { $s[1]=$command; $nick{$s[1]}->{user}=$s[5]; $nick{$s[1]}->{host}=$s[9]; $nick{$s[1]}->{vhost}=$s[6]; $nick{$s[1]}->{server}=$s[7]; $nick{$s[1]}->{name}=join(" ",@s[10..$#s]); ## ctcp version for stats/akill if($hasSynched && $s[7] ne "services.rizon.net") { &msg("monitor",$s[1],"\x01VERSION\x01"); #&out(":$myName 439 $s[1] \:Message target change too fast \<- Please ignore this message"); # $realipsa=inet_aton($s[9]); # if(length($realipsa) > 1) # { # my $gecos = join(" ",@s[10..$#s]); # $gecos=~s/^://; # $realipsb=inet_ntoa($realipsa); # &snotice("network-bopm", "\*\*\* Notice -- Client connecting: $s[1] \($s[5]\@$s[7]\) \[$realipsb\] \{users\}"); # &msg("main", "skynet", ' '.$s[1].' ('.$s[5].'@'.$s[9].') '.$realipsb.' ['.$gecos.']'); # } } } elsif($command eq "nick") #:WX-CaNUcK[009] NICK Guest2873696 :1083437423 { $s[2]=lc($s[2]); $s[0]=lc($s[0]); $nick{$s[2]}->{user}=$nick{$s[0]}->{user}; $nick{$s[2]}->{host}=$nick{$s[0]}->{host}; $nick{$s[2]}->{vhost}=$nick{$s[0]}->{vhost}; $nick{$s[2]}->{server}=$nick{$s[0]}->{server}; $nick{$s[2]}->{name}=$nick{$s[0]}->{name}; $nick{$s[2]}->{level}=$nick{$s[0]}->{level}; $nick{$s[2]}->{help}=$nick{$s[0]}->{help}; delete $nick{$s[0]}; } elsif(lc($s[0]) eq "ping") { &out("PONG :$myName"); } elsif($command eq "quit") #IN: [:Sena_Robin QUIT :Ping timeout: 245 seconds] { my ($quitmsg) = join(" ",@s[2..$#s]); if($quitmsg=~/XDCC Catcher/i) { &svsmode($s[0],"+P"); } delete($nick{lc($s[0])}); } elsif($command eq "svshost") #:services.rizon.net SVSHOST pdi :staff.rizon.net { $s[3]=~s/^://; $nick{lc($s[2])}->{vhost}=$s[3]; } elsif($command eq "server") #:haley.rizon.net SERVER kenzie.rizon.net 2 :matty is ALL mine@# { my $blah=$db->prepare("SELECT `resv`,`reason` FROM `resv`"); $blah->execute; while(my @l=$blah->fetchrow_array) { &out("RESV $s[2] $l[0] :$l[1]"); } } elsif($command eq "kill") #:pdi KILL kenzie :the.hub!staff.rizon.net!pdi!pdi (testing) { if(defined($spamnick{$s[2]}->{host})) { &operwall("$c{main}$c{bold}$s[0]$c{bold} killed my client, $s[2]. Recreating...$c{end}"); sleep(1); &introduceNick($s[2],$spamnick{$s[2]}->{user},$spamnick{$s[2]}->{host},$spamnick{$s[2]}->{vhost},$spamnick{$s[2]}->{name}); &setupNick($s[2]); } elsif(lc($s[2]) eq "jackfrost") { $s[0]=lc($s[0]); &kill($s[0], "Revenge is sweet.") } elsif(lc($s[2]) eq "wolf") { $s[0]=lc($s[0]); &kill($s[0], "Revenge is sweet.") } # my $blah=$db->do("DELETE FROM `version` WHERE `nick` = ".$db->quote($s[2])); } elsif($command eq "kick") # :pdi KICK #x PurpleCONe :.1819. { if(defined($spamnick{$s[3]}->{host})) { &joinChan($s[3],$s[2]); } } elsif($command eq "sjoin") { $s[5]=~s/\://g; my ($snick,$chan) = ($s[5],$s[3]); $snick =~s/\@|\!|\+|\%//g; if(defined($onjoin{lc($chan)})) { my $b=$db->prepare("select * from `onjoin` where `chan` = '$chan'"); $b->execute; my @l=$b->fetchrow_array; if($l[0] == 0) { &kill($snick,$l[2]); } elsif($l[0] == 1) { &akill($snick,$l[3],$l[2]); } $db->do("update `onjoin` set `count` = `count` +1 where `chan` = '$chan'"); } if($chan=~/#help/i && $hasSynched) { $nick{$snick}->{help}=1; if($config{helplines} > 0) { $confirm_code=&randChars($config{helpconfirmcodelength}); for(my $i=1;$i<=$config{helplines};$i++) { $line = $config{"helpline$i"}; $line =~s//$confirm_code/ig; ¬ice("helpserv",$snick,$line); } $db->do("insert into `confirmcodes` values(UNIX_TIMESTAMP(),'$snick','$confirm_code')"); } } } elsif($command eq "privmsg") { $s[3]=~s/^://; $msg=join(" ",@s[3..$#s]); $msg=~s/\s*$//; $s[0]=lc($s[0]); if(!$hasSynched) { $hasSynched = 1; &operwall("$c{main}$myName synched in $c{bold}".(time()-$last)." seconds$c{bold}$c{end}"); } if(lc($s[2]) eq lc($nickType{spamserv})) { if(lc($s[3]) eq "check" && substr($s[4],0,1) eq "#" && length($s[4]) > 1) { my $blah=$db->prepare("select * from `checkrequests` where `chan` = '$s[4]' AND `time` > '".(time()-$config{mincheckrequest})."' ORDER BY `time` DESC LIMIT 1"); $num=$blah->execute; if($num>0) { @l=$blah->fetchrow_array; ¬ice("spamserv",$s[0],"$c{main}You must $c{bold}wait ".($config{mincheckrequest}-(time()-$l[1]))." seconds$c{bold} before requesting a check on $s[4].$c{end}"); } else { ¬ice("spamserv",$s[0],"$c{main}Checking $c{bold}$s[4]$c{bold} now...$c{end}"); &joinChan($spamNicks[$spamNum],$s[4]); my $blah=$db->do("insert into `checkrequests` values('$s[4]',UNIX_TIMESTAMP(),'$s[0]')"); $checkChans[scalar(@checkChans)]=$s[4]; } } } elsif(lc($s[2]) eq lc($nickType{helpserv})) { if(lc($s[3]) eq "confirm" && length($s[4]) == $config{helpconfirmcodelength}) { my $blah=$db->prepare("select * from `confirmcodes` where `code` = '$s[4]'"); # where `nick` = '$s[0]' AND `time` < '".(time()-$config{helpcodeexpiry})."' ORDER BY `time` DESC LIMIT 1"); if(($num=$blah->execute)>0) { @l=$blah->fetchrow_array; if($l[0] < (time()+$config{helpcodeexpiry})) { if(lc($l[1]) eq lc($s[0])) { ¬ice("helpserv",$s[0],"$config{helpconfirmsuccess}"); &out("mode #help +v $s[0]"); $db->do("delete from `confirmcodes` where `code` = '$s[4]'"); } else { ¬ice("helpserv",$s[0],"$c{main}Only $l[1] can confirm using this code.$c{end}"); } } else { ¬ice("helpserv",$s[0],"$c{main}Your confirm code has expired, please cycle #help for a new one.$c{end}"); } } else { ¬ice("spamserv",$s[0],"$c{main}Invalid confirm code.$c{end}"); } } } elsif(lc($s[2]) eq lc($nickType{vhostserv})) { } elsif(lc($s[2]) eq lc($nickType{monitor})) { # do something with version replies? ignore from spam... } elsif(lc($s[2]) eq lc($nickType{main})) { &log($dat); if(lc($s[3]) eq "identify") { if($access{$s[0]}->{pass} eq $s[4]) { $nick{$s[0]}->{level}=$access{$s[0]}->{level}; ¬ice("main",$s[0],"$c{main}You're now authed with access level $c{bold}".$nick{$s[0]}->{level}."$c{bold}$c{end}"); } else { ¬ice("main",$s[0],"$c{main}Incorrect pass for $c{bold}$s[0]$c{bold}$c{end}"); } } elsif(lc($s[3]) eq "rehash") { if(&checkAccess($s[0],"rehash","main")) { &setConfig; ¬ice("main",$s[0],"$c{main}Successfully rehashed.$c{end}"); &operwall("$c{main}$c{bold}$s[0]$c{bold} rehashed me.$c{end}"); } } elsif(lc($s[3]) eq "restart") { if(&checkAccess($s[0],"restart","main")) { ¬ice("main",$s[0],"$c{main}Yeah right! Like I'd restart myself.$c{end}"); } } elsif(lc($s[3]) eq "shutdown") { if(&checkAccess($s[0],"shutdown","main")) { ¬ice("main",$s[0],"$c{main}Shutting down...$c{end}"); &operwall("$c{main}$c{bold}$s[0]$c{bold} is shutting me down.$c{end}"); # for(my $i=0;$iprepare("SELECT * FROM `resv` WHERE `resv` = '$s[5]'"); # nick time resv reason $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} already exists.$c{end}"); } else { $reason=join(" ",@s[6..$#s]); &out("RESV * $s[5] :$reason"); my $blah=$db->do("INSERT INTO `resv` VALUES('$s[0]',UNIX_TIMESTAMP(),'$s[5]','$reason')"); ¬ice("main",$s[0],"$c{main}Added $c{bold}$s[5]$c{bold} to the resv list.$c{end}"); } } elsif($s[4] eq "del" && $s[5]) { my $blah=$db->prepare("SELECT * FROM `resv` WHERE `resv` = '$s[5]'"); $num=$blah->execute; if($num>0) { &out("UNRESV * $s[5]"); my $blah=$db->do("DELETE FROM `resv` WHERE `resv` = '$s[5]'"); ¬ice("main",$s[0],"$c{main}Deleted $c{bold}$s[5]$c{bold} from the resv list.$c{end}"); } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} was not found.$c{end}"); } } elsif($s[4] eq "list" && $s[5]) { my $blah=$db->prepare("SELECT * FROM `resv` WHERE `resv` LIKE '%$s[5]%' ORDER BY `resv`"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}There are $c{bold}$num$c{bold} resvs matching \"$c{bold}$s[5]$c{bold}\".$c{end}"); $i=0; while(my @l=$blah->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[2]$c{bold}$c{end} ($l[3]) set by $l[0] ".&approxTime(time()-$l[1])." ago"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} resvs matching \"$c{bold}$s[5]$c{bold}\".$c{end}"); } } elsif($s[4] eq "list") { # nick time resv reason my $blah=$db->prepare("SELECT * FROM `resv` ORDER BY `resv`"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}There are $c{bold}$num$c{bold} resvs.$c{end}"); $i=0; while(my @l=$blah->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[2]$c{bold}$c{end} ($l[3]) set by $l[0] ".&approxTime(time()-$l[1])." ago"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} resvs.$c{end}"); } } } } elsif(lc($s[3]) eq "raw") { if(&checkAccess($s[0],"raw","main")) { if($s[6] eq "jackfrost") { ¬ice("main",$s[0],"$c{main}$c{bold}Failed$c{bold} to send raw command.$c{end}"); } elsif($s[6] eq "jackfrost|work") { ¬ice("main",$s[0],"$c{main}$c{bold}Failed$c{bold} to send raw command.$c{end}"); } elsif(defined($s[4])) { $rawText=join(" ",@s[4..$#s]); $rawText=~s/\s*$//g; &out($rawText); ¬ice("main",$s[0],"$c{main}Sent $c{bold}\"$rawText\"$c{bold}.$c{end}"); } } } elsif(lc($s[3]) eq "debug") { if(&checkAccess($s[0],"debug","main")) { if(!length($s[4]) || lc($s[4]) eq "off") { undef $debugOut; ¬ice("main",$s[0],"$c{main}Debug data is now $c{bold}off$c{bold}$c{end}"); } else { $debugOut=$s[4]; ¬ice("main",$s[0],"$c{main}Now sending all debug data to $c{bold}$debugOut$c{bold}$c{end}"); } } } elsif(lc($s[3]) eq "akillnicks") { #raw :hoeserv PRIVMSG operserv :akill add +2d *@pcp740502pcs.reston01.va.comcast.net botnet (pdi) #akillnicks +2d botnet_pdi $1- if(&checkAccess($s[0],"akillnicks","main")) { if(defined($s[6])) { $time=$s[4]; $reason=$s[5]; $reason=~s/_/ /g; $total=0; $found=0; for(my $i=6;$i{host})) { $host=$nick{lc($s[$i])}->{host}; &msg("main","OperServ","akill add $time \*\@$host $reason ($s[0])"); $found++; } } } ¬ice("main",$s[0],"$c{main}Akilled $found/$total hosts.$c{end}"); } } } elsif(lc($s[3]) eq "gethost") { if(&checkAccess($s[0],"gethost","main")) { for(my $i=4;$i{host})) { ¬ice("main",$s[0],"$c{main}$s[$i] $nick{lc($s[$i])}->{host}$c{end}"); } } } } elsif(lc($s[3]) eq "xdcchost") { if(&checkAccess($s[0],"xdcchost","main")) { @n=split(/\;/,$config{xdccnicks}); for(my $i=4;$i{host})) { my $ok; for(my $e=0;$e{host}$c{end}"); } else { ¬ice("main",$s[0],"$c{main}$s[$i] is not an xdcc nick.$c{end}") } } } } } elsif(lc($s[3]) eq "userlist") { if(&checkAccess($s[0],"userlist","main")) { if(defined($s[4]) && defined($s[5])) { $s5=$s[5]; $s[5] =~s/([\[,\],\\,\/,\^,\(,\),\-,\|]{1})/\\$1/g; $found=0; foreach $key (keys %nick) { if($found > $config{userlistmax}) { ¬ice("main",$s[0],"$c{main}Over $config{userlistmax} results.$c{end}"); last; } elsif(!$config{userlistregex}) { if((lc($s[4]) eq "nick" && &match($key,$s[5])) || (defined($nick{$key}->{$s[4]}) && &match($nick{$key}->{$s[4]},$s[5]))) { ¬ice("main",$s[0],"$c{main}$c{bold}$key$c{bold}!$nick{$key}->{user}\@$nick{$key}->{host}\[$nick{$key}->{vhost}\] ($nick{$key}->{name})$c{end}"); $found++; } } else { if((lc($s[4]) eq "nick" && $key=~/$s5/) || (defined($nick{$key}->{$s[4]}) && $nick{$key}->{$s[4]}=~/$s[5]/)) { ¬ice("main",$s[0],"\~$c{main}$c{main}$c{bold}$key$c{bold}!$nick{$key}->{user}\@$nick{$key}->{host}\[$nick{$key}->{vhost}\] ($nick{$key}->{name})$c{end}"); $found++; } } } if($found) { if($found<=$config{makillmax}) { my $rand_id = &randChars($config{makillidlen}); my $b = $db->do("insert into `makill` values('$rand_id','$s[0]',UNIX_TIMESTAMP(),'$s[4]','$s5')"); ¬ice("main",$s[0],"$c{main}Type /msg $nickType{main} makill confirm $rand_id to akill this userlist. This command will be void in $c{bold}$config{makillexpire}$c{bold} seconds.$c{end}"); } ¬ice("main",$s[0],"$c{main}Found $c{bold}$found$c{bold} $s[4] match(es) for $s[5].$c{end}"); } else { ¬ice("main",$s[0],"$c{main}Nothing found for $c{bold}$s[5]$c{bold}.$c{end}"); } } } } elsif(lc($s[3]) eq "makill") { if(&checkAccess($s[0],"makill","main")) { if($s[4] eq "confirm" && defined($s[5])) { my $b = $db->prepare("select `type`,`match` from `makill` where `id` = '$s[5]' and `nick` = '$s[0]' and `time` >= ".(time()-$config{makillexpire})." limit 1"); if(($b->execute)>0) { my @l = $b->fetchrow_array; $l[1] =~s/([\[,\],\\,\/,\^,\(,\),\-,\|]{1})/\\$1/g; $found=0; foreach $key (keys %nick) { if($found>$config{makillmax}) { ¬ice("main",$s[0],"$c{main}Akilled max of $c{bold}$config{makillmax}$c{bold} nicks.$c{end}"); last; } elsif((lc($l[0]) eq "nick" && &match($key,$l[1])) || (defined($nick{$key}->{$l[0]}) && &match($nick{$key}->{$l[0]},$l[1]))) { # ¬ice("main",$s[0],"$c{main}$c{bold}$key$c{bold}!$nick{$key}->{user}\@$nick{$key}->{host}\[$nick{$key}->{vhost}\] ($nick{$key}->{name})$c{end}"); &akill($key,$config{makilltime},$config{makillreason}); # &msg("main",$s[0],"\&akill($key,$config{makilltime},$config{makillreason});"); $found++; } } ¬ice("main",$s[0],"$c{main}Akilled $c{bold}$found$c{bold} nicks.$c{end}"); } else { ¬ice("main",$s[0],"$c{main}The ID '$c{bold}$s[5]$c{bold}' is invalid.$c{end}"); } } } } elsif(lc($s[3]) eq "vars") { if(&checkAccess($s[0],"vars","main")) { if($s[4] eq "set" && defined($s[5]) && defined($s[6])) { $s[6] = join(" ",@s[6..$#s]); my $b = $db->prepare("select * from `config` where `name` = '$s[5]'"); if(($b->execute)>0) { my @l = $b->fetchrow_array; ¬ice("main",$s[0],"$c{main}Changed $c{bold}$s[5]$c{bold} from '$l[1]' -> '$s[6]'.$c{end}"); my $b = $db->do("update `config` set `value` = '$s[6]' where `name` = '$s[5]'"); } else { ¬ice("main",$s[0],"$c{main}Set $c{bold}$s[5]$c{bold} -> '$s[6]'.$c{end}"); my $b = $db->do("insert into `config` values('$s[5]','$s[6]')"); } &rehash; } elsif($s[4] eq "list" && defined($s[5])) { my $b = $db->prepare("select * from `config` where `name` like '%$s[5]%'"); if(($b->execute)>0) { my $found = 0; while(my @l = $b->fetchrow_array) { $found++; ¬ice("main",$s[0],"$c{main}$c{bold}$l[0]$c{bold} -> $l[1]$c{end}"); } ¬ice("main",$s[0],"$c{main}$c{bold}$found$c{bold} vars matched '*$s[5]*'$c{end}"); } else { ¬ice("main",$s[0],"$c{main}Nothing matched $c{bold}'*$s[5]*'$c{bold}$c{end}"); } } elsif($s[4] eq "list") { my $b = $db->prepare("select * from `config`"); if(($b->execute)>0) { my $total = 0; while(my @l = $b->fetchrow_array) { $total++; ¬ice("main",$s[0],"$c{main}$c{bold}$l[0]$c{bold} -> $l[1]$c{end}"); } ¬ice("main",$s[0],"$c{main}$c{bold}$total$c{bold} total vars.$c{end}"); } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} vars.$c{end}"); } } } } elsif(lc($s[3]) eq "spamcycle") { if(&checkAccess($s[0],"spamcycle","main")) { &spamCycle; ¬ice("main",$s[0],"$c{main}Cycled $c{bold}spam$c{bold} chans.$c{end}"); } } elsif(lc($s[3]) eq "spamcheck") { if(&checkAccess($s[0],"spamcheck","main")) { if(defined($s[4]) && defined($s[5]) && $s[4]=~/^(id|nick|user|host|vhost|name|server|spam)$/i) { $s[5]=~s/\*/\%/g; my $b = $db->prepare("select * from `spamtrack` where `$s[4]` like '$s[5]'"); my $num = $b->execute; if($num>0) { my $i = 0; while(my @l=$b->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i. $c{bold}$l[0]$c{bold} ".&approxTime(time()-$l[1])." ago - $l[2]!$l[3]\@$l[4]/$l[5] ($l[6]) on $l[7] \"$l[8]\".$c{end}"); } } else { ¬ice("main",$s[0],"$c{main}A spam $c{bold}$s[4]$c{bold} matching '$c{bold}$s[5]$c{bold}' was not found.$c{end}"); } } } } elsif(lc($s[3]) eq "vhost") { if(defined($s[4]) && defined($s[5])) { my $blah=$db->prepare("SELECT * FROM `vhosts` WHERE `user` = '$s[4]'"); #user pass vhost creator created lastused $num=$blah->execute; if($num>0) { my @l=$blah->fetchrow_array; if(lc($l[1]) eq lc($s[5])) { &out(":$myName CHGHOST $s[0] $l[2]"); ¬ice("main",$s[0],"$c{main}$c{bold}$l[2]$c{bold} has been activated.$c{end}"); my $blah=$db->do("UPDATE `vhosts` SET `lastused` = UNIX_TIMESTAMP() WHERE `user` = '$s[4]'"); } else { ¬ice("main",$s[0],"$c{main}Incorrect password for $c{bold}$s[4]$c{bold}.$c{end}"); } } else { ¬ice("main",$s[0],"$c{main}The user $c{bold}$s[4]$c{bold} does not exist.$c{end}"); } } } elsif(lc($s[3]) eq "avhost") { $s[4]=lc($s[4]); if(&checkAccess($s[0],"avhost","main")) { if($s[4] eq "add" && $s[5] && $s[6] && $s[7]) { my $blah=$db->prepare("SELECT * FROM `vhosts` WHERE `user` = '$s[5]'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} already exists.$c{end}"); } else { my $blah=$db->do("INSERT INTO `vhosts` VALUES('$s[5]','$s[6]','$s[7]','$s[0]',UNIX_TIMESTAMP(),'0')"); ¬ice("main",$s[0],"$c{main}Added $c{bold}$s[5]$c{bold}.$c{end}"); } } elsif($s[4] eq "del" && $s[5]) { my $blah=$db->prepare("SELECT * FROM `vhosts` WHERE `user` = '$s[5]'"); $num=$blah->execute; if($num>0) { my $blah=$db->do("DELETE FROM `vhosts` WHERE `user` = '$s[5]'"); ¬ice("main",$s[0],"$c{main}Deleted $c{bold}$s[5]$c{bold}.$c{end}"); } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} was not found.$c{end}"); } } elsif($s[4] eq "list" && $s[5]) { my $blah=$db->prepare("SELECT * FROM `vhosts` WHERE `vhost` LIKE '%$s[5]%'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}There are $c{bold}$num$c{bold} vhosts matching \"$c{bold}$s[5]$c{bold}\".$c{end}"); $i=0; while(my @l=$blah->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i: $l[0]/$l[1] - $c{bold}$l[2]$c{bold}$c{end}"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} vhosts matching \"$c{bold}$s[5]$c{bold}\".$c{end}"); } } elsif($s[4] eq "list") { my $blah=$db->prepare("SELECT * FROM `vhosts`"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}There are $c{bold}$num$c{bold} vhosts.$c{end}"); $i=0; while(my @l=$blah->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i: $l[0]/$l[1] - $c{bold}$l[2]$c{bold}$c{end}"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} vhosts.$c{end}"); } } } } elsif(lc($s[3]) eq "vhostadmin") { if(&checkAccess($s[0],"vhostadmin","main")) { if($s[4] eq "list") { my $blah=$db->prepare("SELECT * FROM `spam` order by `type`"); $num=$blah->execute; my $last; if($num>0) { while(my @l=$blah->fetchrow_array) { $i++; if($l[0] ne $last) { $i=1; ¬ice("main",$s[0],"$c{main}--== $c{bold}$l[0] type$c{bold} ==--$c{end}"); } ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[1]$c{bold}$c{end}"); $last=$l[0]; } } else { ¬ice("main",$s[0],"$c{main}There is $c{bold}no$c{bold} spam/exclude list.$c{end}"); } } elsif($s[4] eq "add" && defined($s[5]) && defined($s[6])) { my $blah=$db->prepare("SELECT * FROM `spam` WHERE `type` = '$s[5]' AND `spam` = '$s[6]'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[6]$c{bold} already exists in the $s[5] list!"); } elsif($s[5]=~/(exclude|spam)/i) { my $blah=$db->do("INSERT INTO `spam` VALUES('$s[5]','$s[6]')"); ¬ice("main",$s[0],"$c{main}Added $c{bold}$s[6]$c{bold} to the $s[5] list.$c{end}"); &setConfig; } } elsif($s[4] eq "del" && defined($s[5]) && defined($s[6])) { my $blah=$db->prepare("SELECT * FROM `spam` WHERE `type` = '$s[5]' AND `spam` = '$s[6]'"); $num=$blah->execute; if($num>0) { my $blah=$db->do("DELETE FROM `spam` WHERE `type` = '$s[5]' AND `spam` = '$s[6]'"); ¬ice("main",$s[0],"$c{main}Removed $c{bold}$s[6]$c{bold} from the $s[5] list.$c{end}"); &setConfig; } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[6]$c{bold} was not found in the $s[5] list.$c{end}"); } } } } elsif(lc($s[3]) eq "spam") { if(&checkAccess($s[0],"spam","main")) { if($s[4] eq "list") { my $blah=$db->prepare("SELECT * FROM `spam` order by `type`"); $num=$blah->execute; my $last; if($num>0) { while(my @l=$blah->fetchrow_array) { $i++; if($l[0] ne $last) { $i=1; ¬ice("main",$s[0],"$c{main}--== $c{bold}$l[0] type$c{bold} ==--$c{end}"); } ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[1]$c{bold}$c{end}"); $last=$l[0]; } } else { ¬ice("main",$s[0],"$c{main}There is $c{bold}no$c{bold} spam/exclude list.$c{end}"); } } elsif($s[4] eq "add" && defined($s[5]) && defined($s[6])) { $s[6]=join(" ",@s[6..$#s]); my $blah=$db->prepare("SELECT * FROM `spam` WHERE `type` = '$s[5]' AND `spam` = '$s[6]'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[6]$c{bold} already exists in the $s[5] list!"); } elsif($s[5]=~/(exclude|spam)/i) { my $blah=$db->do("INSERT INTO `spam` VALUES('$s[5]','$s[6]')"); ¬ice("main",$s[0],"$c{main}Added $c{bold}$s[6]$c{bold} to the $s[5] list.$c{end}"); &setConfig; } } elsif($s[4] eq "del" && defined($s[5]) && defined($s[6])) { $s[6]=join(" ",@s[6..$#s]); my $blah=$db->prepare("SELECT * FROM `spam` WHERE `type` = '$s[5]' AND `spam` = '$s[6]'"); $num=$blah->execute; if($num>0) { my $blah=$db->do("DELETE FROM `spam` WHERE `type` = '$s[5]' AND `spam` = '$s[6]'"); ¬ice("main",$s[0],"$c{main}Removed $c{bold}$s[6]$c{bold} from the $s[5] list.$c{end}"); &setConfig; } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[6]$c{bold} was not found in the $s[5] list.$c{end}"); } } } } elsif(lc($s[3]) eq "spamchans") { if(&checkAccess($s[0],"spamchans","main")) { if($s[4] eq "list") { my $blah=$db->prepare("SELECT * FROM `spamchans` ORDER BY `chan`"); $num=$blah->execute; $i=0; if($num>0) { while(my @l=$blah->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[0]$c{bold}$c{end}"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no chans$c{bold} being monitored for spam$c{end}"); } } elsif($s[4] eq "add" && defined($s[5])) { my $blah=$db->prepare("SELECT * FROM `spamchans` WHERE `chan` = '$s[5]'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} is already being monitored for spam.$c{end}"); } else { my $blah=$db->do("INSERT INTO `spamchans` VALUES('$s[5]')"); &joinChan($spamNicks[$spamNum],$s[5]); &joinChan($nickType{spamidle},$s[5]); ¬ice("main",$s[0],"$c{main}The spam detector is now monitoring $c{bold}$s[5]$c{bold}.$c{end}"); &setConfig; } } elsif($s[4] eq "del" && defined($s[5])) { my $blah=$db->prepare("SELECT * FROM `spamchans` WHERE `chan` = '$s[5]'"); $num=$blah->execute; if($num>0) { my $blah=$db->do("DELETE FROM `spamchans` WHERE `chan` = '$s[5]'"); ¬ice("main",$s[0],"$c{main}The spam detector has been removed from $c{bold}$s[5]$c{bold}$c{end}"); &setConfig; &partChan($spamNicks[$spamNum],$s[5]); &partChan($nickType{spamidle},$s[5]); } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} is not a monitored chan.$c{end}"); } } } } elsif(lc($s[3]) eq "access") { if(&checkAccess($s[0],"access","main")) { if($s[4] eq "list") { #user pass level my $blah=$db->prepare("SELECT * FROM `access`"); $num=$blah->execute; if($num>0) { $i=0; while(my @l=$blah->fetchrow_array) { $i++; ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[0]$c{bold}/$l[1] - $l[2]$c{end}"); } } else { ¬ice("main",$s[0],"$c{main}There is $c{bold}no one$c{bold} with access.$c{end}"); } } elsif($s[4] eq "add" && defined($s[5]) && defined($s[6]) && defined($s[7])) { my $blah=$db->prepare("SELECT * FROM `access` WHERE `user` = '$s[5]'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} already exists.$c{end}"); } elsif($s[7] <= 100) { my $blah=$db->do("INSERT INTO `access` VALUES('".lc($s[5])."','$s[6]','$s[7]')"); ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} added.$c{end}"); &setConfig; } } elsif($s[4] eq "del" && defined($s[5])) { my $blah=$db->prepare("SELECT * FROM `access` WHERE `user` = '$s[5]'"); $num=$blah->execute; if($num>0) { my $blah=$db->do("DELETE FROM `access` WHERE `user` = '$s[5]'"); ¬ice("main",$s[0],"$c{main}Removed $c{bold}$s[5]$c{bold}.$c{end}"); &setConfig; } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} does not exist.$c{end}"); } } } } elsif(lc($s[3]) eq "onjoin") { if(&checkAccess($s[0],"onjoin","main")) { if($s[4] eq "add" && $s[5] && $s[6] && $s[7]) { #kill/akill [expiry] my $blah=$db->prepare("SELECT * FROM `onjoin` WHERE `chan` = '$s[6]'"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}$c{bold}$s[6]$c{bold} already exists.$c{end}"); } else { $reason=$s[7]; $reason=~s/\_/ /g; $action = -1; if(lc($s[5]) eq "kill") { $action = 0; } elsif(lc($s[5]) eq "akill") { $action = 1; } else { ¬ice("main",$s[0],"$c{main}You must specify if the onjoin action will be kill or akill.$c{end}"); } if($action == 1 && !defined($s[8])) { $s[8] = $config{defaultonjoinexpiry}; } if($action>=0) { my $blah=$db->do("INSERT INTO `onjoin` VALUES('$action','$s[6]',".$db->quote($reason).",'$s[8]','$s[0]',UNIX_TIMESTAMP(),'0')"); ¬ice("main",$s[0],"$c{main}Added $c{bold}$s[6]$c{bold} to the onjoin $s[5] list.$c{end}"); } $onjoin{lc($s[6])}=1; } } elsif($s[4] eq "del" && $s[5]) { my $blah=$db->prepare("SELECT * FROM `onjoin` WHERE `chan` = '$s[5]'"); $num=$blah->execute; if($num>0) { my $blah=$db->do("DELETE FROM `onjoin` WHERE `chan` = '$s[5]'"); delete $onjoin{lc($s[5])}; ¬ice("main",$s[0],"$c{main}Deleted $c{bold}$s[5]$c{bold} from the onjoin list.$c{end}"); } else { ¬ice("main",$s[0],"$c{main}$c{bold}$s[5]$c{bold} was not found.$c{end}"); } } elsif($s[4] eq "list" && $s[5]) { my $blah=$db->prepare("SELECT * FROM `onjoin` WHERE `chan` LIKE '%$s[5]%' ORDER BY `chan`"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}There are $c{bold}$num$c{bold} onjoin kills/akills matching \"$c{bold}$s[5]$c{bold}\".$c{end}"); $i=0; while(my @l=$blah->fetchrow_array) { $i++; $action = "kill"; if($l[0] == 1) { $action = "akill"; } ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[1]/$action/$l[6]$c{bold} ($l[2]) set by $l[4] ".&approxTime(time()-$l[5])." ago"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} onjoin kills/akills matching \"$c{bold}$s[5]$c{bold}\".$c{end}"); } } elsif($s[4] eq "list") { my $blah=$db->prepare("SELECT * FROM `onjoin` ORDER BY `chan`"); $num=$blah->execute; if($num>0) { ¬ice("main",$s[0],"$c{main}There are $c{bold}$num$c{bold} onjoin kills/akills.$c{end}"); $i=0; while(my @l=$blah->fetchrow_array) { $i++; $action = "kill"; if($l[0] == 1) { $action = "akill"; } ¬ice("main",$s[0],"$c{main}$i: $c{bold}$l[1]/$action/$l[6]$c{bold} ($l[2]) set by $l[4] ".&approxTime(time()-$l[5])." ago"); } } else { ¬ice("main",$s[0],"$c{main}There are $c{bold}no$c{bold} onjoin kills/akills.$c{end}"); } } } } elsif(lc($s[3]) eq "help") { my $blah=$db->prepare("select * from `help` order by `category`,`command`,`help`"); $blah->execute; my $last; my $commands=0; my $axslvl=0; ¬ice("main",$s[0],"$c{main}--== $c{bold}$myName Help$c{bold} ==--$c{end}"); if($nick{$s[0]}->{level}) { $axslvl=$nick{$s[0]}->{level}; ¬ice("main",$s[0],"$c{main}You are logged in with access level $c{bold}$axslvl$c{bold}.$c{end}"); } else { ¬ice("main",$s[0],"$c{main}You are $c{bold}not$c{bold} logged in.$c{end}"); } ¬ice("main",$s[0],"$c{main}All commands begin with $c{bold}/msg $nickType{main}$c{bold}$c{end}"); ¬ice("main",$s[0],"$c{main}Key: [] indicates an optional field. <> indicates a type of user input, otherwise it is as stated.$c{end}"); while(my @l=$blah->fetchrow_array) { #$category = $command{$l[0]}; #if(!defined($level{$category}) || $axslvl>=$level{$category}) #{ # $commands++; # if($category ne $last) # { # ¬ice("main",$s[0],"$c{main}--== $c{bold}$category$c{bold} [$level{$category}] ==--$c{end}"); # } # ¬ice("main",$s[0],"$c{main}$c{bold}$l[0] $l[2] $c{bold}/ $l[1]$c{end}"); # $last=$category; #} if(!defined($level{$l[0]}) || $axslvl>=$level{$l[0]}) { $commands++; if($l[0] ne $last) { ¬ice("main",$s[0],"$c{main}--== $c{bold}$l[0]$c{bold} [$level{$l[0]}] ==--$c{end}"); } ¬ice("main",$s[0],"$c{main}$c{bold}$l[1] $l[3] $c{bold}/ $l[2]$c{end}"); $last=$l[0]; } } ¬ice("main",$s[0],"$c{main}End of help. You have access to $c{bold}$commands$c{bold} total commands.$c{end}"); } } else { if(substr($s[2],0,1) ne "#") { $nMsg=$msg; $nMsg=~s/'/\\i/g; my $spamMatch=0; my $excludeMatch=0; for(my $i=0;$i/$randID/g; my $b = $db->do("INSERT INTO `spamtrack` VALUES('$randID',UNIX_TIMESTAMP(),'$s[0]','$nick{$s[0]}->{user}','$nick{$s[0]}->{host}','$nick{$s[0]}->{vhost}','$nick{$s[0]}->{name}','$nick{$s[0]}->{server}',".$db->quote($msg).")"); &akill($s[0],$config{spamakilltime},$spamMsg); } else { &msg("main",$config{spamchan},"$c{main}$c{bold}Possible Spammer$c{bold}: $s[0] said \"$msg\".$c{end}"); } } } } # elsif($hasSynched && $dat=~/^:(.+) PART #help$/i) # { # delete $nick{$1}->{help}; # ¬ice("spamserv",$1,$config{parthelpmsg}); # } elsif($hasSynched && $dat=~/^:(.+) NOTICE $nickType{monitor} :\x01VERSION .*(iroffer).*\x01$/i) { $nick{$1}->{version}=$2; # &msg("monitor","pdi","Bot reply from $1"); &svsmode($1,"+".$config{botmode}); } elsif($hasSynched && $dat=~/^:(.+) NOTICE $nickType{monitor} :\x01VERSION .*(eggdrop v1.6.16).*\x01$/i) { $nick{$1}->{version}=$2; $host=$nick{lc($s[$1])}->{host}; &msg("main","OperServ","akill add +15d \*\@$host Compromised Eggdrop\:\ Please visit http\:\//www.rizon.net/kline.php for more information. ($s[0])"); } elsif($hasSynched && $dat=~/^:(.+) NOTICE $nickType{monitor} :\x01VERSION .*(ShellBOT).*\x01$/i) { $nick{$1}->{version}=$2; $host=$nick{lc($s[$1])}->{host}; &msg("main","OperServ","akill add +15d \*\@$host Compromised host [ShellBOT]\:\ Please visit http\:\//www.rizon.net/kline.php for more information. ($s[0])"); } # elsif($hasSynched && $dat=~/^:(.+) NOTICE $nickType{monitor} :\x01VERSION .*(eggdrop v1.6.16).*\x01$/i) # { # $nick{$1}->{version}=$2; # $host=$nick{lc($s[$1])}->{host}; # &msg("main","OperServ","akill add +15d \*\@$host Upgrade ($s[0])"); # # } } sub spamCycle { for(my $i=0;$i $_[1] +tn :$_[0]"); } sub partChan #nick,chan { &out(":$_[0] PART $_[1]"); } sub introduceNick { # new = &out("NICK $_[0] 1 +i $_[1] $_[2] $myName :$_[4]"); if($_[0] eq "RootServ") { &out("NICK $_[0] 3 +ioarSN $_[1] $_[3] $myName $_[2] :$_[4]"); } else { &out("NICK $_[0] 3 +irS $_[1] $_[3] $myName $_[2] :$_[4]"); } } sub checkAccess { if($nick{$_[0]}->{level} >= $level{$command{$_[1]}}) { return 1; } if(!defined($nick{$_[0]}->{level})) { ¬ice($_[2],$_[0],"$c{main}You must be $c{bold}logged in$c{bold} to use this command!$c{end}"); } else { ¬ice($_[2],$_[0],"$c{main}Your access level must be greater than or equal to $c{bold}$level{$command{$_[1]}}$c{bold} to use this command!$c{end}"); } return 0; } sub operwall { &out(":$myName OPERWALL :$_[0]"); } sub notice { &out(":".$nickType{$_[0]}." NOTICE $_[1] :$_[2]"); } sub snotice { &out(":$myName NOTICE $_[0] :$_[1]"); } sub msg { &out(":".$nickType{$_[0]}." PRIVMSG $_[1] :$_[2]"); } sub out { $line=$_[0]; $t=time(); $line=~s//$t/ig; print $irc $line."\n"; if($debugOut eq "console") { print "DEBUG: [$dat]\n"; } elsif(defined($debugOut)) { print $irc ":".$nickType{main}." PRIVMSG $debugOut :$line\n"; } } sub rehash { &setConfig; print "Rehashed $$\n"; } sub setConfig { @spamnick=(); %nickType=(); %access=(); %c=(); %level=(); %spam=(); %config=(); @spamChans=(); @spamNicks=(); undef %onjoin; my $blah=$db->prepare("SELECT * FROM `nicks`"); $blah->execute; $i=0; while(my @l=$blah->fetchrow_array) { ($spamnick{$l[1]}->{type},$g,$spamnick{$l[1]}->{user},$spamnick{$l[1]}->{host},$spamnick{$l[1]}->{vhost},$spamnick{$l[1]}->{name},$spamnick{$l[1]}->{nickpass},$spamnick{$l[1]}->{isoper},$spamnick{$l[1]}->{chans})=(@l); $nickType{$l[0]}=$l[1]; if(lc($l[0]) eq "spam") { $spamNicks[scalar(@spamNicks)]=$l[1]; } } my $blah=$db->prepare("SELECT * FROM `access`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $access{$l[0]}->{pass}=$l[1]; $access{$l[0]}->{level}=$l[2]; } my $blah=$db->prepare("SELECT * FROM `colors`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $c{$l[0]}=$l[1]; } my $blah=$db->prepare("SELECT * FROM `levels`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $level{$l[0]}=$l[1]; } my $blah=$db->prepare("SELECT * FROM `spam` WHERE `type` = 'spam'"); $blah->execute; while(my @l=$blah->fetchrow_array) { $spam[scalar(@spam)]=$l[1]; } my $blah=$db->prepare("SELECT * FROM `spam` WHERE `type` = 'exclude'"); $blah->execute; while(my @l=$blah->fetchrow_array) { $exclude[scalar(@exclude)]=$l[1]; } my $blah=$db->prepare("SELECT * FROM `spamchans`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $spamChans[scalar(@spamChans)]=$l[0]; } my $blah=$db->prepare("SELECT * FROM `config`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $config{$l[0]}=$l[1]; } my $blah=$db->prepare("SELECT * FROM `resv`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $exclude[scalar(@exclude)]=$l[1]; } my $blah=$db->prepare("SELECT `chan` FROM `onjoin`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $onjoin{lc($l[0])}=1; } my $blah=$db->prepare("SELECT * FROM `commands`"); $blah->execute; while(my @l=$blah->fetchrow_array) { $command{lc($l[0])}=$l[1]; } } sub match { my @t=@_; $t[1] =~ s/\./\\\./g; $t[1] =~ s/\*/\.\*/g; $t[1] =~ s/\?/\./g; if ($t[0] =~ /^$t[1]$/i) { return 1; } return 0; } sub kill #nick,reason { &out(":$myName KILL $_[0] :$myName\!$myName\!$nickType{main}\!$nickType{main} ($_[1])"); } sub akill #nick,expiry,reason { #:hoeserv PRIVMSG operserv :akill add +2d *@pcp740502pcs.reston01.va.comcast.net botnet (pdi) $host=$nick{lc($_[0])}->{host}; &msg("main","OperServ","akill add $_[1] \*\@$host $_[2]"); } sub svsmode { &out(":$myName ENCAP * SVSMODE $_[0] $_[1]"); } sub approxTime { if($_[0]/604800>1) { $r=int($_[0]/604800);$f="week"; } elsif($_[0]/86400>1) { $r=int($_[0]/86400);$f="day"; } elsif($_[0]/3600>1) { $r=int($_[0]/3600);$f="hour"; } else{$r=int($_[0]/60);$f="minute";} if($r==1) { return "$r $f"; } return $r." ".$f."s"; } #sub checkNick #(nick) #{ # my $blah=$db->prepare("SELECT * FROM `bots` WHERE '$_[0]' REGEXP `nick` AND '$nick{$_[0]}->{user}' REGEXP `user` AND '$nick{$_[0]}->{host}' REGEXP `host` AND '$nick{$_[0]}->{vhost}' REGEXP `vhost` AND '$nick{$_[0]}->{name}' REGEXP `name` AND '$nick{$_[0]}->{version}' REGEXP `version`"); # if($blah->execute > 0) # { # &svsmode($_[0],"+".$config{botmode}); # &msg("monitor","pdi","BOT = $_[0] = $nick{$_[0]}->{version}"); # } # else # { # &svsmode($_[0],"-".$config{botmode}); # &msg("monitor","pdi","USER = $_[0] = $nick{$_[0]}->{version}"); # } #} sub randChars { randomize; my ($randChars); for(my $i=0;$i<$_[0];$i++) { my ($randChoice,$randChar) = (int(rand(3)),); if($randChoice==2) { $randChar = int(rand(10)); } elsif($randChoice) { $randChar = chr(int(rand(25))+65); } else { $randChar = chr(int(rand(25))+97); } $randChars.=$randChar; } return $randChars; } sub joinSpamIdler { for(my $i=0;$i>".$log); print LOG "[".localtime()."] $_[0]\n"; close(LOG); } sub getip { my $host = @_[0]; my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($host); foreach $i (@addrs) { my ($a, $b, $c, $d) = unpack('C4', $i); $ip = $a."\.".$b."\.".$c."\.".$d; } return $ip; } sub irc_send { my $data = $_[0]; $data .= "\n\n"; }