Spam detection sBot — File Browser
SpamdetectionsBotv1.5 / SpamdetectionsBotv1.5 / sBot / sBot.mrc
sBot.mrc — 17.49 KB — Download this file
; _______________________________________________
;|
;| Spam detection sBot
;|_______________________________________________
;|
;| Version: 1.5
;| Author: RagingDemon
;| Addon type: bot (designed to detect private spams)
;| E-mail: ragingdemon@gmail.com
;| URL: www.geocities.com/gren_gr/sbot.zip
;| Copyright: 2004 @ May, 27
;|_______________________________________________
;|
;| Please do not modify the source code below
;|_______________________________________________
menu channel,status,menubar {
-
Spam detection sBot
.$iif($dialog(sbot),Close,Open) : sbot
.$iif($sock(sbot),Shut down) : sbot_clear
.-
.Debug window: sbot_debug
.-
.Unload: $iif($input(Are you sure you want to unload sBot?,wy,Warning),.unload -rs $+(",$script,"))
-
}
alias sbot { if ($dialog(sbot)) { dialog -x $ifmatch } | else { dialog -mdo sbot sbot } }
alias -l sbot_aid { if ($dialog(sbot_id)) { dialog -v $ifmatch } | else { dialog -mo sbot_id sbot_id } }
on *:load: { echo -s * sBot is successfully loaded. Type /sbot to open it }
on *:unload: { unset %sbot* | echo -s * Thank you for using sBot }
on *:start: { if ($version < 6.0) { echo -s * sBot needs mIRC 6.0+ to run properly. Unloading addon... | .unload -rs $+(",$script,") } }
dialog -l sbot_id {
title "sBot' s identification"
size -1 -1 215 198
text "Service:", 11, 10 15 65 15, right
text "Password:", 1, 10 35 65 15, right
text "Command:", 2, 10 55 65 15, right
edit "", 3, 85 33 120 20, autohs
edit "", 4, 85 53 120 20, autohs
edit "", 12, 85 13 120 20, autohs
text "Note: <nick> indicates sBot' s nickname and <pass> indicates password. Don' t use / in front of command", 10, 10 80 195 55
check "Allow auto-id", 5, 86 125 105 15
box "", 6, 10 145 195 8
button "Cancel", 7, 145 163 60 25, cancel
button "Save", 8, 78 163 60 25, ok
box "", 9, -1 -6 217 205
}
on *:dialog:sbot_id:init:0: {
var %e = did -a $dname
%e 3 $sbot_pass
%e 4 $sbot_command
%e 12 $sbot_service
if (%sbot_autoid == on) { did -c $dname 5 }
}
on *:dialog:sbot_id:sclick:8: {
set %sbot_autoid $iif($did(5).state == 1,on,off)
set %sbot_pass $did(3)
set %sbot_command $did(4)
set %sbot_service $did(12)
}
dialog -l sbot {
title "Spam detection sBot"
size -1 -1 215 328
text "Nickname:", 1, 10 15 65 15, right
text "Alternative:", 2, 10 35 65 15, right
text "Full name:", 3, 10 65 65 15, right
text "User identd:", 4, 10 85 65 15, right
text "Server:", 5, 10 115 65 15, right
text "Port:", 6, 10 135 65 15, right
text "Part msg:", 7, 10 185 65 15, right
text "Rejoin every:", 8, 10 205 65 15, right
text "Channels:", 9, 10 165 65 15, right
edit "", 10, 85 13 120 20, autohs
edit "", 11, 85 33 120 20, autohs
edit "", 12, 85 63 120 20, autohs
edit "", 13, 85 83 120 20, autohs
edit "", 14, 85 113 120 20, autohs
edit "", 15, 85 133 60 20, autohs
edit "", 16, 85 183 120 20, autohs
edit "", 17, 85 203 60 20, autohs
edit "", 18, 85 163 120 20, autohs
text "Note: Seperate channels with a comma or enter a # so that sBot joins the same channels as you.", 19, 10 230 195 50
text "min(s)", 20, 150 205 50 15
box "", 21, 10 275 195 8
button "Launch", 22, 10 293 60 25, ok
button "Close", 23, 145 293 60 25, cancel
button "Shut", 24, 77 293 61 25
box "", 25, -1 -6 217 335
menu "Options", 26
menu "Don' t punish spammer if", 49, 26
item "oped", 30, 49
item "half-oped", 46, 49
item "voiced", 47, 49
item "in notify list", 48, 49
menu "Kick spammer", 43, 26
item "from all common channels", 44, 43
item "only from sBot' s channels", 45, 43
item break, 36, 26
item "Protect sBot from bans", 33, 26
item "Rejoin channels on kick", 34, 26
item "Warn ops on spams if I' m deoped", 37, 26
item "Inform ops that sBot joined channel", 38, 26
item "Auto-op me when I join a channel if sBot is already oped", 40, 26
item "Auto-connect when I connect", 39, 26
item "Silence users that send messages to sBot for 10 secs", 41, 26
item "Log private conversation", 31, 26
item break, 29, 26
item "Debug window", 27, 26
item "Auto-identification procedure", 35, 26
item break, 42, 26
item "View sBot' s commands", 28, 26
item "View sBot' s log file", 32, 26
}
on *:dialog:sbot:init:0: {
var %d = did -ra $dname
%d 10 $sbot_nick
%d 11 $sbot_anick
%d 12 $sbot_name
%d 13 $sbot_id
%d 14 $sbot_server
%d 15 $sbot_port
%d 16 $sbot_part
%d 17 $sbot_mins
%d 18 $sbot_chans
if ($sock(sbot)) { did -b $dname 22 }
else { did -b $dname 24 }
if (%sbot_ops == on) { did -c $dname 30 }
if (%sbot_hops == on) { did -c $dname 46 }
if (%sbot_voices == on) { did -c $dname 47 }
if (%sbot_notifies == on) { did -c $dname 48 }
if (%sbot_log == on) { did -c $dname 31 }
if (%sbot_rejoin == on) { did -c $dname 34 }
if (%sbot_spaminf == on) { did -c $dname 37 }
if (%sbot_joininf == on) { did -c $dname 38 }
if (%sbot_autocon == on) { did -c $dname 39 }
if (%sbot_autoop == on) { did -c $dname 40 }
if (%sbot_silence == on) { did -c $dname 41 }
if ($group(#sbot_protect).status == on) { did -c $dname 33 }
if (%sbot_common == on) { did -c $dname 44 }
else { set %sbot_common off | did -c $dname 45 }
did -f $dname 25
}
on *:dialog:sbot:menu:*: {
if ($did == 44) { set %sbot_common on | did -u $dname 45 | did -c $dname $did }
if ($did == 45) { set %sbot_common off | did -u $dname 44 | did -c $dname $did }
if ($did == 35) { sbot_aid }
if ($did == 27) { sbot_debug }
if ($did == 28) { sbot_commands }
if ($did == 33) { if ($group(#sbot_protect).status == on) { .disable #sbot_protect | did -u $dname $did } | else { .enable #sbot_protect | did -c $dname $did } }
if ($did == 37) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_spaminf off } | else { did -c $dname $did | set %sbot_spaminf on } }
if ($did == 39) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_autocon off } | else { did -c $dname $did | set %sbot_autocon on } }
if ($did == 38) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_joininf off } | else { did -c $dname $did | set %sbot_joininf on } }
if ($did == 30) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_ops off } | else { did -c $dname $did | set %sbot_ops on } }
if ($did == 46) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_hops off } | else { did -c $dname $did | set %sbot_hops on } }
if ($did == 47) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_voices off } | else { did -c $dname $did | set %sbot_voices on } }
if ($did == 48) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_notifies off } | else { did -c $dname $did | set %sbot_notifies on } }
if ($did == 31) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_log off } | else { did -c $dname $did | set %sbot_log on } }
if ($did == 34) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_rejoin off } | else { did -c $dname $did | set %sbot_rejoin on } }
if ($did == 40) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_autoop off } | else { did -c $dname $did | set %sbot_autoop on } }
if ($did == 41) { if ($did($did).state == 1) { did -u $dname $did | set %sbot_silence off } | else { did -c $dname $did | set %sbot_silence on } }
if ($did == 32) { if (!$isfile($sbot_log)) { write -c $sbot_log } | run $sbot_log }
}
on *:dialog:sbot:sclick:*: {
if ($did isnum 22-24) {
set %sbot_nick $did(10)
set %sbot_anick $did(11)
set %sbot_name $did(12)
set %sbot_id $did(13)
set %sbot_server $did(14)
set %sbot_port $did(15)
set %sbot_part $did(16)
set %sbot_mins $iif($did(17) isnum 1-,$ifmatch,30)
set %sbot_chans $did(18)
}
if ($did == 22) {
if ($server) { sbot_connect }
else { echo $color(info) -a * You must first connect to a server yourself in order that sBot works properly | halt }
}
if ($did == 24) { sbot_clear }
}
alias -l sbot_debug {
var %w = @sbot_debug
if ($1 == $null) {
if (!$window(%w)) { window %w | echo %w sBot' s debug window }
else { window -c %w }
}
else { if ($window(%w)) { echo $ifmatch $time $1- } }
}
alias -l sbot_log { return $+(",$scriptdirsbot_log.txt,") }
alias -l sbot_w { if (!$sock(sbot)) { return } | sockwrite -n sbot $1- | sbot_debug <- $1- }
alias -l sbot_nick { return $iif(%sbot_nick != $null,$ifmatch,sbot_s) }
alias -l sbot_pass { return $iif(%sbot_pass != $null,$ifmatch,1111111111) }
alias -l sbot_command { return $iif(%sbot_command != $null,$ifmatch,identify <pass>) }
alias -l sbot_anick { return $iif(%sbot_anick != $null,$ifmatch,_sbot_s_) }
alias -l sbot_id { return $iif(%sbot_id != $null,$ifmatch,cerberus) }
alias -l sbot_name { return $iif(%sbot_name != $null,$ifmatch,holla if ya hear me) }
alias -l sbot_server { return $iif(%sbot_server != $null,$ifmatch,otrere.irc.gr) }
alias -l sbot_port { return $iif(%sbot_port != $null,$ifmatch,6667) }
alias -l sbot_part { return $iif(%sbot_part != $null,$ifmatch,spam check) }
alias -l sbot_mins { return $iif(%sbot_mins != $null,$ifmatch,30) }
alias -l sbot_chans { return $iif(%sbot_chans != $null,$ifmatch,$chr(35)) }
alias -l sbot_service { return $iif(%sbot_service != $null,$ifmatch,nickserv) }
alias -l sbot_join_chans {
if (%sbot_chans == $chr(35)) {
var %chans = $chan(0)
while (%chans > 0) {
.timer.sbot_join $+ $chan(%chans) 1 $calc(%chans * 2) sbot_w JOIN $chan(%chans)
dec %chans
}
}
else {
var %chans = $numtok(%sbot_chans,44)
while (%chans > 0) {
var %c = $gettok(%sbot_chans,%chans,44)
.timer.sbot_join $+ %c 1 $calc(%chans * 2) sbot_w JOIN %c
dec %chans
}
}
}
alias -l sbot_lw {
if (!$isfile($sbot_log)) { write -c $sbot_log }
write $sbot_log $+($date,-,$time) $1-
}
alias -l sbot_commands {
var %e = echo $color(info) -a
%e The commands below must be given in a query window with sBot:
%e ------------------------------
%e * !nick <newnick> : changes sBot' s current nickname to the specified one
%e * !join <channel> : forces sBot to join the channel specified
%e * !rejoin : forces sBot to join all channels specified in the channel field of the main dialog
%e * !part <channel> [message] : forces sBot to leave the channel specified using a message (message is optional)
%e * !partall [message] : forces sBot to part all channels using the specified message (message is optional)
%e * !hop <channel> [message] : forces sBot to leave and re-join the specified channel using a message (message is optional)
%e * !msg <channel|user> <message> : forces sBot to send a normal message to a channel or a user
%e * !action <channel|user> <message> : forces sBot to send an action message to a channel or a user
%e * !notice <channel|user> <message> : forces sBot to send a notice to a channel or a user
%e * !ctcp <channel|user> <message> : forces sBot to send a CTCP to a channel or a user
%e * !quit [message] : forces sBot to quit using the specified message (message is optional)
}
alias -l sbot_mban {
if (%sbot_common == on) {
var %z = $comchan($1,0)
while (%z > 0) {
var %c = $comchan($1,%z)
if (%sbot_ops == on) && ($1 isop %c) { dec %z | continue }
elseif (%sbot_hops == on) && ($1 ishop %c) { dec %z | continue }
elseif (%sbot_voices == on) && ($1 isvoice %c) { dec %z | continue }
elseif (%sbot_notifies == on) && ($1 isnotify) { dec %z | continue }
elseif (%sbot_spaminf == on) && ($me !isop %c) { .notice @ $+ %c Possible spam detected from $1 $2 (auto-message) | echo $color(info) -a * Warned ops in %c for possible spam from $1 $2 }
elseif ($me isop %c) && ($1 ison %c) { ban %c $1 2 | kick %c $1 $3- }
dec %z
}
}
else {
var %z = $numtok(%sbot.tmp_chans,44)
while (%z > 0) {
var %c = $gettok(%sbot.tmp_chans,%z,44)
if (%sbot_ops == on) && ($1 isop %c) { dec %z | continue }
elseif (%sbot_hops == on) && ($1 ishop %c) { dec %z | continue }
elseif (%sbot_voices == on) && ($1 isvoice %c) { dec %z | continue }
elseif (%sbot_notifies == on) && ($1 isnotify) { dec %z | continue }
elseif (%sbot_spaminf == on) && ($me !isop %c) { .notice @ $+ %c Possible spam detected from $1 $2 (auto-message) | echo $color(info) -a * Warned ops in %c for possible spam from $1 $2 }
elseif ($me isop %c) && ($1 ison %c) { ban %c $1 2 | kick %c $1 $3- }
dec %z
}
}
}
on *:connect: { if (%sbot_autocon == on) { .timer.sbot_follow 1 4 sbot_connect } }
alias -l sbot_hop {
sbot_w PART $1 : $+ $sbot_part
.timer.sbot_rejoin $+ $1 1 2 sbot_w JOIN $1
}
alias -l sbot_connect {
if ($sock(sbot)) { halt }
if ($server) { sockopen sbot $sbot_server $sbot_port }
else { echo $color(info) -a * Please connect to a server first | sbot_clear }
}
alias -l sbot_clear {
sockclose sbot | unset %sbot.tmp* | .timer.sbot* off
if ($dialog(sbot)) {
did -b $ifmatch 24
did -e $ifmatch 22
}
halt
}
on *:sockclose:sbot:{
unset %sbot.tmp* | .timer.sbot* off
if ($dialog(sbot)) {
did -b $ifmatch 24
did -e $ifmatch 22
}
}
on *:sockwrite:sbot: {
if ($sockerr) {
sbot_debug * $sock($sockerr).wsmsg
sbot_clear
}
}
on *:sockopen:sbot: {
if ($dialog(sbot)) {
did -e $ifmatch 24
did -b $ifmatch 22
}
if ($sockerr) { sbot_clear }
sbot_w NICK $sbot_nick
sbot_w USER $sbot_id * * : $+ $sbot_name
}
on *:sockread:sbot: {
if ($sockerr) {
sbot_debug * $sock($sockerr).wsmsg
sbot_clear
}
var %t = $null
while ($sock(sbot).rq) {
sockread %t
tokenize 32 %t
if ($sockbr == 0) { return }
sbot_debug -> $1-
if ($2 == 433) { sbot_w NICK $sbot_anick }
if ($2 == 376) {
echo $color(info) -a * Spam detection sBot is successfully connected
if ($dialog(sbot)) { did -b $ifmatch 22 | did -e $ifmatch 24 }
set %sbot.tmp.nick $3
unset %sbot.tmp_chans
.timer.sbot_join_channels 1 2 sbot_join_chans
}
if (*!*@* iswm $1) { var %nick = $remove($gettok($1,1,33),:) }
if ($1 == PING) { sbot_w PONG $2- }
if ($2 == INVITE) && ($3 == %sbot.tmp.nick) {
var %channel = $remove($4,:)
if (%nick == $me) { .timer.sbot_invited $+ %channel 1 2 sbot_w JOIN %channel }
else { sbot_mban %nick (invite) Possible spam detected (invite) }
}
if ($2 == JOIN) {
var %channel = $remove($3,:)
if (%nick == $me) && (%sbot_autoop == on) && (%sbot.tmp.nick isop %channel) { sbot_w mode %channel +o-o $me %sbot.tmp.nick }
if (%nick == %sbot.tmp.nick) {
.timer.sbot_hop $+ %channel 0 $calc(%sbot_mins * 60) sbot_hop %channel
set %sbot.tmp_chans $addtok(%sbot.tmp_chans,%channel,44)
if (%sbot_joininf == on) && (%channel ischan) { .notice @ $+ %channel Spam detection sBot using nickname %sbot.tmp.nick just joined %channel $+ . Please don' t kick it (auto-message) }
}
}
if ($2 == PART) && (%nick == %sbot.tmp.nick) {
var %parted = $remove($3,:)
.timer.sbot_hop $+ %parted off
set %sbot.tmp_chans $deltok(%sbot.tmp_chans,$findtok(%sbot.tmp_chans,%parted,1,44),44)
}
if ($2 == NICK) && (%nick == %sbot.tmp.nick) { set %sbot.tmp.nick $remove($3,:) }
if ($2 == KICK) && ($4 == %sbot.tmp.nick) { if (%sbot_rejoin == on) { var %chan = $3 | .timer.sbot_re-join $+ %chan 1 1 sbot_w JOIN %chan } }
if ($2 == NOTICE) {
if ($3 == %sbot.tmp.nick) {
if (%sbot_log == on) { sbot_lw $1- }
if (nickserv!*@* iswm $remove($1,:)) && (%sbot_autoid == on) && (*nickname*registered*protected* iswm $4-) { sbot_w PRIVMSG $sbot_service : $+ $replace($sbot_command,<nick>,%sbot.tmp.nick,<pass>,$sbot_pass) }
}
}
if ($2 == PRIVMSG) {
if ($4 == :VERSION) { sbot_w NOTICE %nick :VERSION IRC Java client v1.0 }
if ($3 == %sbot.tmp.nick) {
if (%sbot_log == on) { sbot_lw $1- }
if (%nick == $me) {
var %c = $remove($4,:)
if (%c == !msg) { sbot_w PRIVMSG $5 : $+ $$6- }
if (%c == !notice) { sbot_w NOTICE $5 : $+ $$6- }
if (%c == !action) { sbot_w PRIVMSG $5 :ACTION $$6- $+ }
if (%c == !ctcp) { sbot_w PRIVMSG $5 : $+ $upper($$6-) $+ }
if (%c == !nick) { sbot_w NICK $$5 }
if (%c == !part) { sbot_w PART $$5 : $+ $6- }
if (%c == !join) { sbot_w JOIN $$5 }
if (%c == !rejoin) { sbot_join_chans }
if (%c == !hop) { sbot_w PART $$5 : $+ $6- | .timer.sbot_rejoin $+ $1 1 2 sbot_w JOIN $$5 }
if (%c == !quit) { sbot_w QUIT : $+ $5- | .timer.sbot.quit 1 1 sbot_clear }
if (%c == !partall) {
var %i = $numtok(%sbot.tmp_chans,44)
while (%i > 0) { sbot_w PART $gettok(%sbot.tmp_chans,%i,44) : $+ $6- | dec %i }
}
halt
}
if (*www.* iswm $4-) || (*http://* iswm $4-) || (*.com* iswm $4-) || (*.net* iswm $4-) || (*.org* iswm $4-) || (*#* iswm $4-) { sbot_mban %nick ( $+ $ifmatch $+ ) Possible spam detected ( $+ $ifmatch $+ ) }
if (%sbot_silence == on) {
sbot_w SILENCE $+(+,%nick)
.timer.sbot_silence $+ %nick 1 10 sbot_w SILENCE $+(-,%nick)
}
}
}
}
}
#sbot_protect on
ON !@*:BAN:#: {
if ($nick != chanserv) && (($banmask iswm $address(%sbot.tmp.nick,5)) || ($banmask iswm $+($left($address(%sbot.tmp.nick,5),$pos($address(%sbot.tmp.nick,5),@,1)),$ip))) { mode $chan -b $banmask | .timer.sbot_notice $+ $nick 1 2 .notice $nick Please don' t ban the spam detection sBot (auto-message) }
}
#sbot_protect end