Commit Diff
Diff:
6fccd4dc47c424f8b9952d41579268e0bf858b33
b306e607a430e342026cab3e2fada43d2687a9f2
Commit:
b306e607a430e342026cab3e2fada43d2687a9f2
Tree:
aa1b39f90718f6c73b19287340e3e5a10ef12f17
Author:
jrmu <jrmu@lecturify.com>
Committer:
jrmu <jrmu@lecturify.com>
Date:
Sun Sep 13 10:57:53 2020 UTC
Message:
Improve error reporting
blob - c64fdd4af7842525b05506612d76210d49cd2034
blob + bd35192cfe3950f08929080d2f0d712cf393506b
--- botnow.pl
+++ botnow.pl
@@ -3,17 +3,15 @@
# Name of local network
my $localnet = "ircnow";
-# IP address to connect to bouncer
+# Internal IPv4 address and plaintext port
my $host = "127.0.0.1";
-
-# Port to connect to bouncer (plaintext, not SSL)
my $port = "1337";
# Bouncer hostname
-my $hostname = "example.ircnow.org";
+my $hostname = "guava.ircnow.org";
# External IPv4 address, plaintext and ssl port
-my $ip4 = "192.168.1.1";
+my $ip4 = "192.168.0.1";
my $plainport = "1337";
my $sslport = "31337";
@@ -62,7 +60,6 @@ die("You did not configure the bot!");
-
##### Do not edit code below #####
@@ -78,6 +75,7 @@ use OpenBSD::Unveil;
use File::Copy qw(copy);
use Digest::SHA qw(sha256_hex);
use Data::Dumper;
+use MIME::Base64;
use Time::HiRes qw ( setitimer ITIMER_VIRTUAL time );
my $sysname = "botnow"; # system username
@@ -107,6 +105,9 @@ unveil("/usr/bin/doas", "rx") or die "Unable to unveil
#dependencies for encrypt
unveil("/usr/bin/encrypt", "rx") or die "Unable to unveil $!";
+#dependencies for blowfish
+#unveil("./blowfish.o", "rx") or die "Unable to unveil $!";
+
unveil() or die "Unable to lock unveil $!";
#dns and inet for sockets, proc and exec for figlet
@@ -256,10 +257,6 @@ while(my @ready = $sel->can_read) {
} elsif ($response =~ /^:([[:graph:]]+) (\d\d\d) $nick.? :?(.*)\r?\n?\r$/i) {
my ($server, $code, $reply) = ($1, $2, $3);
parseserver($bot, $server, $code, $reply);
- } elsif ($response =~ /^:irc\.[a-zA-Z0-9]+\.ircnow.org (\d\d\d) $nick.? (.*)\r?\n?\r$/i) {
-print "parsewhois: $response\r\n";
-# my ($code, $reply) = ($1, $2);
-# parsewhois($bot, $code, $reply);
} else {
if ($verbose >= 2) { print "Unexpected: $response\r\n"; }
}
@@ -286,42 +283,109 @@ sub parseznc {
print $socket "JOIN ".$chan."\r\n";
}
}
+ } elsif ($type eq "464" && $target =~ /^$nick.?$/ && $reply eq "Invalid Password") {
+ print "ERROR: Wrong Username/Password: $bot->{name}\r\n";
} else {
print "Unexpected: type: $type, target: $target, reply: $reply\r\n";
}
}
sub parseserver {
my ($bot, $server, $code, $reply) = @_;
+ my ($sender, $val, $key);
my $socket = $bot->{sock};
- if ($code =~ /^00\d$/) { # Server Info
+ if ($code =~ /^001$/) { # Server Info
+ if ($verbose >= 3) { print "botnow successfully connected to $bot->{name}\r\n"; }
+ } elsif ($code =~ /^00\d$/) { # Server Info
# print "$server $reply\r\n";
} elsif ($code =~ /^2\d\d$/) { # Server Stats
- print "$server $reply\r\n";
- } elsif ($code eq "372") {
-# print "MOTD: $server $reply\r\n";
- } else {
+# print "$server $reply\r\n";
+ } elsif ($code == 307 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
+ ($sender, $key) = ($1, "registered");
+ $val = $2 eq ":is a registered nick" ? "True" : "$2";
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 311 && $reply =~ /^([-_\|`a-zA-Z0-9]+) ([^:]+)\s+([^:]+) \* :([^:]*)/) {
+ ($sender, $key, $val) = ($1, "vhost", "$1\!$2\@$3");
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 312 && $reply =~ /^([-_\|`a-zA-Z0-9]+) ([^:]+) :([^:]+)/) {
+ ($sender, $key, $val) = ($1, "server", $2);
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 313 && $reply =~ /^([-_\|`a-zA-Z0-9]+) :?(.*)/) {
+ ($sender, $key, $val) = ($1, "oper", ($2 eq "is an IRC operator" ? "True" : "$2"));
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 317 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (\d+) (\d+) :?(.*)/) {
+ ($sender, my $idle, my $epochtime) = ($1, $2, $3);
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, "idle", $idle);
+ setkeyval($hostmask, "epochtime", $epochtime);
+ if ($verbose >= 3) { print "idle: $idle, epochtime: $epochtime\r\n"; }
+ } elsif ($code == 318 && $reply =~ /^([-_\|`a-zA-Z0-9]+) :End of \/?WHOIS list/) {
+ if ($verbose >= 3) { print "End of WHOIS\r\n"; }
+ } elsif ($code == 319 && $reply =~ /^([-_\|`a-zA-Z0-9]+) :(.*)/) {
+ ($sender, $key, $val) = ($1, "chans", $2);
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 330 && $reply =~ /^([-_\|`a-zA-Z0-9]+) ([-_\|`a-zA-Z0-9]+) :?(.*)/) {
+ ($sender, $key, $val) = ($1, "loggedin", ($3 eq "is logged in as" ? "True" : $2));
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 338 && $reply =~ /^([-_\|`a-zA-Z0-9]+) ([0-9a-fA-F:.]+) :actually using host/) {
+ ($sender, $key, $val) = ($1, "ip", $2);
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ print "$key: $val\r\n";
+#Unexpected: efnet.port80.se 338 jrmu 206.253.167.44 :actually using host
+ } elsif ($code == 378 && $reply =~ /^([-_\|`a-zA-Z0-9]+) :is connecting from ([^ ]+)\s*([0-9a-fA-F:.]+)?/) {
+ ($sender, $key, $val) = ($1, "ip", $3);
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ } elsif ($code == 671 && $reply =~ /^([-_\|`a-zA-Z0-9]+) :is using a secure connection/) {
+ ($sender, $key, $val) = ($1, "ssl", "True");
+ my $hostmask = firstval("oldnick", $sender);
+ setkeyval($hostmask, $key, $val);
+ if ($verbose >= 3) { print "$key: $val\r\n"; }
+ print "$key: $val\r\n";
+ } elsif ($code =~ /^332$/) { # Topic
+# print "$reply\r\n";
+ } elsif ($code =~ /^333$/) { # Topic
+# print "$server $reply\r\n";
+#karatkievich.freenode.net 333 #ircnow jrmu!znc@206.253.167.44 1579277253
+ } elsif ($code =~ /^353$/) { # Names
# print "$server $code $reply\r\n";
+ } elsif ($code =~ /^366$/) { # End of names
+# print "$server $code $reply\r\n";
+ } elsif ($code =~ /^37\d$/) { # MOTD
+# print "$server $code $reply\r\n";
+ } elsif ($code =~ /^381$/) { # IRC Operator Verified
+# print "IRC Oper Verified\r\n";
+ } elsif ($code =~ /^401$/) { # IRC Operator Verified
+# print "IRC Oper Verified\r\n";
+ } elsif ($code =~ /^422$/) { # MOTD missing
+# print "$server $code $reply\r\n";
+ } elsif ($code =~ /^464$/) { # Invalid password for oper
+ foreach my $chan (@teamchans) {
+ sendmsg($bot, $chan, "ERROR: $nick oper password failed, unable to get IP addresses\r\n");
+ }
+ } elsif ($code =~ /^477$/) { # Can't join channel
+ foreach my $chan (@teamchans) {
+ sendmsg($bot, $chan, "ERROR: $nick on $server: $reply\r\n");
+ }
+ } else {
+ print "Unexpected: $server $code $reply\r\n";
}
-#:irc.efnet.nl 001 guava :Welcome to the EFNet Internet Relay Chat Network guava
-#:irc.efnet.nl 002 guava :Your host is irc.efnet.nl[2001:67c:12d8::6667/6667] , running version ircd-ratbox-3.0.10
-#:irc.efnet.nl 003 guava :This server was created Sun Oct 2 2016 at 04:55:27 CEST
-#amsterdam.nl.eu.undernet.org 353 = #ircnow :APhiO AnG3|KiSs ApolDapol Baby_ Bajoy Bamse_
-# BeBeLuShuL BeEF BotchoK COBRA002^ CiprIonut Cristi_ Cyphr Dome Eve G0di Licey Maim N2Jg
-#Runge Neuro No1HaTeSmE PaKs Perisai PuiMik PuiMik_ @Quo-fan Raf^y Rocking SharkZ Swim Th
-#orOfAngels True` Tuidor UnFa|thFuLL1 Venin Zorii` [NPS] [Virtual] b2 @compTECH @depeche
-#depecheMODE @dm don`semaca dwizzt fight getfar gry @gry-sock-und guava hunter_ @ircnow @
-#jrmu jrmu` @jrmubot kg kisser mabzicle madguys
-#guava!guava@2605:6400:20:b4:5c51:1a2d:1fba:1a9a JOIN #ircnow
-#amsterdam.nl.eu.undernet.org 353 = #ircnow :malic nix_ nonickname @orangeBNC_ play_ raff
-#y reborn reborn_ @shman swimmer tankup trip usr vindiKHATE winmx zACk |\|0
-#amsterdam.nl.eu.undernet.org 353 = #ircnow :APhiO AnG3|KiSs ApolDapol Baby_ Bajoy Bamse_
-# BeBeLuShuL BeEF BotchoK COBRA002^ CiprIonut Cristi_ Cyphr Dome Eve G0di Licey Maim N2Jg
-#Runge Neuro No1HaTeSmE PaKs Perisai PuiMik PuiMik_ @Quo-fan Raf^y Rocking SharkZ Swim Th
-#orOfAngels True` Tuidor UnFa|thFuLL1 Venin Zorii` [NPS] [Virtual] b2 @compTECH @depeche
-#depecheMODE @dm don`semaca dwizzt fight getfar gry @gry-sock-und guava hunter_ @ircnow @
-#jrmu jrmu` @jrmubot kg kisser mabzicle madguys
-
}
+
sub parsemode {
my ($bot, $hostmask, $target, $reply) = @_;
if ($verbose >= 3) { print "$hostmask MODE $target $reply\r\n"; }
@@ -359,8 +423,12 @@ sub sendmsg {
}
sub mailverify {
- my( $username, $email, $password, $service )=@_;
- my $hash = sha256_hex("$username");
+ my( $username, $email, $password, $service, $version )=@_;
+ my $passhash = sha256_hex("$username");
+ if ($version =~ /mIRC/) {
+ $version = "mIRC";
+ }
+my $versionhash = encode_base64($version);
my $msg = <<"EOF";
From: $mailname \<$mailfrom\>
@@ -370,14 +438,18 @@ MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
-You created the account $username with temporary password $password. Your
-server is $hostname, port is $sslport for SSL (secure connection), $plainport
-for plaintext.
+You created a bouncer!
-Please verify your email address:
+Username: $username
+Password: $password
+Server: $hostname
+Port: $sslport for SSL (secure connection)
+Port: $plainport for plaintext
-https://www.$hostname/register.php?id=$hash
+*IMPORTANT*: Verify your email address:
+https://www.$hostname/register.php?id=$hash&version=$versionhash
+
You *MUST* click on the link or your account will be deleted.
IRCNow
@@ -518,7 +590,8 @@ sub nickfromhost {
return;
}
-sub pmstaff {
+# Send $msg to every nick in $staff on the team channel
+sub sendteam {
my( $sender, $msg )=@_;
my @nicks = split /,/m, $staff;
my $bot;
@@ -570,57 +643,63 @@ sub parsemsg {
To request a free bouncer, type !bnc . To reset the password, type !resetpass <nick> <email>. To change email, type !set email <email>.
EOF
sendmsg($bot, $sender, $msg);
- pmstaff($bot->{name}, "Help *$sender* on ".$bot->{name});
+ sendteam($sender, "Help *$sender* on network ".$bot->{name}." $chans");
};
my $captcha = sub {
my $num = int(rand(999));
setkeyval($hostmask, "num", $num);
- my @strings = split('\n', `figlet $num`);
- foreach my $s (@strings) {
- sendmsg($bot, $sender, $s);
- }
- pmstaff($sender, "$sender\'s captcha is $num");
+ my $figlet = `figlet $num`;
+ sendmsg($bot, $sender, $figlet);
+ sendteam($sender, "$sender\'s captcha is $num");
};
-
- if ($hostmask eq '*status!znc@znc.in') {
- return;
+ if ($hostmask eq '*status!znc@znc.in' && $target =~ /^$nick.?$/) {
+ if ($reply eq "You are currently disconnected from IRC. Use 'connect' to reconnect.") {
+ if ($verbose >= 3) { print "not connected to $bot->{name}\n"; }
+ return;
+ } elsif ($reply =~ /Unable to load module (.*): Module (.*) already loaded./) {
+ if ($verbose >= 3) { print "Module $1 already loaded\n"; }
+ return;
+ } else {
+ print "Unexpected: $hostmask $target $reply\r\n";
+ }
} elsif($hostmask eq '*controlpanel!znc@znc.in') {
if ($reply =~ /^Error: User \[cloneuser\] does not exist/) {
- print "Cloneuser created!\r\n";
createclone($bot);
+ sendteam($sender, "Cloneuser created!");
} elsif($reply =~ /^Nick = ([a-zA-Z][-_a-zA-Z0-9]+)$/) {
# only one requestnick
my $requestnick = $1;
my $hostmask = firstval("requestnick", $requestnick);
- if (!defined($hostmask)) {
- return;
- }
+ if (!defined($hostmask)) { return; }
delkey($hostmask, "requestnick");
sendmsg($bot, nickfromhost($hostmask), "Username already taken. New username:");
} elsif($reply =~ /^Error: User \[(.*)\] does not exist/) {
# delete requestnick after granted
my $newnick = $1;
my $hostmask = firstval("requestnick", $newnick);
- if (!defined($hostmask)) {
- return;
- }
+ if (!defined($hostmask)) { return; }
setkeyval($hostmask, "newnick", $newnick);
delkey($hostmask, "requestnick");
sendmsg($bot, nickfromhost($hostmask), "Email:");
+ } elsif ($reply =~ /^User (.*) added!$/) {
+ print "User $1 created!\r\n";
+ } elsif ($reply =~ /^Password has been changed!$/) {
+ print "Password changed\r\n";
+ } elsif ($reply =~ /^Queued network (.*) of user (.*) for a reconnect.$/) {
+ print "$2 now connecting to $1...\r\n";
} elsif ($reply =~ /^Admin = false/) {
- pmstaff("", "Error: $nick is not admin");
+ sendteam("", "Error: $nick is not admin");
die;
} elsif ($reply =~ /^Admin = true/) {
- sendmsg($bot, "*status", "LoadMod --type=user chansaver");
+ if ($verbose >= 3) { print "$nick is ZNC admin\n"; }
} elsif ($reply =~ /(.*) = (.*)/) {
-# my ($key, $val) = ($1, $2);
-# print "$key = $val\r\n";
+ my ($key, $val) = ($1, $2);
+ if ($verbose >= 3) { print "$key = $val\r\n"; }
} else {
- print "$hostmask: $reply\r\n";
+ print "Unexpected: $hostmask $target $reply\r\n";
}
} elsif ($reply =~ /^!(help|request)/i) {
if ($chans =~ $target) {
- print "target: $target\r\n";
sendmsg($bot, $target, "$sender: Please check private message");
}
$help->();
@@ -632,11 +711,10 @@ EOF
setkeyval($hostmask, "oldnick", $sender);
whois($socket, $sender);
if ($chans =~ $target) {
- print "target: $target\r\n";
sendmsg($bot, $target, "$sender: Please check private message");
}
sendmsg($bot, $sender, $terms);
- pmstaff($bot->{name}, "Help *$sender* on ".$bot->{name});
+ sendteam($bot->{name}, "Help *$sender* on ".$bot->{name});
}
} elsif ($target !~ /^$nick.?/) {
# print "$hostmask: $target $reply\r\n";
@@ -678,13 +756,14 @@ EOF
return;
}
my $newnick = getkeyval($hostmask, "newnick");
+ my $version = getkeyval($hostmask, "VERSION");
setkeyval($hostmask, "email", $reply);
my $password = newpass();
my $encrypted = `encrypt $password`;
chomp($encrypted);
setkeyval($hostmask, "password", $encrypted);
my $bindhost = nextdns($newnick);
- mailverify($newnick, $reply, $password, "bouncer");
+ mailverify($newnick, $reply, $password, "bouncer", $version);
my $msg = <<"EOF";
Check your email.
EOF
@@ -696,80 +775,72 @@ EOF
} else {
sendmsg($bot, $sender, "Invalid email. New email:");
}
- }
-
-# Hidden functionality
- if ($reply =~ /^!deluser (.*)$/i) {
+ } elsif ($reply =~ /^!deluser (.*)$/i) { # Hidden functionality
my $user = $1;
if ($staff !~ /$sender/) {
return;
}
print $socket "PRIVMSG *controlpanel :deluser $user\r\n";
- }
- if ($reply =~ /^!rehash$/i) {
+ } elsif ($reply =~ /^!rehash$/i) {
if ($staff !~ /$sender/) {
return;
}
print $socket "PRIVMSG *controlpanel :deluser cloneuser\r\n";
sleep 5;
print $socket "PRIVMSG *controlpanel :get Nick cloneuser\r\n";
- }
- if ($reply =~ /^!dns\s+([-.0-9a-z]+)\s+([:0-9a-f]+)/i) {
+ } elsif ($reply =~ /^!identify\s*(.*)?\s+(.*)$/i) {
+ my $hash = getkeyval($hostmask, "password");
+ #print "result = ".`./blowfish.o $2 '$hash'`;
+# if(system("./blowfish.o $2 '$hash' > /dev/null")) {
+# print "login failed\r\n";
+# } else {
+# print "logged in\r\n";
+# }
+ } elsif ($reply =~ /^!dns\s+([-.0-9a-z]+)\s+([:0-9a-f]+)/i) {
my ($fqdn, $ip6) = ($1, $2);
if ($staff !~ /$sender/) {
return;
}
dns($fqdn, $ip6);
- }
- if ($reply =~ /^!nextdns ([-0-9a-zA-Z]+)/i) {
+ } elsif ($reply =~ /^!nextdns ([-0-9a-zA-Z]+)/i) {
my $username = $1;
if ($staff !~ /$sender/) {
return;
}
nextdns($username);
sendmsg($bot, $sender, "nextdns called");
- }
- if ($reply =~ /^!getkeyval ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+)/) {
+ } elsif ($reply =~ /^!getkeyval ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+)/) {
if ($staff !~ /$sender/) {
return;
}
sendmsg($bot, $sender, getkeyval($1, $2));
- }
- if ($reply =~ /^!setkeyval ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+)/) {
+ } elsif ($reply =~ /^!setkeyval ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+)/) {
if ($staff !~ /$sender/) {
return;
}
sendmsg($bot, $sender, setkeyval($1, $2, $3));
- }
- if ($reply =~ /^!delkey ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+)/) {
+ } elsif ($reply =~ /^!delkey ([-_0-9a-zA-Z]+) ([-_0-9a-zA-Z]+)/) {
if ($staff !~ /$sender/) {
return;
}
sendmsg($bot, $sender, delkey($1, $2));
- }
- if ($reply =~ /^!saverecords/) {
+ } elsif ($reply =~ /^!saverecords/) {
if ($staff !~ /$sender/) {
return;
}
if (saverecords()) {
sendmsg($bot, $sender, "Records saved.");
}
+ } else {
+ print "exception $hostmask targe: $target reply: $reply\r\n";
}
}
sub parsenotice {
my ($bot, $hostmask, $target, $reply) = @_;
my $socket = $bot->{sock};
- my $sender;
+ my $sender = nickfromhost($hostmask);
- # get the sender's nick from hostmask
- if ($hostmask =~ /([^!]+)!/i) {
- $sender = $1;
- }
- # don't verify ident
- #if ($hostmask =~ /^([^!]+)!~?([^@]+)@(.+)$/i) {
- # $hostmask = "$1\!$2\@$3";
- #}
# CTCP replies
if ($hostmask ne '*status!znc@znc.in') {
if ($reply =~ /^(PING|VERSION|TIME|USERINFO) (.*)$/i) {
@@ -780,29 +851,31 @@ sub parsenotice {
}
}
-sub parsewhois {
- my ($bot, $code, $reply) = @_;
- my ($sender, $val, $key);
- if ($code == 307 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "register");
- } elsif ($code == 311 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "vhost");
- } elsif ($code == 312 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "server");
- } elsif ($code == 313 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "oper");
- } elsif ($code == 319 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "chans");
- } elsif ($code == 330 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "logged");
- } elsif ($code == 378 && $reply =~ /^([-_\|`a-zA-Z0-9]+) (.*)/) {
- ($sender, $val, $key) = ($1, $2, "ip");
- } else {
- return;
- }
- my $hostmask = firstval("oldnick", $sender);
- setkeyval($hostmask, $key, $val);
-}
+#sub resetznc {
+#
+#AnonIPLimit 10000
+#AuthOnlyViaModule false
+#ConnectDelay 0
+#HideVersion true
+#LoadModule
+#ServerThrottle
+#1337 209.141.38.137
+#31337 209.141.38.137
+#1337 2605:6400:20:5cc::
+#31337 2605:6400:20:5cc::
+#1337 127.0.0.1
+#1338 127.0.0.1
+#}
+#
+#alias Provides bouncer-side command alias support.
+#autoreply Reply to queries when you are away
+#block_motd Block the MOTD from IRC so it's not sent to your client(s).
+#bouncedcc Bounces DCC transfers through ZNC instead of sending them directly to the user.
+#clientnotify Notifies you when another IRC client logs into or out of your account. Configurable.
+#ctcpflood Don't forward CTCP floods to clients
+#dcc This module allows you to transfer files to and from ZNC
+#perform Keeps a list of commands to be executed when ZNC connects to IRC.
+#webadmin Web based administration module.
sub createclone {
my ($bot) = @_;
@@ -810,18 +883,23 @@ sub createclone {
my $password = newpass();
my $msg = <<"EOF";
adduser cloneuser $password
+set Nick cloneuser cloneuser
+set Altnick cloneuser cloneuser_
+set Ident cloneuser cloneuser
+set RealName cloneuser cloneuser
set MaxNetworks cloneuser 1000
set ChanBufferSize cloneuser 1000
set MaxQueryBuffers cloneuser 1000
set QueryBufferSize cloneuser 1000
+set NoTrafficTimeout cloneuser 600
set QuitMsg cloneuser IRCNow and Forever!
set RealName cloneuser cloneuser
set DenySetBindHost cloneuser true
+set Timezone cloneuser US/Pacific
LoadModule cloneuser controlpanel
+LoadModule cloneuser chansaver
EOF
-#set BindHost cloneuser $bindhost
-#set DCCBindHost $newnick $bindhost
-#set Language $newnick $lang
+#LoadModule cloneuser buffextras
sendmsg($bot, "*controlpanel", $msg);
foreach my $n (@networks) {
my $net = $n->{name};
@@ -833,20 +911,12 @@ addnetwork cloneuser $net
addserver cloneuser $net $server $port
disconnect cloneuser $net
EOF
-# if (defined($net) && $name eq $net->{name}) {
-# print "identical: $name\r\n";
-# push(@{$net->{servers}}, $server);
-# } else {
-# $net = {"name" => $name, "servers" => [$server], "port" => $port, "trustcerts" => $trustcerts };
-# }
-# push(@networks, $net);
if ($trustcerts) {
-#print "net: $net, server: $server, port: $port, trustcerts: $trustcerts\r\n";
$msg .= "SetNetwork TrustAllCerts cloneuser $net True\r\n";
}
-foreach my $chan (@chans) {
- $msg .= "addchan cloneuser $net $chan\r\n";
-}
+ foreach my $chan (@chans) {
+ $msg .= "addchan cloneuser $net $chan\r\n";
+ }
sendmsg($bot, "*controlpanel", $msg);
}
}
@@ -870,17 +940,10 @@ set QuitMsg $newnick IRCNow and Forever!
set BindHost $newnick $bindhost
set DCCBindHost $newnick $bindhost
set DenySetBindHost $newnick true
+reconnect $newnick $netname
EOF
-#set Language $newnick $lang
+#set Language $newnick en-US
sendmsg($bot, "*controlpanel", $msg);
- foreach my $p (@networks) {
- my $netname = $bot->{name};
- my $pnetname = $p->{name};
- my $pserver = $p->{server};
- my $pnetport = $p->{port};
- sendmsg($bot, "*controlpanel", "setnetwork Altnick $newnick $pnetname ${newnick}_");
- }
- sendmsg($bot, "*controlpanel", "reconnect $newnick $netname");
}
# returns true upon success, false upon failure
@@ -891,7 +954,7 @@ sub dns {
if ($fqdn =~ /^([a-zA-Z][-a-zA-Z0-9]+)\.$hostname$/) {
$username = $1;
} else {
- pmstaff("", "Error: not authoritative");
+ sendteam("", "Error: not authoritative");
return;
}
my ($line, $lines);
@@ -913,14 +976,14 @@ sub dns {
copy "$filename.bak", $filename;
my $stdout = `curl -d \"key=$key&hash=$hash&action=rdns&ip=$ip6&rdns=$fqdn\" https://manage.buyvm.net/api/client/command.php`;
if ($stdout !~ /success/) {
- pmstaff("", "Error: failed to set rDNS");
+ sendteam("", "Error: failed to set rDNS");
return;
}
if (system("doas -u _nsd nsd-control reload")) {
- pmstaff("", "Error: failed to reload nsd");
+ sendteam("", "Error: failed to reload nsd");
return;
}
- pmstaff("", "$fqdn set to $ip6");
+ sendteam("", "$fqdn set to $ip6");
return 1;
}
blob - ac1126335fb29aa3db9cb17052585b867e6fe443
blob + 6e7549f6bf1a6c8329b3be2b0041fbff9ce18e87
--- networks
+++ networks
@@ -9,8 +9,8 @@
# Please keep network names lowercase
# Please edit 0000net and ircnow to connect to the local server's IPv6 address
#
-0000net 2605:6400:20:b4:: 6667
-ircnow 2605:6400:20:b4:: 6667
+0000net 2001:db8:: 6667
+ircnow 2001:db8:: 6667
2600net irc.2600.net 6667
42net sol.42net.org 6667
#abandoned-irc irc.abandoned-irc.net ~6697
blob - 8afb70116397f39af18eb826dc65faf59e92043e
blob + dc232bf7b72a20ec78701e3c804b6ee7b42de872
--- register.php
+++ register.php
@@ -1,7 +1,7 @@
<?php
$email = "support@ircnow.org";
-$webpanel = "https://example.ircnow.org";
+$webpanel = "https://guava.ircnow.org";
@@ -39,6 +39,7 @@ $fpr .= "passphrase: $passphrase\n";
$fpr .= "remote addr: ".$_SERVER['REMOTE_ADDR']."\n";
$fpr .= "http_x_forwarded: ".$_SERVER['HTTP_X_FORWARDED_FOR']."\n";
$fpr .= "time: ".date("Y-m-d H:i:s")."\n";
+$client = base64_decode($_REQUEST["version"]);
foreach (getallheaders() as $name => $value) {
$fpr .= "$name: $value\n";
}
@@ -60,13 +61,12 @@ body {
</style>
</head>
<body>
-<p>Please email <a href="mailto:$email">$email</a> with the following passphrase:</p>
+<p>Please email <a href="mailto:<?php echo $email?>"><?php echo $email?></a> with the following passphrase:</p>
<p>IRCNow Verify <?php echo $passphrase ?></p>
-<p><a href="https://wiki.ircnow.org/index.php?n=Bouncer.Bouncer">Click here for connection instructions.</a></p>
+<p><a href="https://wiki.ircnow.org/index.php?n=Bouncer.<?php echo ucwords($client)?>">Click here for connection instructions.</a></p>
-<p>To change your password, login to <a href="$webpanel">$webpanel</a>, fill in the password field, then click on the "Save and Return" button.</p>
-
+<p>To change your password, login to <a href="<?php echo $webpanel?>"><?php echo $webpanel?></a>, fill in the password field, then click on the "Save and Return" button.</p>
</body>
</html>