; Advanced Botnet Repeat Flooder & Shitlist Script ; Strips all formatting (color/bold) to catch hidden spam variations. ; Exempts op, halfop, and voice. Triggers on TEXT and NOTICE. ; ONLY active on AustNet servers (*.austnet.org) ; Uses ^ to trigger before other scripts and forces the text to display if another script is hiding it. ; --- SHITLIST COMMANDS & ALIASES --- ; Usage: /unshitlist alias unshitlist { if (!$1) { echo -ac info * /unshitlist: specify an IP or mask | return } var %m = $1 if (@ !in %m) var %m = *!*@ $+ %m if ($read(shitlist.txt, nw, %m)) { write -dl $+ $readn shitlist.txt echo -ac info * Removed %m from the shitlist. } else { echo -ac info * %m is not in the shitlist. } } alias -l add_shitlist { var %m = $1 if (!%m) return if (!$read(shitlist.txt, nw, %m)) { write shitlist.txt %m } } ; --- ON JOIN PROTECTION --- on *:JOIN:#: { if (*austnet* !iswm $network && *austnet* !iswm $server) return if ($me !isop $chan && $me !ishop $chan) return .who $nick var %mask = $mask($fulladdress, 2) if ($read(shitlist.txt, nw, %mask)) { mode $chan +b %mask kick $chan $nick (Shitlisted) drone. } } ; --- TEXT & NOTICE EVENTS --- on ^*:TEXT:*:#: { if (*austnet* !iswm $network && *austnet* !iswm $server) return if ($me !isop $chan && $me !ishop $chan) return if ($nick !isreg $chan) return var %mask = $mask($fulladdress, 2) if ($read(shitlist.txt, nw, %mask)) { mode $chan +b %mask kick $chan $nick Drone (Shitlisted) haltdef return } ; Forcefully echo the text to the channel window, bypassing other scripts that might hide it. echo -tc text $chan < $+ $nick $+ > $1- haltdef check_mass_repeat $chan $nick $fulladdress $1- } on ^*:NOTICE:*:#: { if (*austnet* !iswm $network && *austnet* !iswm $server) return if ($me !isop $chan && $me !ishop $chan) return if ($nick !isreg $chan) return var %mask = $mask($fulladdress, 2) if ($read(shitlist.txt, nw, %mask)) { mode $chan +b %mask kick $chan $nick (Shitlisted) drone. haltdef return } echo -tc notice $chan - $+ $nick $+ - $1- haltdef check_mass_repeat $chan $nick $fulladdress $1- } ; --- CORE LOGIC --- alias -l check_mass_repeat { var %c = $1, %n = $2, %full = $3, %m = $4- ; --- SETTINGS --- var %limit = 3 var %timeout = 30 ; ---------------- ; Strip all color, bold, and underline codes to find the "true" message var %clean_msg = $strip(%m) var %msg_hash = $md5(%clean_msg) var %hash = botnet_flood if (!$hget(%hash)) hmake %hash 100 var %item_cnt = %c $+ . $+ %msg_hash $+ .cnt var %item_users = %c $+ . $+ %msg_hash $+ .users ; Increment global count for this message string var %count = $calc($hget(%hash, %item_cnt) + 1) hadd -u $+ %timeout %hash %item_cnt %count ; Collect the address mask (e.g. *!*@host.com) var %mask = $mask(%full, 2) ; Store unique users in the format "Nick,Mask" var %users = $hget(%hash, %item_users) var %u_entry = %n $+ , $+ %mask if (!$istok(%users, %u_entry, 32)) { var %users = $addtok(%users, %u_entry, 32) hadd -u $+ %timeout %hash %item_users %users } ; --- PUNISHMENT --- ; If it hits the limit exactly, ban EVERYONE who was on the list if (%count == %limit) { var %i = 1 while (%i <= $numtok(%users, 32)) { var %entry = $gettok(%users, %i, 32) var %t_nick = $gettok(%entry, 1, 44) var %t_mask = $gettok(%entry, 2, 44) if (%t_mask) { mode %c +b %t_mask add_shitlist %t_mask } if (%t_nick ison %c) { kick %c %t_nick (AUTO) drone. } inc %i } } ; If it's already past the limit, just kill the new bot instantly else { if (%count > %limit) { mode %c +b %mask add_shitlist %mask if (%n ison %c) { kick %c %n (AUTO) drone. } } } }