egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

irccloud banmask
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Wed Jul 18, 2018 7:13 am    Post subject: Reply with quote

did as you told me to, results returned:
Quote:

[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 *!*@*
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Wed Jul 18, 2018 8:18 am    Post subject: Reply with quote

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:

pushmode $ch +b "*!$u@*"

make it:
Code:

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.
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1047

PostPosted: Wed Jul 18, 2018 12:35 pm    Post subject: Reply with quote

Quote:
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
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 831
Location: Tennessee, USA

PostPosted: Wed Jul 18, 2018 6:44 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Thu Jul 19, 2018 1:11 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1047

PostPosted: Thu Jul 19, 2018 5:24 am    Post subject: Reply with quote

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.

Quote:
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

Quote:

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

hiring other ops wont change that
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Thu Jul 19, 2018 7:23 am    Post subject: Reply with quote

From IRCCloud Networks page I quote:
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:

[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:

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.
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1047

PostPosted: Fri Jul 20, 2018 10:32 pm    Post subject: Reply with quote

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:
## 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
}
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Sat Jul 21, 2018 4:57 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1047

PostPosted: Sat Jul 21, 2018 9:18 pm    Post subject: Reply with quote

did some more testing seems fine caesar it executes all well

thanx again job well done once again

apreciated as always.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Mon Jul 23, 2018 7:44 am    Post subject: Reply with quote

This piece of code:
Code:

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:

pushmode $ch -b $banmask

and not inside ircCloudKick because the:
Code:

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:

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:
Quote:

[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:

## 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.
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1047

PostPosted: Mon Jul 23, 2018 10:38 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Mon Jul 23, 2018 1:02 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1047

PostPosted: Mon Jul 23, 2018 10:52 pm    Post subject: Reply with quote

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

and i always restart bot after loading new code and disabling old
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3775
Location: Mint Factory

PostPosted: Tue Jul 24, 2018 2:02 am    Post subject: Reply with quote

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:

[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:

[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:

[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:

[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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber