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!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Give this untested code a try.

Code: Select all

## ircCloudBan v.0.2 ##

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::/48
}

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

proc ircCloudBan {nk uh hn ch md banmask} {
	if {![botisop $ch]} return
	global ircSkip
	set match 0
	foreach host $ircSkip {
		if {![string match -nocase $host $banmask]} 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
	foreach host $ircSkip {
		if {![string match -nocase $host $chhost]} continue
		incr match
		break
	}
	if {$match} {
		lassign [split $chhost "@"] user
		pushmode $ch +b "*!$user@*"
	}
	unset ::irccloudban
}
Honestly I have my doubts this will work with that IPv6 host as I honestly don't know how those look like, but with the others should.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

perhaps we can use the ipv6 like this as well:

2001:67c:2f08*

i havent worked much with ipv6 but i would think using it like that would get all
irccloud ranges

since this part is what the ipv6 ones seem to have in common

2001:67c:2f08*
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested the ipv4 ones dont seem to work only the *.irccloud.com seemed to work not if i set vhost as @irccloud.com tho

havent tested ipv6 one tho as i cant set vhost using ipv6 as i test with using forced vhost as ircop on a testnet i use to test with

didnt get any error either in PL

this is a list of users i gathered their info on dalnet with options of irccloud servers used
sid192210@2001:67c:2f08:4::2:eed2
  sid303781@2001:67c:2f08:3::4:a2a5
  sid50703@2001:67c:2f08:5::c60f
  sid95262@highgate.irccloud.com
  uid122185@id-122185.hathersage.irccloud.com
  uid131084@id-131084.hathersage.irccloud.com
  uid135215@tooting.irccloud.com
  uid157056@id-157056.ealing.irccloud.com
  uid167562@id-167562.highgate.irccloud.com
  uid170024@id-170024.stonehaven.irccloud.com
  uid186764@id-186764.charlton.irccloud.com
  uid192191@id-192191.hathersage.irccloud.com
  uid192874@id-192874.stonehaven.irccloud.com
  uid199235@id-199235.tooting.irccloud.com
  uid209231@id-209231.ealing.irccloud.com
  uid233980@id-233980.stonehaven.irccloud.com
  uid245991@192.184.10.9
  uid254440@id-254440.stonehaven.irccloud.com
  uid257218@192.184.10.9
  uid304780@id-304780.charlton.irccloud.com
  uid306017@id-306017.charlton.irccloud.com
  uid306280@2001:67c:2f08:8::4:ac68
  uid306373@2001:67c:2f08:3::4:acc5
  uid306470@2001:67c:2f08:8::4:ad26
  uid59776@id-59776.charlton.irccloud.com
  uid63826@id-63826.tooting.irccloud.com
  ~sid154238@2001:67c:2f08:1::2:5a7e
  ~sid50703@2001:67c:2f08:5::c60f
  ~uid112933@hathersage.irccloud.com
  ~uid139993@id-139993.ealing.irccloud.com
  ~uid140561@id-140561.brockwell.irccloud.com
  ~uid16153@id-16153.ealing.irccloud.com
  ~uid167284@id-167284.charlton.irccloud.com
  ~uid204847@id-204847.ealing.irccloud.com
  ~uid215886@charlton.irccloud.com
  ~uid225090@id-225090.ealing.irccloud.com
uid257218@192.184.10.9
  uid304780@id-304780.charlton.irccloud.com
  uid306017@id-306017.charlton.irccloud.com
  uid306280@2001:67c:2f08:8::4:ac68
  uid306373@2001:67c:2f08:3::4:acc5
  uid306470@2001:67c:2f08:8::4:ad26
  uid59776@id-59776.charlton.irccloud.com
  uid63826@id-63826.tooting.irccloud.com
  ~sid154238@2001:67c:2f08:1::2:5a7e
  ~sid50703@2001:67c:2f08:5::c60f
  ~uid112933@hathersage.irccloud.com
  ~uid139993@id-139993.ealing.irccloud.com
  ~uid140561@id-140561.brockwell.irccloud.com
  ~uid16153@id-16153.ealing.irccloud.com
  ~uid167284@id-167284.charlton.irccloud.com
  ~uid204847@id-204847.ealing.irccloud.com
  ~uid215886@charlton.irccloud.com
  ~uid225090@id-225090.ealing.irccloud.com
  ~uid236624@id-236624.stonehaven.irccloud.com
  ~uid270310@id-270310.ealing.irccloud.com
  ~uid275550@id-275550.charlton.irccloud.com
  ~uid286964@id-286964.hathersage.irccloud.com
  ~uid288785@id-288785.hathersage.irccloud.com
  ~uid294417@id-294417.hathersage.irccloud.com
  ~uid298989@2001:67c:2f08:3::4:8fed
  ~uid299144@2001:67c:2f08:8::4:9088
  ~uid301571@stonehaven.irccloud.com
  ~uid305805@2001:67c:2f08:8::4:aa8d
  ~uid305810@2001:67c:2f08:8::4:aa92
  ~uid305923@2001:67c:2f08:8::4:ab03
  ~uid305989@2001:67c:2f08:8::4:ab45
  ~uid306055@id-306055.stonehaven.irccloud.com
  ~uid306104@id-306104.charlton.irccloud.com
  ~uid306735@charlton.irccloud.com
  ~uid80616@id-80616.tooting.irccloud.com
  ~uid89398@id-89398.brockwell.irccloud.com

it seems they dont use @irccloud.com no more for their users but i believe we should use it in case
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Yeah, I'm an idiot cos should have foreseen this issue. :roll:

Anyway, there are two easy fixes for this problem:

1. make them in the nick!user@host format, for example:

Code: Select all

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
}
2. Leave $ircSkip as is and above:

Code: Select all

foreach host $ircSkip {
add:

Code: Select all

scan $banmask {%[^!]!%[^@]@%s} n u h
and then replace:

Code: Select all

if {![string match -nocase $host $banmask]} continue 
with this:

Code: Select all

if {![string match -nocase $host $h]} continue 
As for IPv6 I think it needs some testing with matchcidr if you plan to use something like 2001:67c:2f08::/48. It should also be in a different list and have it's own loop.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

changed it and tested again with ipv4 didnt trigger and no errors

this is what i got so far:

Code: Select all

## ircCloudBan v.0.2 ## 

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* 
}  



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 
   foreach host $ircSkip { 
      if {![string match -nocase $host $chhost]} continue 
      incr match 
      break 
   } 
   if {$match} { 
      lassign [split $chhost "@"] user 
      pushmode $ch +b "*!$user@*" 
   } 
   unset ::irccloudban 
} 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I gave you two methods and you combined the two instead of picking just one. Guess I haven't been very clear. Sorry. Anyway, set ircSkip back to how it was:

Code: Select all

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
} 
and this should work.

Oh, and you should make the same changes to ircCloudKick as well in order to work like it dose for bans (ircCloudBan)
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

so using scan $banmask {%[^!]!%[^@]@%s} n u h
as well for the kick part ?

but kick proc doesnt have banmask right ?
im a bit lost here

i tried this but didnt seem to do it:

Code: Select all

## ircCloudBan v.0.2 ## 

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* 
}  



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 
   scan $chhost {%[^!]!%[^@]@%s} n u h 
   foreach host $ircSkip { 
      if {![string match -nocase $host $h]} continue 
      incr match 
      break 
   } 
   if {$match} { 
      lassign [split $chhost "@"] user 
      pushmode $ch +b "*!$user@*" 
   } 
   unset ::irccloudban 
} 

it removes ban but doesnt set ident ban
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried again with this and it only removes ban it doesnt set ident ban either

Code: Select all

## ircCloudBan v.0.2 ## 

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* 
}

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 
   scan $chhost {%[^!]!%[^@]@%s} nk uh ch 
   foreach host $ircSkip { 
      if {![string match -nocase $host $chhost]} continue 
      incr match 
      break 
   } 
   if {$match} { 
      lassign [split $chhost "@"] user 
      pushmode $ch +b "*!$user@*" 
   } 
   unset ::irccloudban 
} 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Inside ircCloudKick correct your lines:

Code: Select all

scan $chhost {%[^!]!%[^@]@%s} n u h
and:

Code: Select all

if {![string match -nocase $host $h]} continue 
And you can change this:

Code: Select all

lassign [split $chhost "@"] user 
pushmode $ch +b "*!$user@*" 
to:

Code: Select all

pushmode $ch +b "*!$u@*" 
I left those n, u and h as variables for a reason.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

at first i kept em like that and it didnt trigger at all and kept complaining about cant read h
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this is what i got so far:

and it returns this error:

Tcl error [ircCloudKick]: can't read "h": no such variable

Code: Select all

## ircCloudBan v.0.2 ## 

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* 
}  



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 
   scan $chhost {%[^!]!%[^@]@%s} n u h
   foreach host $ircSkip { 
    if {![string match -nocase $host $h]} continue 
      incr match 
      break 
   } 
   if {$match} { 
     pushmode $ch +b "*!$u@*" 
   } 
   unset ::irccloudban 
} 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

*facepalm* That's because getchanhost doesn't return a nick. I forgot. Just replace:

Code: Select all

scan $chhost {%[^!]!%[^@]@%s} n u h 
with:

Code: Select all

scan $chhost {%[^@]@%s} u h 
and should work fine.

Or even better replace it with:

Code: Select all

if {[scan $chhost {%[^@]@%s} u h] != 2} return
cos if the nickname is not on the channel then "" is returned and will throw another error. Better safe than sorry, no? :)
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

that seems to do it , excellent

did various tests seems to work fine

thanx caesar much apreciated
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

currently on this code or spike code, when a user bans the ip the eggdrop unbans it but doesnt set ban on the ident, it only bans the ident when a kick is excuted, can we make it ban the ident the moment someone places a ban on ircloud? refer below for some example.

bot1 sets mode: +b *!*@id-2136d76.hathersage.irccloud.com
bot2 sets mode: -b *!*@id-2136d76.hathersage.irccloud.com

do note bot2 has this tcl loaded, it bans unbans the ban but doesnt sets the ident ban. only places ident ban when a kick is excuted.

can we fix tis tks
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Sure, above:

Code: Select all

set ::irccloudban $banmask 
just add:

Code: Select all

pushmode $ch +b "*!$u@*"
It's simple as that. ;)

And the -b and +b should be set in one line, if it doesn't then you can replace the two pushmode lines with a single one:

Code: Select all

puthelp "MODE $ch -b+b $banmask *!$u@*"
Once the game is over, the king and the pawn go back in the same box.
Post Reply