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.

irccloud banmask

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

did as you told me to, results returned:
[19:08] * Joins: OnT (uid1420156@id-140156.ealing.irccloud.com)
[19:10] * user1 sets mode: +b *!*@id-140156.ealing.irccloud.com
[19:10] * eggdrop1 sets mode: -b+b *!*@id-140156.ealing.irccloud.com *!*@*
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ah! My bad, it takes the ident from ban that is set (in your case it's *), hence the result. Instead of the previously suggested:

Code: Select all

pushmode $ch +b "*!$u@*" 
make it:

Code: Select all

foreach user [chanlist $ch] {
	if {[isbotnick $user]} continue
    if {[isop $user $ch] || [isvoice $user $ch] || [validuser [nick2hand $user]]} continue
	scan [getchanhost $user $ch] {%[^@]@%s} uid host
	if {[string equal $h $host]} {
		pushmode $ch +b "*!$uid@*"
	}
}
This way will set a ban for all idents that match that host with the exception of channel operators or voiced and known users. Give this a try and reply back.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

This way will set a ban for all idents that match that host with the exception of channel operators or voiced and known users. Give this a try and reply back.
the only problem with that tho is if multi users match the same host wich is in the case of users with hosts like:

*!*@highgate.irccloud.com
*!*@brockwell.irccloud.com

and bans like *!*@*.irccloud.com are set
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Exactly:) There is no way for an eggdrop bot, or anyone for that matter, to tell which user that bad banmask was set to ban.

It matches TWO users. Hire better ops and fire anyone that can't set a proper ban.

How do you expect the bot to remove the intended user, and not also the other 4 persons matching that ban mask?
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

In case of a flood from bots with same host in order to mitigate the flood I would set a wide ban for a while, but placing wide ones like *!*@*.irccloud.com on a daily basis is just plain stupidity.

Let's say you place that *!*@*.irccloud.com ban, if you got enforcebans set on a channel the bot it will kick all members matching that mask anyway, else if a user that matches the ban can't leave and rejoin the channel.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

what could be added is if the set banmask has [su]id in it to use as criteria and to check that against the banlist and user if matching.
Let's say you place that *!*@*.irccloud.com ban, if you got enforcebans set on a channel the bot it will kick all members matching that mask anyway, else if a user that matches the ban can't leave and rejoin the channel.
enforceban tcl shouldnt be used in this case as it will ban any matching

and these kind of banmasks are regular ones as default bans are *!*@host common used by most clients and by services
*!*@highgate.irccloud.com
*!*@brockwell.irccloud.com
hiring other ops wont change that
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

From IRCCloud Networks page I quote:
Identifying users

Each user can be uniquely identified for the purpose of bans, etc. by their ident-verified username, in the form [u|s]id[UID] (eg: uid123 for a free user or sid456 for a paid subscriber). Users are unable to change their user IDs.
In your example:

Code: Select all

[19:08] * Joins: OnT (uid1420156@id-140156.ealing.irccloud.com)
[19:10] * user1 sets mode: +b *!*@id-140156.ealing.irccloud.com 
the uid1420156 is their ident-verified username, but then the id-xxx part in his host doesn't match this ident (different numbers, at least in this example, I looked at 2-3 from previous post and seem to match).

To fix the first suggested code (prevent setting bans on *!*@* if there's no ident in the ban that was just set) try this:

Code: Select all

if {[regexp {\d+} $u x]} {
	if {[regexp {id-(\d+).(.*?).irccloud.com} $h - y]} {
		if {[string equal $x $y]} {
			pushmode $ch +b "*!$u@*"
		}
	}	
}
Ban set -> what will happen

*!*@id-140156.ealing.irccloud.com -> nothing

*!uid1420156@id-140156.ealing.irccloud.com -> nothing because the two numbers don't match (1420156 vs. 140156)

*!uid140156@ealing.irccloud.com -> nothing because there's no number in the hostname

*!uid140156@id-140156.ealing.irccloud.com -> will place a ban on *!uid140156@*

If the ban doesn't have a valid ident or the two numbers don't match then a channel operator will have to fix the ban manually.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested it with

+b *!*@*.charlton.irccloud.com

while the users actuall host is:

uid310365@id-310365.charlton.irccloud.com

and it still sets:

-b+b *!*@*.charlton.irccloud.com *!uid310365@*

and since there many users with host *!*@charlton.irccloud.com it will get them as well


using this:

Code: Select all

## ircCloudBan v.0.2 ## 

set ircSkip { 
   *.irccloud.com 
     irccloud.com 
   192.184.9.108 
   192.184.9.110 
   192.184.9.112 
   192.184.10.118 
   192.184.10.9 
   192.184.8.73 
   192.184.8.10 
   2001:67c:2f08* 
   2001*67c*2f08*
}  



bind mode - "#% +b" ircCloudBan 
bind kick - * ircCloudKick 

proc ircCloudBan {nk uh hn ch md banmask} { 
   if {![botisop $ch]} return 
   global ircSkip 
   set match 0 
  scan $banmask {%[^!]!%[^@]@%s} n u h 
   foreach host $ircSkip { 
    if {![string match -nocase $host $h]} continue
      incr match 
      break 
   } 
   if {$match} { 
      pushmode $ch -b $banmask 
      set ::irccloudban $banmask 
   } 
} 

proc ircCloudKick {nk uh hn ch target why} { 
   if {![info exists ::irccloudban]} return 
   if {![botisop $ch]} return 
   set chhost [getchanhost $target $ch] 
   global ircSkip 
   set match 0 
  if {[scan $chhost {%[^@]@%s} u h] != 2} return 
   foreach host $ircSkip { 
    if {![string match -nocase $host $h]} continue 
      incr match 
      break 
   } 
   if {$match} { 
if {[regexp {\d+} $u x]} { 
   if {[regexp {id-(\d+).(.*?).irccloud.com} $h - y]} { 
      if {[string equal $x $y]} { 
         pushmode $ch +b "*!$u@*" 
      } 
   }    
 }    
} 
   unset ::irccloudban 
} 
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Honestly I don't understand what you are trying to say. Is it working as you wanted or not?
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

did some more testing seems fine caesar it executes all well

thanx again job well done once again

apreciated as always.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

This piece of code:

Code: Select all

if {[regexp {\d+} $u x]} {
	if {[regexp {id-(\d+).(.*?).irccloud.com} $h - y]} {
		if {[string equal $x $y]} {
			pushmode $ch +b "*!$u@*"
		}
	}   
}
was intended to be put inside ircCloudBan before/after the

Code: Select all

pushmode $ch -b $banmask
and not inside ircCloudKick because the:

Code: Select all

if {$match} {
	pushmode $ch +b "*!$u@*"
}
is more than enough to do the intended job, as it grabs the nick!user@host from the trigger when a member just got kicked (where nick, user and host will always hold a value), unlike in the ban part where the nick!user@host is taken from what a channel operator sets (where nick, user and host won't always hold a value and can be * for instance).

If you want to adjust the second part to make sure you got an uid123456 or sid123456 format in the user part then make it:

Code: Select all

if {$match} {
	if {[regexp {[su]id\d+} $u]} {
		pushmode $ch +b "*!$u@*"
	}
}
Basically this ensures that it will set a ban on *!uid306017@* from uid306017@id-306017.charlton.irccloud.com, *!~sid154238@* from ~sid154238@2001:67c:2f08:1::2:5a7e, but won't set a ban on *!aid123456@* from aid123456@something.fake.irccloud.com for example.

In the example you gave:
[19:08] * Joins: OnT (uid1420156@id-140156.ealing.irccloud.com)
[19:10] * user1 sets mode: +b *!*@id-140156.ealing.irccloud.com
When the *!*@id-140156.ealing.irccloud.com ban is set the bot will check if ident has a number in it, in our case will fail because * is not a number thus will stop.

Only if OnT is kicked then the bot would do the actual replacing the *!*@id-140156.ealing.irccloud.com ban with *!uid1420156@* inside the kick function because it grabs the actual ident from the kick trigger and it matches the given pattern.

Final code:

Code: Select all

## ircCloudBan v.0.3 ##

set ircSkip {
	*.irccloud.com
	192.184.9.108
	192.184.9.110
	192.184.9.112
	192.184.10.118
	192.184.10.9
	192.184.8.73
	192.184.8.10
	2001:67c:2f08*
	2001*67c*2f08*
} 


bind mode - "#% +b" ircCloudBan
bind kick - * ircCloudKick

proc ircCloudBan {nk uh hn ch md banmask} {
	if {![botisop $ch]} return
	global ircSkip
	set match 0
	scan $banmask {%[^!]!%[^@]@%s} n u h
	foreach host $ircSkip {
		if {![string match -nocase $host $h]} continue
		incr match
		break
	}
	if {$match} {
		pushmode $ch -b $banmask
		if {[regexp {\d+} $u x]} {
		   if {[regexp {id-(\d+).(.*?).irccloud.com} $h - y]} {
			  if {[string equal $x $y]} {
				 pushmode $ch +b "*!$u@*"
			  }
		   }   
		}
		set ::irccloudban $banmask
	}
}

proc ircCloudKick {nk uh hn ch target why} {
	if {![info exists ::irccloudban]} return
	if {![botisop $ch]} return
	set chhost [getchanhost $target $ch]
	global ircSkip
	set match 0
	if {[scan $chhost {%[^@]@%s} u h] != 2} return
	foreach host $ircSkip {
		if {![string match -nocase $host $h]} continue
		incr match
		break
	}
	if {$match} {
	   if {[regexp {[su]id\d+} $u]} {
		  pushmode $ch +b "*!$u@*"
	   }
	}
   unset ::irccloudban
}
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested final code and it seems it sets ident ban on a banmask like


simo sets Mode on #Cappuccino to: +b *!*@*.irccloud.com
@Cappuccino Sets Mode on #Cappuccino to: -b+b *!*@*.irccloud.com *!uid311697@*

simo Sets Mode on #Cappuccino to: +b *!*@charlton.irccloud.com
@Cappuccino Sets Mode on #Cappuccino to: -b+b *!*@charlton.irccloud.com *!uid311697@*


while banmasks doesnt have any id in it
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Your results doesn't make any sense because the first regexp in the ircCloudBan function should return 0 because there's no number in the ident so most likely you got some older code. Should restart the bot so things are re-loaded as should.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

the results i got was from using the final code u posted

and i always restart bot after loading new code and disabling old
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I loaded the code I posted and here are my results.

Case #1: there's no user in the ban, so nothing happens (it stops at first regexp)

Code: Select all

[08:51] * cez sets mode: +b *!*@charlton.irccloud.com
[08:51] * Bot sets mode: -b *!*@charlton.irccloud.com
Case #2: we got an user but the host doesn't match the pattern, meaning it doesn't have an id-xxx.something.irccloud.com in it.

Code: Select all

[08:52] * cez sets mode: +b *!uid311697@charlton.irccloud.com
[08:52] * Bot sets mode: -b *!uid311697@charlton.irccloud.com
Case #3: the user and host match the patterns and the two numbers are equal so the bot sets a ban on user instead (*!uid306017@*)

Code: Select all

[08:53] * cez sets mode: +b *!uid306017@id-306017.charlton.irccloud.com
[08:53] * Bot sets mode: -b+b *!uid306017@id-306017.charlton.irccloud.com *!uid306017@*
Case #4: the user and host match the patterns BUT the two numbers aren't equal so nothing happens.

Code: Select all

[08:53] * cez sets mode: -b *!uid306017@*
[08:53] * cez sets mode: +b *!uid306017@id-306018.charlton.irccloud.com
[08:53] * Bot sets mode: -b *!uid306017@id-306018.charlton.irccloud.com
I can't test with a kick but I'm sure it works as expected.
Once the game is over, the king and the pawn go back in the same box.
Post Reply