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 

Kill 1st Gline 2nd
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Wed Aug 19, 2020 6:59 pm    Post subject: Kill 1st Gline 2nd Reply with quote

So just made this rough code on my mobile, it's meant to kill a user if they flood on 1st, and if they flood when they reconnect it will gline, is this code close to correct?
Code:

bind flud - pub flud:ban

proc flud:ban { n u h t c } {
   global badguy
   if {(![info exists badguy])} { set badguy "0" }
   if {($badguy != "1")} {
      putnow "gline $n 30m Network_Flood"
      set badguy "0"
   } else {
      putnow "KILL $n Spamming is not allowed on TechNet"
      set badguy "1"
   }
}


i want to make this for each user, and not set a global variable
Cheers in advanced guys Cool
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Wed Aug 19, 2020 11:15 pm    Post subject: Reply with quote

Heh, figured it out by myself
Code:

bind flud - pub flud:ban

proc flud:ban { n u h t c } {
   global badguy
   if {(![info exists badguy])} { set badguy "0" }
   if {($badguy == "1")} {
      putnow "gline $n 30m Network_Flood"
      set badguy "0"
   } else {
      putnow "KILL $n Spamming is not allowed on TechNet"
      set badguy "1"
   }
}


And of course, all is welcome to edit and give ideas to improve Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Thu Aug 20, 2020 2:15 am    Post subject: Reply with quote

Well, your script will gline a lot of flooders:
If UserA floods, the proc is called and badguy is set to 1.
If anyone else floods, the proc is called again and then, he's glined, even if he's not UserA.

Here is a way to make it gline the user already advertised, by using his host as key for $badguy
Code:
bind flud - pub flud:ban

proc flud:ban { n u h t c } {
   if {(![info exists ::badguy($u)])} { set ::badguy($u) 0 }
   if {($::badguy($u) == "1")} {
      putnow "gline $n 30m Network_Flood"
      set ::badguy($u) 0
   } else {
      putnow "KILL $n Spamming is not allowed on TechNet"
      set ::badguy($u) 1
   }
}


I didn't correct your gline command which won't work, the gline syntax is gline host duration :reason
_________________
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
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Thu Aug 20, 2020 9:05 am    Post subject: Reply with quote

Cheers CrazyCat, what about ip? if i wanted to gzline them, what would i change?

Thanks in advanced for effort Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Thu Aug 20, 2020 9:59 am    Post subject: Reply with quote

Um, your version didn't work until I added a namespace, now it works Perfect Very Happy

Code:

namespace eval ::badguy {

bind flud - pub flud:ban

proc flud:ban { n u h t c } {
   if {(![info exists ::badguy($u)])} { set ::badguy($u) 0 }
   if {($::badguy($u) == "3")} {
      putnow "gline $n 30m Network_Flood"
      set ::badguy($u) 0
   } else {
      putnow "KILL $n Spamming is not allowed on TechNet"
      set ::badguy($u) 1
   }
   if {($::badguy($u) == "2")} {
   putnow "privmsg $n :You Are Flooding/Spamming, Please Stop Or You Will Be Network Banned"
 
  } else {
      return

     }
  }
}


Cheers CrazyCat Cool
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Thu Aug 20, 2020 10:32 am    Post subject: Reply with quote

Do you know you're really lucky ?
I did a small script a few week ago to gline potential bad bots...

Here is the source: https://gitlab.com/tcl-scripts/chan-access-filter/-/blob/master/checker.tcl

If I adapt for your usage:
Code:
namespace eval badguy {

   variable bad
   
   bind flud - pub flud:ban
   
   proc flud:ban { n u h t c } {
      if {(![info exists ::badguy::bad($u)])} { set ::badguy::bad($u) 0 }
      incr ::badguy::bad($u)
      switch $::badguy::bad($u) {
         1 {
            putquick "privmsg $n :You Are Flooding/Spamming, Please Stop Or You Will Be Network Banned"
         }
         2 {
            putquick "KILL $n Spamming is not allowed on TechNet"
         }
         3 {
            putnow "WHOIS $n"
            unset ::badguy::bad($u)
         }
      }
      return 1
   }
   
   bind raw - 378 flud:gline
   proc flud:gline {from kw text} {
      set host [lindex [split $text " "] end]
      putnow "gzline *@$host +30m :Network flood"
   }
}

Note that there is no security: if eggdrop receive a response to a /whois, it will gzline the user.

Small other notes:
- you decide to use a namespace but your variable was in the global namespace, so I rename it and put it in your namespace
- I changed your if / else to a switch, allowing to add more options
- the flood counter is now using incr, you don't have to set it to the next level each time
- I reserved putnow for actions needing high priority (/whois and gline), others can simply use putquick. Don't use putnow everywhere.
_________________
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
caesar
Mint Rubber


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

PostPosted: Thu Aug 20, 2020 11:16 am    Post subject: Reply with quote

Don't know why you need to issue the whois since you already got the host in the flud proc, but why not move the unset in the flud:gline proc and with a if you can also make sure you don't punish innocent people.
_________________
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: Thu Aug 20, 2020 12:12 pm    Post subject: Reply with quote

Sorry, but the flud proc only have the cloacked IP, you have to do a whois to get the real IP and then be able to gline/gzline.
_________________
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
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Thu Aug 20, 2020 6:16 pm    Post subject: Reply with quote

Thanks CrazyCat! i'll go test it to be sure, and report back

*salute*
_________________
ComputerTech


Last edited by ComputerTech on Mon May 17, 2021 8:24 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Thu Aug 20, 2020 6:19 pm    Post subject: Reply with quote

So just to be sure, if i want to add more options do i do it like this?

Code:

 proc flud:ban { n u h t c } {
      if {(![info exists ::badguy::bad($u)])} { set ::badguy::bad($u) 0 }
      incr ::badguy::bad($u)
      switch $::badguy::bad($u) {
         1 {
            putquick "privmsg $n :You Are Flooding/Spamming, Please Stop Or You Will Be Network Banned"
         }
         2 {
            putquick "KILL $n Spamming is not allowed on TechNet"
         }
         3 {
             putquick "privmsg $chan :your a sucker, you know that?"
          }

         4 {
            putnow "WHOIS $n"
            unset ::badguy::bad($u)
         }
      }
      return 1
   }


If so, that is super duper awesome Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Fri Aug 21, 2020 2:06 am    Post subject: Reply with quote

Yes, it's exactly the way to add new levels.
_________________
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
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri Aug 21, 2020 9:17 am    Post subject: Reply with quote

Sweeeettt Very Happy

Thanks a lot CrazyCat Very Happy Very Happy Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri Aug 21, 2020 7:28 pm    Post subject: Reply with quote

Is it possible if the bot has snomask +f, and a user exceed's recvq limit, that the bot joins the channel the user exceeded the recvq limit?

Cheers in advanced

Unrealircd 5.0.5.1

Anope 2.0.7
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Sat Aug 22, 2020 9:23 am    Post subject: Reply with quote

no not possible cause it cannot determine the channel
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat Aug 22, 2020 9:51 am    Post subject: Reply with quote

Hmm, i guessed that, what of the notice or excessive flood, can it be noticed to a particular channel?
for example

Excessive Flood by guest123

on #test

Guest123 did Excessive Flood

that possible?

to catch the notice, and project to a specified channel
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
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