| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Sep 22, 2020 3:42 am Post subject: setting ban on msg followed by quit |
|
|
we experienced some floodings and spamming where there bots spam and then quickly part to avoid gettin banned the chanops arent that experienced to set bans on users that already quit
i was wondering if there is already such code available |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Tue Sep 22, 2020 3:53 am Post subject: |
|
|
You could use allprotection to limit the number of user coming in the same time, and to ban on spam (badwords) and flood. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Sep 22, 2020 4:04 am Post subject: |
|
|
tnx crazycat ive used AP in the past its extremely big and it doesnt have anyting to check for message and quick quit and they dont join with mass nicks
they join per nick slow and paste spam and quickly quit to avoid gettin banned by chanops and they keep changing paterns for the spam |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Sep 22, 2020 4:26 am Post subject: |
|
|
been using this msl version:
| Code: |
ON *:text:*:#: {
set -u5 % [ $+ [ $chan ] $+ . $+ [ $address($nick,2) ] $+ ] .partmsg on
}
ON *:action:*:#: {
set -u5 % [ $+ [ $chan ] $+ . $+ [ $address($nick,2) ] $+ ] .partmsg on
}
On *:Part:#:{
if (% [ $+ [ $chan ] $+ . $+ [ $address($nick,2) ] $+ ] .partmsg == on) {
mode $chan +b $address($nick,2)
unset % [ $+ [ $chan ] $+ . $+ [ $address($nick,2) ] $+ ] .partmsg
}
}
ON !^*:QUIT: {
var %cntz34 = 1
while ($comchan($nick,%cntz34) != $null ) {
var %floodchan $ifmatch
if (% [ $+ [ %floodchan ] $+ . $+ [ $address($nick,2) ] $+ ] .partmsg == on) {
mode %floodchan +b $address($nick,2)
unset % [ $+ [ %floodchan ] $+ . $+ [ $address($nick,2) ] $+ ] .partmsg
}
inc %cntz34
halt
}
} |
but we wanted to use on eggdrop
Last edited by simo on Tue Sep 22, 2020 1:53 pm; edited 2 times in total |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Tue Sep 22, 2020 6:03 am Post subject: |
|
|
Ok, so globally you put a ban on any people leaving the chan (or the network) less than 5s after having speak or made an action ?
I don't know mirc language, so I can made errors in my interpretation, but is it not a little bit heavy ?
I often say bye and quit immediately after, am I a spammer ?
BTW, it's quite simple to reproduce this with an eggdrop, I'll try to make it in the afternoon. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Sep 22, 2020 12:42 pm Post subject: |
|
|
| tnx crazycat |
|
| Back to top |
|
 |
spyda Halfop
Joined: 12 Aug 2002 Posts: 64 Location: Victoria, Australia
|
Posted: Tue Sep 22, 2020 2:33 pm Post subject: |
|
|
Quickly coded, not fully tested. (Eggdrop 1.8.x with tcl 8.6)
See if that works the same as the mirc code, script to my translation (mirc rusty)
| Code: |
bind PUB - * pub:spam
bind CTCP - ACTION ctcp:spam
bind PART - * part:spam
bind SIGN - * sign:spam
proc pub:spam {nick uhost hand chan txt} {
global spamlist
set spamlist($chan,$nick) [unixtime]
}
proc ctcp:spam {nick uhost hand chan key txt} {
global spamlist
set spamlist($chan,$nick) [unixtime]
}
proc part:spam {nick uhost hand chan {txt ""}} {
global spamlist
if {$spamlist($chan,$nick) != ""} {
if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
pushmode $chan +b [maskhost "$nick!$uhost" 3]
}
}
}
proc sign:spam {nick uhost hand chan txt} {
global spamlist
if {$spamlist($chan,$nick) != ""} {
if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
foreach spamchan [channel] {
pushmode $spamchan +b [maskhost "$nick!$uhost" 3]
}
}
}
}
|
_________________ asusNET Services Online in 2005 |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Sep 22, 2020 2:44 pm Post subject: |
|
|
thanx for the code i tried it and got this error:
| Quote: |
20:43:44 <TCL-Tester> [20:44:18] Tcl error [sign:spam]: can't read "spamlist(#opers,Leake)": no such variable
20:43:44 <TCL-Tester> [20:44:18] Tcl error [sign:spam]: can't read "spamlist(#opers,Toshia)": no such variable
20:43:44 <TCL-Tester> [20:44:18] Tcl error [sign:spam]: can't read "spamlist(#opers,Millard)": no such variable
20:43:44 <TCL-Tester> [20:44:18] Tcl error [sign:spam]: can't read "spamlist(#opers,Mchugh)": no such variable
20:43:44 <TCL-Tester> [20:44:18] Tcl error [sign:spam]: can't read "spamlist(#opers,Cota)": no such variable
20:43:44 <TCL-Tester> [20:44:18] Tcl error [sign:spam]: can't read "spamlist(#opers,Krauss)": no such variable |
|
|
| Back to top |
|
 |
spyda Halfop
Joined: 12 Aug 2002 Posts: 64 Location: Victoria, Australia
|
Posted: Tue Sep 22, 2020 3:20 pm Post subject: |
|
|
Try this, my mistakes.
| Code: |
bind PUBM - * pub:spam
bind CTCP - ACTION ctcp:spam
bind PART - * part:spam
bind SIGN - * sign:spam
array set spamlist {}
proc pub:spam {nick uhost hand chan txt} {
global spamlist
set ::spamlist($chan,$nick) [unixtime]
}
proc ctcp:spam {nick uhost hand chan key txt} {
global spamlist
set ::spamlist($chan,$nick) [unixtime]
}
proc part:spam {nick uhost hand chan {txt ""}} {
global spamlist
if {$spamlist($chan,$nick) != ""} {
if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
pushmode $chan +b [maskhost "$nick!$uhost" 3]
}
}
}
proc sign:spam {nick uhost hand chan txt} {
global spamlist
if {$spamlist($chan,$nick)] != ""} {
if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
foreach spamchan [channel] {
pushmode $spamchan +b [maskhost "$nick!$uhost" 3]
}
}
}
} |
_________________ asusNET Services Online in 2005 |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Sep 22, 2020 4:34 pm Post subject: |
|
|
this time i got this error:
| Quote: |
22:32:33 <TCL-Tester> [22:33:07] Tcl error [sign:spam]: invalid character "]"
22:32:33 <TCL-Tester> in expression "$spamlist($chan,$nick)] != """
Tcl error [part:spam]: can't read "spamlist(#opers,Greene)": no such element in array
|
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Sep 23, 2020 1:30 am Post subject: |
|
|
Instead of using the spamlist($chan,$nick) time format I would go with per channel format like spamlist($chan) {nick time} cos is easier to store and most important to maintain the list.
So, with this in mind instead of:
| Code: |
set ::spamlist($chan,$nick) [unixtime]
|
would become:
| Code: |
lappend spamlist($chan) [list $nick [clock seconds]]
|
this:
| Code: |
if {$spamlist($chan,$nick) != ""} {
if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
pushmode $chan +b [maskhost "$nick!$uhost" 3]
}
}
|
would become:
| Code: |
if {![info exists spamlist($chan)]} return
set pos [lsearch -nocase [dict keys [join $spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $spamlist($chan) $pos] {%s%s} user time
set now [clock seconds]
if {[expr $now - $time] < 6} {
pushmode $chan +b [maskhost "$nick!$uhost" 3]
set spamlist($chan) [lreplace $spamlist($chan) $pos $pos]
}
}
|
this part:
| Code: |
if {$spamlist($chan,$nick)] != ""} {
if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
foreach spamchan [channel] {
pushmode $spamchan +b [maskhost "$nick!$uhost" 3]
}
}
}
|
becomes:
| Code: |
if {![info exists spamlist($chan)]} return
set pos [lsearch -nocase [dict keys [join $spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $spamlist($chan) $pos] {%s%s} user time
set now [clock seconds]
if {[expr $now - $time] < 6} {
set spamlist($chan) [lreplace $spamlist($chan) $pos $pos]
set mask [maskhost "$nick!$uhost" 3]
foreach c [channels] {
pushmode $c +b $mask
}
}
}
|
You should consider adding a function that would keep track of nick changes (bind nick) and something for cleanup like when bot leaves the channel (when you restart it or whatnot), when a user is kicked, and so on.
PS: Haven't tested any code, just in my mind so might not work as intended so leave a message if you get any errors.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Sep 23, 2020 4:35 am Post subject: |
|
|
And a little addendum to the caesar' suggestion: don't duplicate things when you can avoid:
| Code: | proc part:spam {nick uhost hand chan {txt ""}} {
ban:spam $nick $uhost $chan
}
proc sign:spam {nick uhost hand chan txt} {
ban:spam $nick $uhost $chan
}
proc ban:spam {nick uhost chan} {
if {![info exists ::spamlist($chan)]} return
set pos [lsearch -nocase [dict keys [join $::spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $::spamlist($chan) $pos] {%s%s} user time
set now [clock seconds]
if {[expr $now - $time] < 6} {
set ::spamlist($chan) [lreplace $::spamlist($chan) $pos $pos]
set mask [maskhost "$nick!$uhost" 3]
foreach c [channels] {
pushmode $c +b $mask
}
}
}
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Sep 23, 2020 12:23 pm Post subject: |
|
|
| what binds do i need to use with that crazycat im a bit confused |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Sep 23, 2020 2:32 pm Post subject: |
|
|
this is what i have so far tested it but it doesnt react:
| Code: |
bind PUB - * pub:spam
bind CTCP - ACTION ctcp:spam
bind PART - * part:spam
bind SIGN - * sign:spam
array set spamlist {}
proc pub:spam {nick uhost hand chan txt} {
global spamlist
lappend spamlist($chan) [list $nick [clock seconds]]
}
proc ctcp:spam {nick uhost hand chan key txt} {
global spamlist
lappend spamlist($chan) [list $nick [clock seconds]]
}
proc part:spam {nick uhost hand chan {txt ""}} {
ban:spam $nick $uhost $chan
}
proc sign:spam {nick uhost hand chan txt} {
ban:spam $nick $uhost $chan
}
proc ban:spam {nick uhost chan} {
if {![info exists ::spamlist($chan)]} return
set pos [lsearch -nocase [dict keys [join $::spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $::spamlist($chan) $pos] {%s%s} user time
set now [clock seconds]
if {[expr $now - $time] < 6} {
set ::spamlist($chan) [lreplace $::spamlist($chan) $pos $pos]
set mask [maskhost "$nick!$uhost" 3]
pushmode $chan +b $mask
}
}
}
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Sep 23, 2020 5:55 pm Post subject: |
|
|
No, you don't see any reaction because you didn't output any debug information.
| Code: | proc ban:spam {nick uhost chan} {
if {![info exists ::spamlist($chan)]} {
putserv "PRIVMSG $chan :Can't find spamlist for $chan"
return
}
set pos [lsearch -nocase [dict keys [join $::spamlist($chan)]] $nick]
if {$pos > -1} {
scan [lindex $::spamlist($chan) $pos] {%s%s} user time
set now [clock seconds]
if {[expr $now - $time] < 6} {
set ::spamlist($chan) [lreplace $::spamlist($chan) $pos $pos]
set mask [maskhost "$nick!$uhost" 3]
pushmode $chan +b $mask
} else {
putserv "PRIVMSG $chan :More than 5s, doing nothing"
}
} else {
putserv "PRIVMSG $chan :Can't find $nick in spamlist of $chan"
}
} |
All the putserv I added are just for debug, they didn't change the way the proc is working.
You can now make tests and copy us the results you get in your chan. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
|