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.

Bug in ban. Too long ident trouble.

Old posts that have not been replied to for several years.
Locked
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Bug in ban. Too long ident trouble.

Post by zlobus »

Please help. I have problem in my ban. If user have too long ident, then i have this trouble:


(18:58:27) —› mode: (CAXAP) sets (+b *!*http___Kl@*)
(18:58:27) —› join: (kutraniel) (~indignity@195.62.147.164)
(18:58:29) —› kick: (^DMX^) was kicked by (clarity) (banned:)
(18:58:29) —› join: (^DMX^) (http___Kla@159.148.54.60)
(18:58:30) —› kick: (^DMX^) was kicked by (CAXAP) (banned:)
(18:58:32) —› join: (^DMX^) (http___Kla@159.148.54.60)
(18:58:32) —› kick: (^DMX^) was kicked by (clarity) (banned:)
(18:58:34) —› quit: (KSJUH) (~andegos@80.232.159.163) (Quit:)
(18:58:34) —› join: (^DMX^) (http___Kla@159.148.54.60)


etc....
I'd like to have ban on 7 last characters on ident@host.com. Then, I think I won't have this problem. Please help me how to set banmask to !*last_7_characters_of_ident@host.com or something like that. Maybe somebody know any other problem solvation.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well what script are you using, what tcl script is setting that type of ban? For sure its no eggdrop channel protection function.

For the trimming the ident you can use:

Code: Select all

set ident [string trimleft [lindex [split $uhost "@"] 0] "~"]
if {([expr $ident] > 7)} { set ident [string trimleft [string trimright [string range $ident 7 end]] "~"] }
#Then you can go ahead and ban the user like "*!*$ident@[lindex [split $uhost "@"] 1]"
Something like this should do it.
It will detect if the ident is more than 7 characters it will remove the 8th character and trim it. If it is less than 8 characters then the ident will remain the same and will not be trimmed. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

i had edited my ban script to this:

set ident [string trimleft [lindex [split $uhost "@"] 0] "~"]
if {([expr $ident] > 7)} { set ident [string trimleft [string trimright [string range $ident 7 end]] "~"] }
newchanban $chan *!$ident[string tolower [string range $uhost [string first @ $uhost] end]] quitban $qb_reason $qb_bantime

and i have that error: (18:05:40) (repus) [18:05] Tcl error [qb_quit]: syntax error in expression "ExploreR": variable references require preceding $

Help me, plz.

P.S. ExploreR - is a nick of user, script had ban to.
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

and by the way, will this work too?

proc ban_host {nick uhost hand chan args} {
set ident [string trimleft [lindex [split $uhost "@"] 0] "~"]
if {([expr $ident] > 7)} { set ident [string trimleft [string trimright [string range $ident 7 end]] "~"] }
set bhost *!$ident[string tolower [string range $uhost [string first @ $uhost] end]]
if {[isban $bhost $chan] == 0} {
newchanban $chan $bhost $hand [getuser $hand comment]
}
}
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

awyeah wrote:

Code: Select all

if {([expr $ident] > 7)} {
Did you mean

Code: Select all

if {[string len $ident]>7} {
?
Have you ever read "The Manual"?
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

i only past in my ban awyeah's code ;) may be he was mestaken ;)
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

CODE:
if {[string match $quitmsg $reason]} {
putlog "host: '$uhost'"
set ident [string trimleft [lindex [split $uhost "@"] 0] "~"]
if {[string len $ident]>7} { set ident [string trimleft [string trimright [string range $ident 7 end]] "~"] }
newchanban $chan *!$ident[string tolower [string range $uhost [string first @ $uhost] end]] quitban $qb_reason $qb_bantime
putlog "bad quit message detected, user $nick, channel $chan"
return 0
}



i replaced with if {[string len $ident]>7} {
and now users with ident more than 7 characters he didn't ban at all, only recognize them:

(22:03:02) (repus) [22:03] host: 'e_X_y_u_@81.198.169.48'
(22:03:02) (repus) [22:03] bad quit message detected, user ExploreR, channel #mu.black

but user that have ident less than 7 symbols he bans.... :

(21:58:16) —› quit: (asasaaa) (asasaaa@ip-56.59.home-lan.fastnet.lv) (Quit: HnH Script spam www.spam.com)
(21:58:16) —› mode: (repus) sets (+b *!asasaaa@ip-56.59.home-lan.fastnet.lv)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yeah thanx user, string length is a better way todo it all, didn't think of that, geez don't know what happened then.

Anyway use this type of logic:

Code: Select all

if {([string match -nocase *$quitmsg* $reason])} {
 set host [lindex [split $uhost "@"] 1]
 set ident *![string trimleft [lindex [split $uhost "@"] 0] "~"]
 if {([string len $ident] > 7)} { set ident *![string trimleft [string trimright [string range $ident 7 end]] "~"] } 
 newchanban $chan $ident@$host quitban $qb_reason $qb_bantime 
 return 0 
 }
}
I don't know what bantype in from $uhost in the host you are trying to use. But if you are trying to use *!*@ip1.ip2.ip3.ip4 then:

Code: Select all

[lindex [split $uhost "@"] 1] 
Will do the job for you!
Alternatively you can also use maskhost, if you want it to set a greater ban range.

can do the job for you.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

(15:36:57) (repus) [15:36] Tcl error in file 'eggdrop.conf':
(15:36:57) (repus) [15:36] invalid command name "}"
(15:36:57) (repus) while executing
(15:36:57) (repus) "}"
(15:36:57) (repus) (file "scripts/quit.tcl" line 57)
(15:36:57) (repus) invoked from within
(15:36:57) (repus) "source scripts/quit.tcl"
(15:36:57) (repus) (file "eggdrop.conf" line 112)
(15:36:57) (repus) [15:36] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

:(
btw, i'm using (trying to use) this type of banmask *!end_of_ident@host.com
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Try checking all of your procedures in quit.tcl. Seems so you have an extra } (closing brackets) in one of the procedures which should be removed for the bot to load.

Remember, the total number of { brackets should be equal to the total number of } brackets in a procedure, if they are unbalanced you can have syntax errors and the procedure wouldn't have been closed properly. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

This is script's code:

# quitban.tcl v1.1 (25 November 1999)
# copyright © 1999 by slennox <slennox@egghelp.org>
# This script bans people who quit with a specified quit message (except
# for +f and +o users). Requested by Ahmed.
#
# v1.0 - Initial release.
# v1.1 - Fixed 'stl' error for users without netbots.tcl.

# Specify the list of quit messages to ban on. Use lower case characters
# only. You can use standard wildcards (? and *) in the list.
set qb_quitmsgs {
"*www.*"
"*http://*"
"*ftp.*"
"*ftp://*"
}

# Channels in which to enable the script. This can be one channel like
# "#red", a list of channels like "#red #green #blue", or "" for all
# channels.
set qb_chans ""

# Length of time to ban for (in minutes).
set qb_bantime 14440

# Ban reason.
set qb_reason "Смени quit message."


# Don't edit below unless you know what you're doing.

proc qb_quit {nick uhost hand chan reason} {
global qb_bantime qb_chans qb_quitmsgs qb_reason
if {(($qb_chans != "") && ([lsearch -exact $qb_chans [string tolower $chan]] == -1))} {return 0}
if {[matchattr $hand fmnROo|fmnROo $chan]} {return 0}
set reason [string tolower $reason]
foreach quitmsg $qb_quitmsgs {
if {([string match -nocase $qb_quitmsg $reason])} {
set host [lindex [split $uhost "@"] 1]
set ident *![string trimleft [lindex [split $uhost "@"] 0] "~"]
if {([string len $ident] > 7)} { set ident *![string trimleft [string trimright [string range $ident 7 end]] "~"] }
newchanban $chan $ident@$host quitban $qb_reason $qb_bantime
return 0
}
}
return 0
}

set qb_chans [split [string tolower $qb_chans]]

bind sign - * qb_quit

putlog "Loaded quitban.tcl v1.0 by slennox"

return


Problem: Users with ident shorter then 7 symbols he bans, but if the ident is longer, he doesn't do anything, even doesn't write any errrors.

Where code is wrong? :-)

P.S. it's slenoxx's quitban.tcl script
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well you said the bot to ban idents less than 7 or equal to 7 chars. If it is greater that that then, what should the bot do? Currently I think your ircd doesn't support the ban or something.

If you really have a problem use the banmask *!*ident*@host or
*!ident@host instead of using *!ident@host.

Here use this.

Code: Select all

# Specify the list of quit messages to ban on. Use lower case characters
# only. You can use standard wildcards (? and *) in the list.
set qb_quitmsgs {
"*www.*"
"*http://*"
"*ftp.*"
"*ftp://*"
}

# Channels in which to enable the script. This can be one channel like
# "#red", a list of channels like "#red #green #blue", or "*" for all
# channels.
set qb_chans "*"

# Length of time to ban for (in minutes).
set qb_bantime 14440

# Ban reason.
set qb_reason "Смени quit message."

# Don't edit below unless you know what you're doing.

bind sign - * qb_quit

proc qb_quit {nick uhost hand chan reason} {
 global qb_bantime qb_chans qb_quitmsgs qb_reason
  if {(($qb_chans != "*") && ([lsearch -exact [split [string tolower $qb_chans]] [string tolower $chan]] == -1))} { return 0 }
  if {[matchattr $hand fmnROo|fmnROo $chan]} { return 0 }
   set reason [string tolower $reason]
   foreach quitmsg $qb_quitmsgs {
    if {([string match -nocase *$qb_quitmsg* $reason])} {
    set host [lindex [split $uhost "@"] 1]
    set ident *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]*
     if {([string length $ident] > 7)} { set ident *!*[string trimright [string range $ident 7 end]]* }
     newchanban $chan $ident@$host quitban $qb_reason $qb_bantime
     return 0
     }
   }
}
I released a similar kind of script like this but more complicated, it activates on part messages too, try it out "Anti Part/Quit Message Script". Find it on egghelp.org it has many feaures availiable!
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
z
zlobus
Voice
Posts: 16
Joined: Sun Sep 12, 2004 12:07 pm

Post by zlobus »

i want to ban ALL users, but if the user's ident is longer than 7 symbols, bot should set banmask to *!7_last_ident_symbols@host.com.
And usual banmask should be *!ident@host.com.

Simply if the ident is long bot should remove first symbols and ban on *!7_last_ident_symbols@host.com
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Let me give you some advice sonny, I am using IRC since 7 years and frankly to be honest the way you want to ban it, is inappropriate. It can be done but that user wont be banned, technically, if the ident is trimmed and you don't use wildcards. He will join back in as the ident is trimmed to 7 characters, and no wildcards as used as his real ident isn't banned.
Example:

*** awyeah (longident@DAL.net) has joined #drugs
*** Bot sets mode: +b awyeah *!longide@DAL.net
*** awyeah was kicked by Bot (bad user)
*** awyeah (longident@DAL.net) has joined #drugs
#Will not set the correct ban
By not using wildcards in the ident and trimming it will not ban the ident technically, so you would have to use * after trimming it if I know what I am saying. If you don't know try it and let me know, heh.
*** awyeah (longident@DAL.net) has joined #drugs
*** Bot sets mode: +b awyeah *!longide*@DAL.net
*** awyeah was kicked by Bot (bad user)
#Will set the correct ban
If you still want todo it that way. Here is the code, go and use it as you like your ban to be placed as: *!ident@host.com
(The only thing in that banmask will affect is the nickchange nothing else)

Code: Select all

set ident *![lindex [split $uhost "@"] 0]
if {([string length $ident] > 7)} { set ident *![string trimright [string range $ident 7 end]] } 
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked