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.

Chanops Nick Abuse

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

Chanops Nick Abuse

Post by simo »

greetz folks,

i was trying out this small code to check for nicks joining channel and nick changes to check if joining nick or nick change has chanops nick in it and i was wondering if this is the best way to do it or is there another way not to have to loop each time a nick joins or changes nick ?

here is what we work with :

Code: Select all


bind nick - * Chanops-Nick-Abuse

proc Chanops-Nick-Abuse {nick uhost hand chan newnick} {
    Chanops-Join-Abuse $newnick $uhost $hand $chan
}




bind join - * Chanops-Join-Abuse

proc Chanops-Join-Abuse {nick uhost hand chan} {
   if {[isbotnick $nick]} return
   set userList [chanlist $chan]
   foreach user  $userList {
      if {[isop $user $chan] || [ishalfop $user $chan] } {
         set length [string length $user]
         set bdnickpart [wildcard $user]
         regsub -all {\*{1,}} $bdnickpart "*" bdnickpart
         if {[string match -nocase "$bdnickpart" $nick] && $length > 5} {
            pushmode $chan +b *$user?*!*@*
            pushmode $chan +b *?$user*!*@*
            regsub -all -- ~ $uhost "" uhost
            if {[string match -nocase "*@*irccloud*" [maskhost $nick!$uhost 2]]} {
               set ident  "[lindex [split $uhost @] 0]"
               set xbmaskx "[string map {sid id uid id} $ident]"
               set bmask  "*[string tolower $xbmaskx ]@*"
               pushmode $chan +b $bmask
            } else {
               set bmask "[maskhost $nick!$uhost 2]"   
               pushmode $chan +b $bmask
            }
            putquick "kick $chan $nick « -- Please Dont Impersonate/Abuse Chanop Nicks Thank You.... -- »"
            break
         }
      }
      flushmode $chan
   }
}
 
proc wildcard {text} {
   set sep {*}
   set reg $sep
   for {set i 0} {$i<=[string length $text]} {incr i} {
      append reg [string index $text $i]$sep
   }
   return $reg
}



the chanops nicks we check using xbn2regx process as some try to hide chanops nicks in an abbussive nick like:
c_hano|-ps


and such
Last edited by simo on Mon Apr 10, 2023 4:58 am, edited 9 times in total.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Basically what I lm asking is will the constant loop through chanlist to find chanops to compare to the joining nick have bad effect on performance and if so is there a better way to achieve the same result without loss of performance?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Those two binds (nick and join) should be more than enough to cover your needs, without the loop over chanlist every time someone joins. Makes no sense really.

Not to mention the code is poorly formatted.. here's a better look to follow things more easily.

Code: Select all

proc Xchanop:nick-checkerX {nick uhost hand chan} {
	if {[isbotnick $nick]} return
	set userList [chanlist $chan]
	foreach user  $userList {
		if {[isop $user $chan] || [ishalfop $user $chan] } {
			set length [string length $user]
			set bdnickpart [xbn2regx $user]
			regsub -all {\*{1,}} $bdnickpart "*" bdnickpart
			if {[string match -nocase "$bdnickpart" $nick] && $length > 5} {
				pushmode $chan +b $user?*!*@*
				pushmode $chan +b *?$user!*@*
				regsub -all -- ~ $uhost "" uhost
				if {[string match -nocase "*@*irccloud*" [maskhost $nick!$uhost 2]]} {
					set ident  "[lindex [split $uhost @] 0]"
					set xbmaskx "[string map {sid id uid id} $ident]"
					set bmask  "*[string tolower $xbmaskx ]@*"
					pushmode $chan +b $bmask
				} else {
					set bmask "[maskhost $nick!$uhost 2]"
					pushmode $chan +b $bmask
				}
				putquick "kick $chan $nick «--dont-do-that--»"
			}
		}
		flushmode $chan
	}
}
As it stands right now only the op and halfop are checked when a user joins the channel.
Once the game is over, the king and the pawn go back in the same box.
User avatar
CrazyCat
Revered One
Posts: 1296
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

And why not use:

Code: Select all

set userList [chanlist $chan +o|+h]
chanlist can filter on flags
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Thanks for the reply CC and caesar



Caesar: the reason i have to loop throu chanlist to find chanops halfops on each joining nick is because its ops and halfops nicks that get abused who are currently opped and i dont use flags as their IP is dynamic so i cant rely on that



In reaction to your question crazycat is because we wanted to check the actual nicks with a @ or % in the channel
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Caesar :
Those two binds (nick and join) should be more than enough to cover your needs, without the loop over chanlist every time someone joins. Makes no sense really.
how else are we suppose to get the current chanops/halfops in the channel on every join ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

On a bind mode change? I fail to understand what exactly is happening there and what exactly you want to achieve.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

caesar wrote:On a bind mode change? I fail to understand what exactly is happening there and what exactly you want to achieve.
First a bind mode change is not what i used i used a bind join and a bind nick as it's the nicks we want to compare

What we want to achieve is everytime a nick joins or changes nick we want to check it if it has the nick of a chanop/halfop in it (who is currently in the channel and half/opped) wich is mostly used for abuse and if detected to set ban on the abuser and set ban on chanop nick that got abused without getting the actual chanhalf/op banned
User avatar
CrazyCat
Revered One
Posts: 1296
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

And what happens with ghost (often on timeout ?)
Usually the client reconnects with an alternative nick, often a variation of the main nick, while the main is still connected.

You'll ban nick- because it looks like nick ? And nick- is the real op, nick is just a ghost which will disappear in a few seconds.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Thats a good point crazycat i didn't find that the case with most chanops but it may happen once in a long time and if it happens a lot there is something else going on that needs fixing
User avatar
CrazyCat
Revered One
Posts: 1296
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

simo wrote:In reaction to your question crazycat is because we wanted to check the actual nicks with a @ or % in the channel
Read the documentation and the line I put:

Code: Select all

set userList [chanlist $chan +o|+h]
This will restrict the userlist to @ and % users only, that's the same as caesar did, but potentially faster and using less memory.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I didn't do anything, just made his code easier to follow by adding indentations.

I would maintain an active list of the names I want to "protect" via mode change, quit, part, and so on, and upon a regular user joining I would check with that list. I doubt you have 100 names to keep track at any given time, so this approach would be far less memory intensive than looping the entire channel members list for every single trigger by a bind join.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

That would be ideal CrazyCat except some of the chanops dont use a fixed Host
so we dont have anything fixed to use auth them
User avatar
CrazyCat
Revered One
Posts: 1296
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

@caesar : I just said that using the flag filter in chanlist is the same as doing

Code: Select all

set userList [chanlist $chan]
foreach user  $userList {
   if {[isop $user $chan] || [ishalfop $user $chan] } { ... }
}
We just don't filter @ same time

@simo : where the f*ck did I speak about auth ? I was just giving a way to use a reduced userlist. I didn't try to solve your potential ghost trouble.
s
simo
Revered One
Posts: 1106
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Oh ok i guess I misunderstood as i though in the example gave with:.

Code: Select all

set userList [chanlist $chan +o|+h]
I though the +o|+h was flags my mistake

I'll test some more using that.

Thanks,
Post Reply