egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

setting ban on msg followed by quit
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Sep 22, 2020 3:42 am    Post subject: setting ban on msg followed by quit Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Sep 22, 2020 3:53 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Sep 22, 2020 4:04 am    Post subject: Reply with quote

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
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Sep 22, 2020 4:26 am    Post subject: Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Sep 22, 2020 6:03 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Sep 22, 2020 12:42 pm    Post subject: Reply with quote

tnx crazycat
Back to top
View user's profile Send private message
spyda
Halfop


Joined: 12 Aug 2002
Posts: 64
Location: Victoria, Australia

PostPosted: Tue Sep 22, 2020 2:33 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Sep 22, 2020 2:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
spyda
Halfop


Joined: 12 Aug 2002
Posts: 64
Location: Victoria, Australia

PostPosted: Tue Sep 22, 2020 3:20 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Sep 22, 2020 4:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Sep 23, 2020 1:30 am    Post subject: Reply with quote

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. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Sep 23, 2020 4:35 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Sep 23, 2020 12:23 pm    Post subject: Reply with quote

what binds do i need to use with that crazycat im a bit confused
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Sep 23, 2020 2:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Sep 23, 2020 5:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber