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

irccloud banmask

Post by simo »

Greetings,
i was wondering if banmask could be made for irccloud users

for example if someone sets a ban on an irccloud user to have eggdrop correct it

also if eggdrop sets a ban on an irccloud user to set on ident

like these examples:
@Alvira Sets Mode on #Test to: +b *!id-293766@id-293766.tooting.irccloud.com
Amigo Kicked from #Test By @Alvira
@simo Sets Mode on #Test to: -b *!id-293766@id-293766.tooting.irccloud.com
@simo Sets Mode on #Test to: +b *!id-293766@*

@Alvira Sets Mode on #Test to: +b *!*@*.irccloud.com
@simo Sets Mode on #Test to: -b *!*@*.irccloud.com
@simo Sets Mode on #Test to: +b *!id-293766@*

@Alvira Sets Mode on #Test to: +b *!*@*.tooting.irccloud.com
@simo Sets Mode on #Test to: -b *!*@*.tooting.irccloud.com
@simo Sets Mode on #Test to: +b *!id-293766@*

@Alvira Sets Mode on #Test to: +b Amigo!id-293766@id-293766.tooting.irccloud.com
Amigo Kicked from #Test By @Alvira
@simo Sets Mode on #Test to: -b Amigo!id-293766@id-293766.tooting.irccloud.com
@simo Sets Mode on #Test to: +b *!id-293766@*

@Alvira Sets Mode on #Test to: +b *!id-293766@id-293766.tooting.irccloud.com
Amigo Kicked from #Test By @Alvira
@simo Sets Mode on #Test to: -b *!id-293766@id-293766.tooting.irccloud.com
@simo Sets Mode on #Test to: +b *!id-293766@*

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

Post by caesar »

Code: Select all

bind mode - "#% +b" ircCloud

proc ircCloud {nick uhost hand chan mod ban} {
	if {![botisop $chan]} return
	if {![string match -nocase "*.irccloud.com" $ban]} return
	scan $ban {%[^!]!%[^@]@%s} n u h
	puthelp "MODE $chan -b+b $ban *!$u@*"
}
Haven't tested this so give it a try and reply back.
Last edited by caesar on Thu Apr 19, 2018 12:43 am, edited 1 time in total.
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 »

tnx for the reply caesar

the botisisop seems off i corrected that and got this:

simo Sets Mode on #Cappuccino to: +b *!*@id-180354.highgate.irccloud.com
@Cappuccino Sets Mode on #Cappuccino to: -b+b *!*@id-180354.highgate.irccloud.com *!*@*
in msl i use the kick event to get nick ident host of the kicked irccloud user

im not sure if eggdrop would need that as well to get full info nick!user@host
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ah, my bad. Give this a try:

Code: Select all

proc ircCloud {nick uhost hand chan mod ban} {
	if {![botisop $chan]} return
	if {![string match -nocase "*.irccloud.com" $ban]} return
	set id [lindex [split [lindex [split $ban @] 1] .] 0]
	if {[string match "id-*" $id]} {
		pushmode $chan +b *!$id@*
	}
	pushmode $chan -b $ban
}
Keep in mind that this will work on bans that have the id in the address, for example: *!*@id-180354.highgate.irccloud.com or Amigo!id-293766@id-293766.tooting.irccloud.com but won't work on *!*@*.tooting.irccloud.com or *!*@*.irccloud.com for instance, it will just lift the ban.

In case of wide ones like *!*@*.tooting.irccloud.com or *!*@*.irccloud.com would have to add extra code that would find what users match the ban and from there get their id.
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 »

well since there are various irccloud servers we need them all else it wouldnt be as effective so we would need all available paterns ( and possibly IPs to check against as well )
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

If you set a ban on *!*@*.irccloud.com how many users would be affected by this? You should set more restrictive bans and not wide ones like this one cos then if let's say you have 10 people with irccloud.com on their address then the bot would remove the *!*@*.irccloud.com ban and set 10 bans for each of the 10 id's it would find, basically filling the banlist.

Anyway, if you insist into adding this behavior then give try this and let me know if works or not:

Code: Select all

proc ircCloud {nick uhost hand chan mod ban} {
	if {![botisop $chan]} return
	if {![string match -nocase "*.irccloud.com" $ban]} return
	set id [lindex [split [lindex [split $ban @] 1] .] 0]
	if {[string match "id-*" $id]} {
		pushmode $chan +b *!$id@*
	} else {
		foreach user [chanlist $chan] {
			if {[isbotnick $user]} continue
			if {[isop $user $chan] || [isvoice $user $chan] || [validuser [nick2hand $user]]} continue
			set host [getchanhost $user $chan]
			if {[matchaddr $ban $host]} {
				scan $host {%[^!]!%[^@]@%s} n u h
				lappend myList "*!$u@*"
			}
		}
		if {[info exists $myList]} {
			set len [llength $myList]
			set max 6
			while {$len > 0} {
				if {$len > $max} {
					set mode [string repeat "b" $max]
					set bans [join [lrange $myList 0 [expr {$max - 1}]]]
					set myList [lrange $myList $max end]
					incr len -$max
				} else {
					set mode [string repeat "b" $len]
					set bans [join $myList]
					set len 0
				}
				puthelp "MODE $chan -$mode $bans"
			}
		}
	}
	pushmode $chan -b $ban
}
It should remove bans set like *!id-293766@id-293766.tooting.irccloud.com or Amigo!id-293766@id-293766.tooting.irccloud.com and set them on id instead, and if you set a ban like *!*@*.irccloud.com will search for all members that match that ban and set a ban on their id instead. At least in theory. :)
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 »

It should remove bans set like *!id-293766@id-293766.tooting.irccloud.com or Amigo!id-293766@id-293766.tooting.irccloud.com and set them on id instead, and if you set a ban like *!*@*.irccloud.com will search for all members that match that ban and set a ban on their id instead. At least in theory. Smile
this is the reason i used kick event in msl to determine the ident of kickbanned irccloud user, im not sure how to use that in eggdrop

this seems to work in msl im not sure how to translate to tcl:

Code: Select all

ON ^*:KICK:#: {
  haltdef
  if (%ircloudnick == on) { 
    var %irccloudbanmazk = 1
    while ($chan(%irccloudbanmazk))  {
      var %ircloudChan $ifmatch
      if ($nick(%ircloudChan,$me,@&~%)) {  mode $chan +b $+(*!,$gettok($mid($address($knick,0),3),1,64),@*)    }
      inc %irccloudbanmazk
    } 
    unset  %ircloudnick 
  } 
}


On *:BAN:#:{ 
  if ($nick(#,$me,@%&~)) { 
    if ($regex($banmask,/(irccloud)/i)) {  mode  $chan -b $banmask  | set  %ircloudnick on }
  }
}
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Give a try to the code I posted above. In theory should do what you say in msl.
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 and it doesnt seem to trigger on +b *!*@*.irccloud.com

also i get this weird result where it sets ban and takes part of host and uses as ident ban
16:52:14 simo Sets Mode on #testing to: +b *!uid19739@id-19739.tooting.irccloud.com
16:52:14 (1 User) is Banned (1) Blackwood
16:52:14 Blackwood Kicked from #testing By simo ( banned!!! )
16:52:15 @Cappuccino Sets Mode on #testing to: -b+b *!uid19739@id-19739.tooting.irccloud.com *!id-19739@*
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Not triggering on *!*@*.irccloud.com is something will have to properly test. As for the weird behavior, it's actually normal. For some reason I was under the impression the id in hostname is what you wanted to ban in the first place. Will correct this as well tomorrow.
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 »

tnx caesar
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

ircCloudBan v.0.1

Post by SpiKe^^ »

Hey simo,

I tried a direct translation of your msl, line for line, as best as I can understand the msl code.

This script tries to preserve the sequence-of-events and work-flow of the original msl code.

I did not address any of the possible issues I saw in the msl scripts theory.

Code: Select all

## ircCloudBan v.0.1 ##

bind mode - "#% +b" ircCloudBan

proc ircCloudBan {nk uh hn ch md banmask} {
  if {![botisop $ch]} return
  if {![string match -nocase "*.irccloud.com" $banmask]} return

  pushmode $ch -b $banmask  ;  set ::irccloudban $banmask
}


bind kick - * ircCloudKick

proc ircCloudKick {nk uh hn ch target why} {
  if {![info exists ::irccloudban]} return

  if {[botisop $ch]} {
    set chhost [getchanhost $target $ch]
    if {[string match -nocase "*.irccloud.com" $chhost]} {
      lassign [split $chhost "@"] user
      pushmode $ch +b "*!$user@*"
    }
  }

  unset ::irccloudban
}

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

hey there SpiKe^^

i tried it and and tested it looks to work smooth so far tried various paterns and all seems working as desired excellent thx ones again.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i would like to thank caesar as well much apreciated as always caesar ... cheers
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i noticed on dalnet irccloud users connect with ip as well if for some reason ip doesnt resolve to dns

i wonder if these ips could be integrated as well

ipv4:
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.103

ipv6:
2001:67c:2f08::/48
Post Reply