Commit Diff
Diff:
1424bcef233cd5c17a6beff4e0be25e857867748
0fa111a05bf2bf241c8bf054b6dfa1bb4796706d
Commit:
0fa111a05bf2bf241c8bf054b6dfa1bb4796706d
Tree:
c47d768b507006f4990ca22da70f58fe429142d5
Author:
jrmu <jrmu@ircnow.org>
Committer:
jrmu <jrmu@ircnow.org>
Date:
Tue Nov 17 10:21:38 2020 UTC
Message:
Fixed minor bugs
blob - 03c1fdfae3c125ad1b691907d57e6f20401faeab
blob + a1d7ad5308eba4bde2a02acdbb65f421d96b89b9
--- BNC.pm
+++ BNC.pm
@@ -41,6 +41,7 @@ use constant {
ALL => 3,
};
+`doas chmod g+r /home/znc/home/znc/.znc/configs/znc.conf`;
my @zncconf = main::readarray($zncconfpath);
$znctree = parseml($znctree, @zncconf);
main::cbind("pub", "-", "bnc", \&mbnc);
@@ -287,7 +288,7 @@ sub mcontrolpanel {
my ($key, $val) = ($1, $2);
main::debug(ALL, "ZNC: $key => $val");
} else {
- main::debug(ERRORS, "Unexpected: $hostmask $text");
+ main::debug(ERRORS, "Unexpected 290 BNC.pm: $hostmask $text");
}
}
}
blob - 6cfdf34c056fb604d0fd5e688277553ac3511ac3 (mode 644)
blob + /dev/null
--- Login.pm
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/perl
-
-package Login;
-
-use strict;
-use warnings;
-use OpenBSD::Pledge;
-use OpenBSD::Unveil;
-
-sub init {
-}
-#dependencies for blowfish
-#unveil("./blowfish.o", "rx") or die "Unable to unveil $!";
-# } 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";
-# }
-
-1; # MUST BE LAST STATEMENT IN FILE
blob - e35442332a028972b8374935d9c9db3fa4b4d766
blob + 8a8f50cad7021519d21d3c7ac66375ec2a472c17
--- botnow.conf.example
+++ botnow.conf.example
@@ -45,6 +45,9 @@ die = You did not configure botnow.conf!
# Do not edit unless needed #
#####################################
+#Join chans on localnet?
+#localchans = False
+
#Number of words in password
#passlength = 3
blob - 0d585dc92b0bcf6967680838a5a6e708acb9ff94
blob + f76be7d7cadaf0730a6f7babedeeecaa5b0ea498
--- botnow.pl
+++ botnow.pl
@@ -42,6 +42,9 @@ $conf{pass} = $conf{pass} or die "ERROR: botnow.conf:
# Comma-separated list of channels for requesting bouncers
$conf{chans} = $conf{chans} || "#ircnow";
+#Join chans on localnet?
+$conf{localchans} = defined($conf{localchans}) && ($conf{localchans} =~ /^true/i);
+
# Number of words in password
$conf{passlength} = $conf{passlength} || 3;
@@ -114,6 +117,7 @@ my $verbose = $conf{verbose};
my $ipv6path = $conf{ipv6path};
my $netpath = $conf{netpath};
my $expires = $conf{expires};
+my $localchans = $conf{localchans};
unveil("./", "r") or die "Unable to unveil $!";
unveil("$confpath", "r") or die "Unable to unveil $!";
@@ -233,9 +237,6 @@ while(my @ready = $sel->can_read) {
} elsif ($type eq "NOTICE" && $target =~ /^$botnick.?$/ && $text eq "*** You need to send your password. Configure your client to send a server password.") {
} elsif ($type eq "464" && $target =~ /^$botnick.?$/ && $text eq "Password required") {
putserv($bot, "PASS $botnick/$bot->{name}:$pass");
- foreach my $chan (@chans) {
- putserv($bot, "JOIN $chan");
- }
if ($bot->{name} =~ /^$localnet$/i) {
putserv($bot, "OPER $botnick $pass");
putserv($bot, "PRIVMSG *status :LoadMod --type=user controlpanel");
@@ -245,22 +246,31 @@ while(my @ready = $sel->can_read) {
putserv($bot, "JOIN $chan");
}
}
+ if ($bot->{name} !~ /^$localnet$/i or $localchans) {
+ foreach my $chan (@chans) {
+ putserv($bot, "JOIN $chan");
+ }
+ }
} elsif ($type eq "464" && $target =~ /^$botnick.?$/ && $text eq "Invalid Password") {
die "ERROR: Wrong Username/Password: $bot->{name}";
} else {
- debug(ERRORS, "Unexpected: type: $type, target: $target, text: $text");
+ debug(ERRORS, "Unexpected bncnow.pl 257: type: $type, target: $target, text: $text");
}
} elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) PRIVMSG ([^ ]+) :(.*)\r\n$/i) {
my ($hostmask, $nick, $host, $target, $text) = ($1, $2, $3, $4, $5);
if ($hostmask eq '*status!znc@znc.in' && $target =~ /^$botnick.?$/) {
if ($text =~ /Network ([[:ascii:]]+) doesn't exist./) {
- debug(ERRORS, "$1 does not exist.");
+ debug(ERRORS, "nonexistent: $1");
} elsif ($text eq "You are currently disconnected from IRC. Use 'connect' to reconnect.") {
- debug(ERRORS, "Not connected to $bot->{name}");
+ debug(ERRORS, "disconnected: $bot->{name}");
} elsif ($text =~ /Unable to load module (.*): Module (.*) already loaded./) {
debug(ALL, "Module $1 already loaded\n");
+ } elsif ($text =~ /^Disconnected from IRC.*$/) {
+ debug(ERRORS, "$bot->{name}: $text");
+ } elsif ($text =~ /^|/) {
+ debug(ERRORS, "$bot->{name}: $text");
} else {
- debug(ERRORS, "Unexpected: $hostmask $target");
+ debug(ERRORS, "Unexpected bncnow.pl 273: $response");
}
} elsif ($text =~ /!([[:graph:]]+)\s*(.*)/) {
my ($cmd, $text) = ($1, $2);
@@ -291,43 +301,51 @@ while(my @ready = $sel->can_read) {
foreach my $c (@{$call->{msgm}}) {
my $proc = $c->{proc};
$proc->($bot, $nick, $host, $hand, $text);
- print "$proc->($bot, $nick, $host, $hand, $text)\n";
}
}
}
debug(ALL, "$hostmask $target $text");
- } elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) NOTICE ([^ ]+) :(.*)\r\n$/i) {
- my ($hostmask, $nick, $host, $target, $text) = ($1, $2, $3, $4, $5);
- my $hand = $staff; # TODO fix later
- foreach my $c (@{$call->{notc}}) {
- # if ($text eq $c->{mask}) { # TODO fix later
- my $proc = $c->{proc};
- $proc->($bot, $nick, $host, $hand, $text, $target);
- # }
+ } elsif($response =~ /^:([^ ]+) NOTICE ([^ ]+) :(.*)\r\n$/i) {
+ my ($hostmask, $target, $text) = ($1, $2, $3);
+ if ($hostmask =~ /([^!]+)!([^@]+@[^@ ]+)/) {
+ my ($nick, $host) = ($1, $2);
+ my $hand = $staff; # TODO fix later
+ foreach my $c (@{$call->{notc}}) {
+ # if ($text eq $c->{mask}) { # TODO fix later
+ my $proc = $c->{proc};
+ $proc->($bot, $nick, $host, $hand, $text, $target);
+ # }
+ }
+ # TODO use CTCR
+ # CTCP replies
+ if ($hostmask ne '*status!znc@znc.in') {
+ if ($text =~ /^(PING|VERSION|TIME|USERINFO) (.*)$/i) {
+ my ($key, $val) = ($1, $2);
+ my $id = SQLite::id("irc", "nick", $nick, $expires);
+ SQLite::set("irc", "id", $id, "ctcp".lc($key), $val);
+ SQLite::set("irc", "id", $id, "localtime", time());
+ }
+ }
}
- # TODO use CTCR
- # CTCP replies
- if ($hostmask ne '*status!znc@znc.in') {
- if ($text =~ /^(PING|VERSION|TIME|USERINFO) (.*)$/i) {
- my ($key, $val) = ($1, $2);
- my $id = SQLite::id("irc", "nick", $nick, $expires);
- SQLite::set("irc", "id", $id, "ctcp".lc($key), $val);
- SQLite::set("irc", "id", $id, "localtime", time());
+ debug(ALL, "$hostmask NOTICE $target $text");
+#:portlane.se.quakenet.org NOTICE guava :Highest connection count: 1541 (1540 clients)
+#:portlane.se.quakenet.org NOTICE guava :on 2 ca 2(4) ft 20(20) tr
+ } elsif($response =~ /^:([^ ]+) MODE ([^ ]+) ([^ ]+)\s*(.*)\r\n$/i) {
+ my ($hostmask, $chan, $change, $targets) = ($1, $2, $3, $4);
+ if ($hostmask =~ /([^!]+)!([^@]+@[^@ ]+)/) {
+ my ($nick, $host) = ($1, $2);
+ my $hand = $staff; # TODO fix later
+ foreach my $c (@{$call->{mode}}) {
+ # TODO filter by mask
+ my $proc = $c->{proc};
+ $proc->($bot, $nick, $host, $hand, $chan, $change, $targets);
}
}
- debug(ALL, "$nick!$host NOTICE $target $text");
- } elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) MODE ([^ ]+) ([^ ]+)\s*([^ ]*)\r\n$/i) {
- my ($hostmask, $nick, $host, $chan, $change, $target) = ($1, $2, $3, $4, $5, $6);
- my $hand = $staff; # TODO fix later
- foreach my $c (@{$call->{mode}}) {
- # TODO filter by mask
- my $proc = $c->{proc};
- $proc->($bot, $nick, $host, $hand, $chan, $change, $target);
- }
- debug(ALL, "$hostmask MODE $chan $change $target");
+ debug(ALL, "$hostmask MODE $chan $change $targets");
#:guava!guava@guava.guava.ircnow.org MODE guava :+Ci
#:ChanServ!services@services.irc.ircnow.org MODE #testing +q jrmu
#:jrmu!jrmu@jrmu.staff.ircnow.org MODE #testing +o jrmu
+#Unexpected bncnow.pl 460: :irc.guava.ircnow.org MODE guava :+o
} elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) JOIN :?(.*)\r\n$/i) {
my ($hostmask, $nick, $host, $chan) = ($1, $2, $3, $4);
my $hand = $staff; # TODO fix later
@@ -348,14 +366,37 @@ while(my @ready = $sel->can_read) {
}
debug(ALL, "$hostmask PART $chan :$text");
#:jrmu!jrmu@jrmu.staff.ircnow.org PART #testing :
+ } elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) KICK (#[^ ]+) ([^ ]+) :(.*)\r\n$/i) {
+ my ($hostmask, $nick, $host, $chan, $kicked, $text) = ($1, $2, $3, $4, $5, $6);
+ my $hand = $staff; # TODO fix later
+ foreach my $c (@{$call->{kick}}) {
+ # if ($text eq $c->{mask}) { # TODO fix later
+ my $proc = $c->{proc};
+ $proc->($bot, $nick, $host, $hand, $chan, $text);
+ # }
+ }
+ debug(ALL, "$hostmask KICK $chan $kicked :$text");
+#jrmu!jrmu@jrmu.users.undernet.org KICK #ircnow guava :this is a test
} elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) NICK :?(.*)\r\n$/i) {
my ($hostmask, $nick, $host, $text) = ($1, $2, $3, $4);
debug(ALL, "$hostmask NICK $text");
#:Fly0nDaWaLL|dal!psybnc@do.not.h4ck.me NICK :nec|dal
+ } elsif($response =~ /^:(([^!]+)!([^@]+@[^@ ]+)) QUIT :(.*)\r\n$/i) {
+ my ($hostmask, $nick, $host, $text) = ($1, $2, $3, $4);
+ debug(ALL, "$hostmask QUIT :$text");
+#:Testah!~sid268081@aa38a510 QUIT :Client closed connection
+ } elsif($response =~ /^NOTICE AUTH :(.*)\r\n$/i) {
+ my ($text) = ($1);
+ debug(ALL, "NOTICE AUTH: $text");
+#NOTICE AUTH :*** Looking up your hostname
+#NOTICE AUTH: *** Looking up your hostname
+#NOTICE AUTH: *** Checking Ident
+#NOTICE AUTH: *** Got ident response
+#NOTICE AUTH: *** Found your hostname
} elsif ($response =~ /^:([[:graph:]]+) (\d\d\d) $botnick.? :?(.*)\r?\n?\r$/i) {
my ($server, $code, $text) = ($1, $2, $3);
if ($code =~ /^001$/) { # Server Info
- debug(ERRORS, "botnow successfully connected to $bot->{name}");
+ debug(ERRORS, "connected: $bot->{name}");
} elsif ($code =~ /^0\d\d$/) { # Server Info
debug(ALL, "$server $code $text");
} elsif ($code =~ /^2\d\d$/) { # Server Stats
@@ -383,7 +424,7 @@ while(my @ready = $sel->can_read) {
my $id = SQLite::id("irc", "nick", $sender, $expires);
SQLite::set("irc", "id", $id, $key, $val);
debug(ALL, "$key: $val");
- } elsif ($code == 315 && $text =~ /^([-_\|`a-zA-Z0-9]+) :End of \/?WHOIS list/) {
+ } elsif ($code == 315 && $text =~ /^([-_\|`a-zA-Z0-9]+) :End of \/?WHO(IS)? list/) {
debug(ALL, "End of WHOIS");
} elsif ($code == 317 && $text =~ /^([-_\|`a-zA-Z0-9]+) (\d+) (\d+) :?(.*)/) {
($sender, my $idle, my $epochtime) = ($1, $2, $3);
@@ -421,9 +462,12 @@ while(my @ready = $sel->can_read) {
debug(ALL, "$key: $val");
} elsif ($code =~ /^332$/) { # Topic
# print "$text\r\n";
- } elsif ($code =~ /^333$/) { # Topic
+ } elsif ($code =~ /^333$/) { #
# print "$server $text\r\n";
#karatkievich.freenode.net 333 #ircnow jrmu!znc@206.253.167.44 1579277253
+ } elsif ($code =~ /^352$/) { # Hostmask
+#:datapacket.hk.quakenet.org 352 * znc guava.guava.ircnow.org *.quakenet.org guava H :0 guava
+ # print "$server $code $text\r\n";
} elsif ($code =~ /^353$/) { # Names
# print "$server $code $text\r\n";
} elsif ($code =~ /^366$/) { # End of names
@@ -434,8 +478,13 @@ while(my @ready = $sel->can_read) {
# print "IRC Oper Verified\r\n";
} elsif ($code =~ /^401$/) { # IRC Operator Verified
# print "IRC Oper Verified\r\n";
+ } elsif ($code =~ /^403$/) { # No such channel
+ # debug(ERRORS, "$text");
} elsif ($code =~ /^422$/) { # MOTD missing
# print "$server $code $text\r\n";
+ } elsif ($code =~ /^396$/) { # Display hostname
+ # print "$server $code $text\r\n";
+#Unexpected bncnow.pl 454: irc.guava.ircnow.org 396 guava.guava.ircnow.org :is your displayed hostname now
} elsif ($code =~ /^464$/) { # Invalid password for oper
foreach my $chan (@teamchans) {
putserv($bot, "PRIVMSG $chan :$botnick oper password failed; the bot will be unable to view uncloaked IP addresses");
@@ -447,22 +496,13 @@ while(my @ready = $sel->can_read) {
} elsif ($code == 716 && $text =~ /^([-_\|`a-zA-Z0-9]+) :is in \+g mode \(server-side ignore.\)/) {
debug(ALL, "$text");
} else {
- debug(ERRORS, "Unexpected: $server $code $text");
+ debug(ERRORS, "Unexpected bncnow.pl 454: $server $code $text");
}
- # } elsif($response =~ /^:\*status!znc\@znc\.in $nick (.*)/i) {
- #my ($text) = ($1);
- #debug(ERRORS, "$text");
} else {
- debug(ERRORS, "Unexpected: $response");
+ debug(ERRORS, "Unexpected bncnow.pl 460: $response");
}
}
}
-#Unexpected: *status!znc@znc.in guava Disconnected from IRC. Reconnecting...
-#Unexpected: *status!znc@znc.in guava Connected!
-#Unexpected: *status!znc@znc.in guava Error from server: Closing Link: guava.guava.ircnow.org (Ping timeout: 493 seconds)
-#Unexpected: irc.us10.ircnow.org 396 guava.guava.ircnow.org :is your displayed hostname now
-#Unexpected: irc.us10.ircnow.org 352 * guava guava.guava.ircnow.org irc.us10.ircnow.org guava H :0 guava
-#Unexpected: irc.us10.ircnow.org 315 guava :End of WHO list
sub putserv {
my( $bot, $text )=@_;
@@ -530,5 +570,3 @@ sub debug {
my ($level, $msg) = @_;
if ($verbose >= $level) { print "$msg\n"; }
}
-
-
blob - 6fb52b7a30893f399824b4d1a87a62c9451c3214
blob + b65b5e54f3dae278ef2d1a96ddb792348e011b4c
--- makefile
+++ makefile
@@ -26,7 +26,7 @@ botnow: figlet php sqlite
chmod g+rw ${HTTPDCONF} ${ACMECONF}
echo "permit nopass ${USERNAME} as _nsd cmd nsd-control" >> /etc/doas.conf
cp register.php ${HTDOCS}/
- cp LICENSE README botnow.pl botnow.conf.example BNC.pm DNS.pm Mail.pm SQLite.pm Shell.pm VPN.pm Login.pm WWW.pm table.sql Hash.pm Help.pm makefile networks register.php words shell ${HOMEDIR}/
+ cp LICENSE README botnow.pl botnow.conf.example BNC.pm DNS.pm Mail.pm SQLite.pm Shell.pm table.sql Hash.pm Help.pm makefile networks register.php words shell ${HOMEDIR}/
chown -R ${USERNAME}:${USERNAME} ${HOMEDIR}
chmod u+x ${HOMEDIR}/botnow.pl
chown -R ${ZNCUSER}:daemon ${ZNCDIR}
@@ -38,10 +38,6 @@ figlet:
php:
pkg_add php-7.4.11
-# rcctl enable php74_fpm
-# rcctl restart php74_fpm
-# rcctl enable httpd
-# rcctl restart httpd
sqlite:
pkg_add p5-DBI
blob - 9beed52acb0ce0b9a38eedf11d6313911dc53597
blob + 61f2c27f7713e319b0360f0655fe30f2f893065d
--- networks
+++ networks
@@ -258,6 +258,7 @@ synirc irc.synirc.net ~6697
technet irc.technet.xi.ht +6697
thaiirc irc.thaiirc.com 6667
tilde-chat irc.tilde.chat +6697
+trendsohbet irc.trendsohbet.com 6667
trsohbet irc.trsohbet.com 6667
tweakers irc.tweakers.net 6667
twistednet irc.twistednet.org ~6697