This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

setting ban on msg followed by quit

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

setting ban on msg followed by quit

Post by simo »

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
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You could use allprotection to limit the number of user coming in the same time, and to ban on spam (badwords) and flood.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

been using this msl version:

Code: Select all

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.
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tnx crazycat
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Post by spyda »

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: Select all

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
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanx for the code i tried it and got this error:
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
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Post by spyda »

Try this, my mistakes.

Code: Select all

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
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this time i got this error:
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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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: Select all

set ::spamlist($chan,$nick) [unixtime] 
would become:

Code: Select all

lappend spamlist($chan) [list $nick [clock seconds]]
this:

Code: Select all

if {$spamlist($chan,$nick) != ""} {
      if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} { 
         pushmode $chan +b [maskhost "$nick!$uhost" 3]
      }
   } 
would become:

Code: Select all

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: Select all

if {$spamlist($chan,$nick)] != ""} {
      if {[expr {[unixtime] - $spamlist($chan,$nick)}] < 6} {
         foreach spamchan [channel] {
            pushmode $spamchan +b [maskhost "$nick!$uhost" 3]
         }
      }
   } 
becomes:

Code: Select all

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.
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

And a little addendum to the caesar' suggestion: don't duplicate things when you can avoid:

Code: Select all

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
         }
      }
   }
}
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

what binds do i need to use with that crazycat im a bit confused
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this is what i have so far tested it but it doesnt react:

Code: Select all

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
      }
   }
}
User avatar
CrazyCat
Revered One
Posts: 1293
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

No, you don't see any reaction because you didn't output any debug information.

Code: Select all

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.
Post Reply