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.

cloud ip remove ident ban

Help for those learning Tcl or writing their own scripts.
Post Reply
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

cloud ip remove ident ban

Post by F|irT »

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
}
this is what i am using got from this site ... i need some help on it .

when i ban cloud ip then bots remove the ban . but did not set the ident ban .

Exp:
[09:04] * F|irT sets mode: +b *!*@id-246043.stonehaven.irccloud.com
[09:04] * NoNSt0p sets mode: -b *!*@id-246043.stonehaven.irccloud.com
[09:09] * F|irT sets mode: +b *!*@id-338795.brockwell.irccloud.com
[09:09] * NoNSt0p sets mode: -b *!*@id-338795.brockwell.irccloud.com
[09:09] * F|irT sets mode: +b *!*@id-169916.brockwell.irccloud.com
[09:09] * NoNSt0p sets mode: -b *!*@id-169916.brockwell.irccloud.com

but in kick ban it works good
exp:
[09:11] * F|irT sets mode: +b *!*@id-246043.stonehaven.irccloud.com
[09:11] * Day-Night was kicked by F|irT (F|irT)
[09:11] * NoNSt0p sets mode: -b+b *!*@id-246043.stonehaven.irccloud.com *!uid246043@*

--------------------------------------------------------------
i want when any op ban the cloud ip it does not remove the ban .
of if it can be like remove ip and get ident like it's doing on kick ban .
not doing on simple ban.

hope u underatand.

My English is weak
F|irT
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I see that you took this code from the first page in irccloud banmask discussion but didn't read until last page to see the offered solution that seems to work for simo. Having trouble to understand what is needed to be changed? Here is the final code with all the changes in place:

Code: Select all

## ircCloudBan v.0.4 ##

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 {[su]id\d+} $u]} {
			pushmode $ch +b "*!$u@*"
		} elseif {[regexp {id-(\d+).(.*?).irccloud.com} $h - x]} {
			foreach n [chanlist $ch] {
				if {[isbotnick $n]} continue
				if {[isop $n $ch] || [isvoice $n $ch] || [validuser [nick2hand $n]]} continue
				scan [getchanhost $n $ch] {%[^@]@%s} user host
				if {[regexp {\d+} $user y]} {     
					if {[string equal $x $y]} {
						pushmode $ch +b "*!$user@*"
					}
				}
			}
		}
		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
Stefano1990
Voice
Posts: 25
Joined: Mon Jun 04, 2018 10:07 am
Contact:

Hello

Post by Stefano1990 »

ceasar hi, this is work only if i !kb nick same nick for the second time not at first time why ?

frist time

<@Stefano> !kb test-1
* test-1 was kicked by test (Requested (Stefano))
* test sets mode: +b *!*@test-67B691C.irccloud.com
* test sets mode: -b *!*@test-67B691C.irccloud.com

second time

<@Stefano> !kb test-1
* test-1 was kicked by test (Requested (Stefano))
* test sets mode: +b *!*@test-67B691C.irccloud.com
* test sets mode: -b+b *!*@test-67B691C.irccloud.com *!uid22341@*

Code: Select all


## ircCloudBan v.0.4 ## 

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 {[su]id\d+} $u]} { 
         pushmode $ch +b "*!$u@*" 
      } elseif {[regexp {id-(\d+).(.*?).irccloud.com} $h - x]} { 
         foreach n [chanlist $ch] { 
            if {[isbotnick $n]} continue 
            if {[isop $n $ch] || [isvoice $n $ch] || [validuser [nick2hand $n]]} continue 
            scan [getchanhost $n $ch] {%[^@]@%s} user host 
            if {[regexp {\d+} $user y]} {      
               if {[string equal $x $y]} { 
                  pushmode $ch +b "*!$user@*" 
               } 
            } 
         } 
      } 
      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 
} 

Use your common sense and try not to make me look too much like I know what I'm doing.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What's the exact user host of the test user? test-1!uid22341@test-67B691C.irccloud.com ?
Once the game is over, the king and the pawn go back in the same box.
m
mvp1
Voice
Posts: 22
Joined: Thu Jan 27, 2022 4:28 am

Post by mvp1 »

Hi Caesar,

I'm testing this code, but there seems to be a problem. The code works fine in case of Kick+Ban. However;

1) In case of only ban (no kick), it unbans the irccloud ban but DOES NOT set the ident(irccloud id) ban. Where it should be setting an irccloud id / ident ban.

<mvp1> !kb Test1
9:49:07 AM •Bot banned *!*@id-387274.lymington.irccloud.com (+b)
9:49:08 AM •Bot un-banned *!*@id-387274.lymington.irccloud.com (-b)

2) In case of only kick (no ban), it sets the ban (cloud id) ban. Where it should not be setting any ban at all.

← •Test1 (uid283599@id-283599.uxbridge.irccloud.com) was kicked by •mpv1: Testing please
9:31:11 AM •Bot banned *!uid283599@* (+b)

Any chance you can help edit so the (ip unban + ident ban) only runs in case of ban and kick+ban, but not in case of only kick?

Many thanks
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this is how i use it

Code: Select all



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

proc ircCloudBan {nk uh hn ch md banmask} {
   if {![botisop $ch]} return
   	     if {[string match -nocase "*@*irccloud*" $banmask] } {  
                   set ::irccloudban $banmask
                   after [expr {1*1000*60}] [list unset ::irccloudban] 
	} 
 }

proc ircCloudKick {nk uh hn ch target why} {
 if {![info exists ::irccloudban]} return
     if {![botisop $ch]} return
         set chost [getchanhost $target $ch]
   	    if {[string match -nocase "*@*irccloud*" $chost] } {  
        regsub -all -- ~ $chost "" chost
        set ident  [lindex [split $chost @] 0]
        set xbmaskx [string map {sid id uid id} $ident]
        set bmask  *!*[string tolower $xbmaskx ]@*
        pushmode $ch +b $bmask
        pushmode $ch -b $::irccloudban
       unset ::irccloudban
  }
}




the only downside is if 2 or more irccloud users get banned at same time the var only stores 1 since its stored under 1 name

Code: Select all

 set ::irccloudban $banmask 

i tried using like :

Code: Select all

 set ::irccloudban($chan:$banmask) $banmask 


but i couldnt use that in the kick proc since kick proc doesnt use bans

other than that it should work fine
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

in addition :
1) In case of only ban (no kick), it unbans the irccloud ban but DOES NOT set the ident(irccloud id) ban. Where it should be setting an irccloud id / ident ban.
this can only be done if unique id (UID) is in the set banmask but in many cases it isnt and in many cases irccloud users use the same server without uid in the server vhost like
*!*@uxbridge.irccloud.com or *!*@ilkley.irccloud.com


and so on wich makes it impossible to determine wich ident ban to set thats why the kick proc is used to determine that on kick
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this seems to do well for me on dalnet

Code: Select all

 
## ircCloudBan v.1.0 ##

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

proc ircCloudBan {nk uh hn ch md banmask} {
  if {![botisop $ch]} return

  if {[string match -nocase "*@*irccloud*" $banmask] && ![regexp {[\`\^\-\_\\\|\}\{\[\]a-zA-Z0-9]{1,}!(\*)@.*irccloud\.com} $banmask] && ![regexp {[su]id\d+} $banmask] && ![regexp {id-(\d+).(.*?).irccloud.com} $banmask] && || ![regexp {(\*)!(\*)@.*[a-zA-Z0-9\-]+\.[a-zA-Z]+\.irccloud\.com} $banmask]} {

    set ::irccloudban $banmask
    after [expr {1*1000*60}] [list unset ::irccloudban]
  }

  if {[regexp {[\`\^\-\_\\\|\}\{\[\]a-zA-Z0-9]{1,}!(\*)@.*irccloud\.com} $banmask] || [regexp {[su]id\d+} $banmask] || [regexp {id-(\d+).(.*?).irccloud.com} $banmask] || [regexp {(\*)!(\*)@.*[a-zA-Z0-9\-]+\.[a-zA-Z]+\.irccloud\.com} $banmask]} {

    set userList [chanlist $ch]

    foreach n $userList {

      if {![matchaddr $banmask $n![getchanhost $n $ch]]} { continue }
      if {[isop $n $ch] || [ishalfop $n $ch] || [matchattr [nick2hand $n] "fnmo|fnmo" $ch]} { continue }

      set chost [getchanhost $n $ch]
      regsub -all -- ~ $chost "" chost
      set ident  [lindex [split $chost @] 0]
      set xbmaskx [string map {sid id uid id} $ident]
      set bmask  *!*[string tolower $xbmaskx ]@*
      pushmode $ch +b $bmask
      pushmode $ch -b $banmask
    }
  }
}

proc ircCloudKick {nk uh hn ch target why} {
  set chost [getchanhost $target $ch]

  if {[info exists ::irccloudban] && [matchaddr $::irccloudban $target!$chost]} {
    if {![botisop $ch]} return

    regsub -all -- ~ $chost "" chost
    set ident  [lindex [split $chost @] 0]
    set xbmaskx [string map {sid id uid id} $ident]
    set bmask  *!*[string tolower $xbmaskx ]@*
    pushmode $ch +b $bmask
    pushmode $ch -b  $::irccloudban
    after cancel unset ::irccloudban
    unset ::irccloudban
  }
}

putlog "irccloud.tcl Loaded."

Post Reply