#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;
####################################
# author: perlp0pper #
# copyright license: #
# do not copy without my #
# permission. #
####################################
# signs: > \
print q{
####################################
# made by skil0wone #
# p0pbot v4.0.1 #
####################################
};
# edit this lines
my $server = "";
my $port = 6667;
my $user = "";
my $ident = "";
my $nick = "";
my $name = "made by skil0wone";
my $version = "p0pbot v4.0.1 by skil0wone";
my $channel = "#";
my $master = "";
my $filename = "CookieCar";
my $password = "";
my $chankey = "";
my $token = "?";
my $log = 1; # change this to 0 to stop loging
# stop edit
# do not edit these lines
my $irc = new IO::Socket::INET (PeerAddr=>$server, PeerPort=>$port, Proto=>'tcp');
print $irc "NICK $nick\n";
print $irc "USER $user $user $user $user :$ident\n";
my $in;
my $val = 0;
while(defined($in=<$irc>)){
$in =~ s/^\s+//;
$in=~ s/\s+$//;
if($log==1){
open LOG, ">>$filename.log";
print LOG $in."\n";
}
my @cst = split('!', $in);
my $normalstr = $cst[0];
my $commander = reverse($normalstr);
chop($commander);
$commander = reverse($commander);
my @chst = split(' ', $in);
my $chan = $chst[2];
if($in=~/PING(.*)/){print $irc "PONG $1\n";}
print "$in\n";
if($in=~/This nickname is registered and protected/){print $irc "PRIVMSG NICKSERV :IDENTIFY Triplex96\n";}
if($in=~/Password accepted/){print $irc "JOIN $channel $chankey\n";}
print $irc "JOIN $channel $chankey\n";
#next unless $in=~ /^:$master\b/;
if($in=~/\Q$token\Eversion/){
print $irc "NOTICE $commander :$version\n";
}
if($in=~/\Q$token\Ekick/ && $val == 1){
print $irc "kick $chan $' :FOLOW THE RULES!!!\n";
}
if($in=~/\Q$token\Eop/ && $val == 1){
print $irc "MODE $chan +o $'\n";
}
if($in=~/\Q$token\Edeop/ && $val == 1){
print $irc "MODE $chan -o $'\n";
}
if($in=~/\Q$token\Ehelp/){
print $irc "NOTICE $commander :".$token."greet - greet someone\n";
print $irc "NOTICE $commander :".$token."op - give someone op\n";
print $irc "NOTICE $commander :".$token."deop - take op\n";
print $irc "NOTICE $commander :".$token."version - displays bot version\n";
print $irc "NOTICE $commander :".$token."kick - kicks someone\n";
print $irc "NOTICE $commander :".$token."help - shows help file\n";
print $irc "NOTICE $commander :".$token."join - bot joins channel\n";
print $irc "NOTICE $commander :".$token."leave - bot leaves\n";
print $irc "NOTICE $commander :".$token."kill - kills bot\n";
print $irc "NOTICE $commander :".$token."ban - bans someone\n";
print $irc "NOTICE $commander :".$token."rehash - updates bot and restarts bot\n";
print $irc "NOTICE $commander :".$token."voice - voice someone\n";
print $irc "NOTICE $commander :".$token."devoice - devoice someone\n";
print $irc "NOTICE $commander :".$token."quit - bot quits irc server\n";
print $irc "NOTICE $commander :".$token."login - login to bot\n";
print $irc "NOTICE $commander :".$token."check - check if host is up\n";
print $irc "NOTICE $commander :".$token."find - find user\n";
print $irc "NOTICE $commander :".$token."setop - set current operation\n";
print $irc "NOTICE $commander :".$token."target - display target list\n";
print $irc "NOTICE $commander :".$token."addtarget - find user\n";
}
if($in=~/\Q$token\Ejoin/ && $val == 1){
print $irc "Join $' $chankey\n";
}
if($in=~/\Q$token\Eleave/ && $val == 1 && $in=~ /^:$master\b/){
print $irc "Part $chan\n";
}
if($in=~/\Q$token\Eban/ && $val == 1){
print $irc "kick $chan $':folow the rules\n";
print $irc "MODE $chan +b $'\n";
}
if($in=~/\Q$token\Ekill/ && $val == 1 && $in=~ /^:$master\b/){
print $irc "NOTICE $commander :deleting bot...\n";
print $irc "QUIT\n";
unlink "$filename.exe";
}
if($in=~/\Q$token\Erehash/ && $val == 1 && $in=~ /^:$master\b/){
print $irc "NOTICE $commander :rehashing $version...\n";
print $irc "QUIT\n";
system("perl p0pbot.pl");
}
if($in=~/\Q$token\Evoice/ && $val == 1){
print $irc "MODE $chan +v $'\n";
}
if($in=~/\Q$token\Edevoice/ && $val == 1){
print $irc "MODE $chan -v $'\n";
}
if($in=~/\Q$token\Equit/ && $val == 1 && $in=~ /^:$master\b/){
print $irc "QUIT\n";
}
if($in=~/\Q$token\Eaop/ && $val == 1){
print $irc "NOTICE $commander :!aop {add/del}\n";
}
if($in=~/\Q$token\Eaop add/ && $val == 1){
my $addop = "$'";
open AOP, ">>AOPlist.txt";
print AOP $addop,"\n";
close(AOP);
print $irc "NOTICE $commander :added to aop list!\n";
}
if($in=~/\Q$token\Egreet/){
my $greetp = "$'";
print $irc "NOTICE $commander :$greetp\n";
print $irc "NOTICE $greetp :You have the greets of $commander\n";
}
if($in=~/\Q$token\Echeck/){
my $h = "$'";
my $p = "80";
$h = reverse($h);
chop($h);
$h = reverse($h);
print $irc "PRIVMSG $chan :checking $h\n";
print $irc "NOTICE $commander :checking $h\n";
my $check = new IO::Socket::INET (PeerAddr => $h, PeerPort => 80, Proto => 'tcp', Timeout=>3);
if($check){
print $irc "PRIVMSG $chan :[+] UP($h)\n";
print $irc "NOTICE $commander :[+] UP($h)\n";
}
else {print $irc "PRIVMSG $chan :[-] DOWN($h)\n";
print $irc "NOTICE $commander :[-] DOWN($h)\n";
}
}
if($in=~/\Q$token\Elogin/){
my $pa = "$'";
if($pa=~/$password/){
$val = 1;
print $irc "NOTICE $commander :p0pbot ready!!!\n";
}
else{
$val = 0;
}
}
if($in=~/\Q$token\Efind/){
my $uss = "$'";
print $irc "PRIVMSG $uss :$commander is looking for you on $chan\n";
if($in=~/No such nick/){
print $irc "NOTICE $commander :$uss is not online now!\n";
} else {
my $uss = "$'";
print $irc "WHOIS $uss\n";
$in =~ s/^\s+//;
$in=~ s/\s+$//;
my @cst = split('!', $in);
my $normalstr = $cst[0];
my $commander = reverse($normalstr);
chop($commander);
$commander = reverse($commander);
my @chst = split(' ', $in);
my $usrchan = $chst[4];
if($usrchan=~/@/ or $usrchan=~/~/ or $usrchan=~'#'){
print $irc "NOTICE $commander :Channels where $uss is on: $usrchan\n";
}
print $irc "NOTICE $commander :$uss is noticed you are looking for him\n";
}
}
if($in=~/\Q$token\Esetop/ && $val == 1){
my $setopd = "$'";
open FILE, ">op.t";
print FILE $setopd."\n";
close(FILE);
print $irc "NOTICE $commander :Op $setopd set!\n";
}
if($in=~/\Q$token\Etarget/){
open FILE, "<target.t";
my @targets = <FILE>;
close(FILE);
if(scalar(@targets)==0){
print $irc "NOTICE $commander :No targets set!\n";
print $irc "NOTICE $chan :No targets set!\n";
}
my $it = 1;
open FILE, "<op.t";
my $op = <FILE>;
close(FILE);
print $irc "NOTICE $commander :---- $op Targets ----\n";
print $irc "NOTICE $chan :---- $op Targets ----\n";
foreach my $target (@targets){
print $irc "NOTICE $commander :Target $it: $target\n";
print $irc "NOTICE $chan :Target $it: $target\n";
$it++;
}
print $irc "NOTICE $commander :---------------------\n";
print $irc "NOTICE $chan :---------------------\n";
}
if($in=~/\Q$token\Eaddtarget/ && $val == 1){
my $settarget = "$'";
open FILE, ">>target.t";
print FILE $settarget."\n";
close(FILE);
print $irc "NOTICE $commander :Target $settarget added to list!\n";
}
}