View previous topic :: View next topic |
Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Tue Jun 26, 2018 1:10 am Post subject: |
|
|
Give this untested code a try.
Code: |
## 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. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Thu Jun 28, 2018 9:58 am Post subject: |
|
|
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* |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Thu Jun 28, 2018 10:07 am Post subject: |
|
|
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
it seems they dont use @irccloud.com no more for their users but i believe we should use it in case |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Fri Jun 29, 2018 1:31 am Post subject: |
|
|
Yeah, I'm an idiot cos should have foreseen this issue.
Anyway, there are two easy fixes for this problem:
1. make them in the nick!user@host format, for example:
Code: |
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: |
foreach host $ircSkip {
|
add:
Code: |
scan $banmask {%[^!]!%[^@]@%s} n u h
|
and then replace:
Code: |
if {![string match -nocase $host $banmask]} continue
|
with this:
Code: |
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. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Fri Jun 29, 2018 2:20 pm Post subject: |
|
|
changed it and tested again with ipv4 didnt trigger and no errors
this is what i got so far:
Code: | ## 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
}
|
|
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Sat Jun 30, 2018 2:02 am Post subject: |
|
|
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: |
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. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sat Jun 30, 2018 6:30 am Post subject: |
|
|
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: | ## 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 |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sat Jun 30, 2018 6:54 am Post subject: |
|
|
i tried again with this and it only removes ban it doesnt set ident ban either
Code: | ## 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
}
|
|
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Sat Jun 30, 2018 9:05 am Post subject: |
|
|
Inside ircCloudKick correct your lines:
Code: |
scan $chhost {%[^!]!%[^@]@%s} n u h
|
and:
Code: |
if {![string match -nocase $host $h]} continue
|
And you can change this:
Code: |
lassign [split $chhost "@"] user
pushmode $ch +b "*!$user@*"
|
to:
Code: |
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. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sat Jun 30, 2018 9:11 am Post subject: |
|
|
at first i kept em like that and it didnt trigger at all and kept complaining about cant read h |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sun Jul 01, 2018 9:33 am Post subject: |
|
|
this is what i got so far:
and it returns this error:
Tcl error [ircCloudKick]: can't read "h": no such variable
Code: | ## 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
}
|
|
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Sun Jul 01, 2018 2:02 pm Post subject: |
|
|
*facepalm* That's because getchanhost doesn't return a nick. I forgot. Just replace:
Code: |
scan $chhost {%[^!]!%[^@]@%s} n u h
|
with:
Code: |
scan $chhost {%[^@]@%s} u h
|
and should work fine.
Or even better replace it with:
Code: |
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. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Mon Jul 02, 2018 9:35 am Post subject: |
|
|
that seems to do it , excellent
did various tests seems to work fine
thanx caesar much apreciated |
|
Back to top |
|
 |
gamble27 Halfop
Joined: 05 Aug 2008 Posts: 71
|
Posted: Tue Jul 17, 2018 4:39 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Wed Jul 18, 2018 12:48 am Post subject: |
|
|
Sure, above:
Code: |
set ::irccloudban $banmask
|
just add:
Code: |
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: |
puthelp "MODE $ch -b+b $banmask *!$u@*"
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
|