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.

antispam script error message

Support & discussion of released scripts, and announcements of new releases.
Post Reply
s
sk-4
Halfop
Posts: 51
Joined: Sat Oct 06, 2007 6:37 am

antispam script error message

Post by sk-4 »

im using awyeah spamkick.tcl


im getting this error in partyline Tcl error [private:spam:kicker]: invalid command name "Private"
the bot is doing the ban,but no kick after that and the error is appeared in bot partyline.. the script work fine for few years,suddenly now it showing error..il paste the part of the code

Code: Select all

##############################################################################
### Don't edit anything else from this point onwards even if you know tcl! ###
##############################################################################


if {(![file exists $spamdata]) && ($spamrecord == 1)} {
 putlog "SPAMMER RECORD DATABASE:\002 $spamdata \002file \002does not exist\002, *creating file*: \002$spamdata\002"
 set file [open $spamdata w]
 puts $file "PRIVATE MESSAGE/NOTICE SPAMMER RECORDS (Private Advertise/Spam Kicker Script v4.58.ab by awyeah)\n"
 catch {close $file}
}

set spamchans [split $spamchans]
set spamchanslwr [string tolower $spamchans]
bind msgm - * private:spam:kicker
bind kick - * spam:kick:counter

proc private:spam:kicker {nick uhost hand text} {
 global botnick botname spambots spamchanslwr kickno spamverifyone spamverifytwo spamverifythree spamunbantime spamkickmsg spamkickcounter
   set spamdetect1 [lindex $text 0]; set spamdetect2 [lindex $text 1]; set spamdetect3 [lindex $text 2]; set spamtype [lindex $text 6]; set spamfwd [lindex $text 7]; set spamarrow "==>"; set spamtypemsg "MSG:"; set spamtypenotc "NOTC:"
   if {($nick != $botnick) && ([string match -nocase *$nick* *$spambots*]) && ([string equal -nocase $spamdetect1 $spamverifyone]) && ([string equal -nocase $spamdetect2 $spamverifytwo]) && ([string equal -nocase $spamdetect3 $spamverifythree]) && ([string equal -nocase $spamfwd $spamarrow]) && (([string equal -nocase $spamtype $spamtypemsg]) || ([string equal -nocase $spamtype $spamtypenotc]))} {
   if {(![file exists $spamkickcounter])} { set file [open $spamkickcounter w]; puts $file 1; catch {close $file} }
    set uhost [lindex $text 4]; set spamnick [lindex $text 5]; set spammsg [lrange $text 8 end]; set spammsg [spam:filter $spammsg]; set nick [lindex $text 5]; set spamaddress $uhost
    foreach spamchan $spamchanslwr {
      if {(![isop $spamnick $spamchan]) && (![isvoice $spamnick $spamchan]) && ([onchan $spamnick $spamchan])} {
       set kickcounter [open $spamkickcounter r]; set currentkicks [gets $kickcounter]
       catch {close $kickcounter}; set totalkicks [expr $currentkicks]
	 set banmask [spam:banmask $uhost $nick]
       putquick "MODE $spamchan +b $banmask" -next
       if {([string equal -nocase $spamtype $spamtypemsg])} { set spamtype MESSAGE }; if {([string equal -nocase $spamtype $spamtypenotc])} { set spamtype NOTICE }
        if {($spamkickmsg == 0)} { putquick "KICK $spamchan $spamnick :4[2Private Spam/Advertiser4] 12---> 6Caught By Spam Bot 4? 14Mass Inviting/Advertising/Spamming is not tolerated on this Channel.. Further 4spamming/advertising4 14will result into a Channel4 Akick 6Kick N?:15 $totalkicks"  -next }
        if {($spamkickmsg == 1)} { putquick "KICK $spamchan $spamnick :4[2Spam/Advertiser4] 12--->  4?  14PRIVATE SPAM $spamtype: 4($spammsg)2 6K??k ??:15 #$totalkicks"  -next }
        if {($spamkickmsg != "1") || ($spamkickmsg != "0") || ($spamkickmsg == "")} { putquick "KICK $spamchan $spamnick :4[2Private Spam/Advertiser4] 12---> 6Caught By Spam Bot 4? 14Mass Inviting/Advertising/Spamming is not tolerated on this Channel.. Further 4spamming/advertising4 14will result into a Channel4 Akick 6Kick N?:15 $totalkicks"  -next }
         timer $spamunbantime "pushmode $spamchan -b $banmask"
  	   set spamip "*!*@[lindex [split $uhost @] 1]"; set spamuhost $uhost
 	   record:spammer:data $spamnick $spamuhost $spamip $spamchan $spammsg $spamtype
	   report:spammer $spamnick $spamuhost $spamip $spamchan $spammsg $spamtype
         }
      }
   }
}
# (i kick ass baby...!)


proc record:spammer:data {spamnick spamuhost spamip spamchan spammsg spamtype} {
 global botnick spamrecord spamdata
  if {(![file exists $spamdata])} { set file [open $spamdata w]; puts $file "PRIVATE MESSAGE/NOTICE SPAMMER RECORDS (Private Advertise/Spam Kicker Script v4.58.ab by awyeah)\n"; catch {close $file} }
  if {($spamrecord == "1") && ($spamdata != "")} {
    set file [open $spamdata a+]; set time [unixtime]; set spamtime [ctime $time]
    set date [string trim [lindex $spamtime 2]]; set month [string trim [lindex $spamtime 1]]; set time [string trim [lindex $spamtime 3]]
    puts $file "\[$date $month $time\] ?SPAMMER ON [string toupper $spamchan]? (User IP Address: $spamip) - (Nick): $spamnick - (User Host) $spamuhost - (Channel): $spamchan - (Spam): $spammsg - (Type): PRIVATE $spamtype"
    catch {close $file}
    return 1
    }
}

proc report:spammer {spamnick spamuhost spamip spamchan spammsg spamtype} {
 global botnick spamreport spamreporttarget
  if {($spamreport == 0) || ($spamreport == "") || ($spamreporttarget == "")} { return 0 }
  if {($spamreporttarget != "") && ($spamtype == "MESSAGE") || ($spamtype == "NOTICE")} {
   if {($spamreport == 1) && (![string match -nocase "#*" $spamreporttarget])} { putserv "PRIVMSG $spamreporttarget :?SPAMMER DETECTED? (Nick): ($spamnick) - (Address): ($spamuhost) - (Channel): ($spamchan) - (Spam): ($spammsg) - (Type): (PRIVATE $spamtype)"; return 0 }
   if {($spamreport == 2) && (![string match -nocase "#*" $spamreporttarget])} { putserv "NOTICE $spamreporttarget :?SPAMMER DETECTED? (Nick): ($spamnick) - (Address): ($spamuhost) - (Channel): ($spamchan) - (Spam): ($spammsg) - (Type): (PRIVATE $spamtype)"; return 0 }
   if {($spamreport == 3)} { putserv "PRIVMSG $spamreporttarget :?SPAMMER DETECTED? (Nick): ($spamnick) - (Address): ($spamuhost) - (Channel): ($spamchan) - (Spam): ($spammsg) - (Type): (PRIVATE $spamtype)"; return 0 }
   if {($spamreport == 4)} { putserv "NOTICE $spamreporttarget :?SPAMMER DETECTED? (Nick): ($spamnick) - (Address): ($spamuhost) - (Channel): ($spamchan) - (Spam): ($spammsg) - (Type): (PRIVATE $spamtype)"; return 0 }
   if {($spamreport == 5)} { putserv "NOTICE @$spamreporttarget :?SPAMMER DETECTED? (User IP Address: $spamip) - (Nick): ($spamnick) - (Address): ($spamuhost) - (Channel): ($spamchan) - (Spam): ($spammsg) - (Type): (PRIVATE $spamtype)"; return 0 }
   return 0
   }
}


proc spam:banmask {uhost nick} {
 global spambanmask
   switch -- $spambanmask {
    1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
    2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
    3 { set banmask "*!*$uhost" }
    4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
    5 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
    6 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" }
    7 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
    8 { set banmask "$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
    9 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
    10 { set banmask "$nick*!*@[lindex [split $uhost "@"] 1]" }
    11 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
    12 { set banmask "*$nick*!*$uhost" }
    13 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
    14 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" } 
    15 { set banmask "$nick!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" } 
    16 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
    17 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
    18 { set banmask "$nick!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" } 
    19 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
    20 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" } 
    default { set banmask "*!*@[lindex [split $uhost @] 1]" }
    return $banmask
   }
}


if {(![file exists $spamkickcounter])} {
 putlog "SPAM KICK COUNTER:\002 $spamkickcounter \002file \002does not exist\002, *creating file*: \002$spamkickcounter\002"
 set file [open $spamkickcounter w]; puts $file 1; catch {close $file}
}


## Thanks to NeOmAtRiX for this kick counter
proc spam:kick:counter {nick uhost handle chan target arg} {
 global botnick spamkickcounter
  if {[string tolower $target] == [string tolower $botnick]} { return 0 }
  if {[string tolower $nick] == [string tolower $botnick]} {
  if {![file exists $spamkickcounter]} {
   putlog "KICK COUNTER: $spamkickcounter file does not exist, creating file $spamkickcounter."
   set file [open $spamkickcounter w]
   puts $file 1
   catch {close $file}
   }
   set file [open $spamkickcounter r]
   set currentkicks [gets $file]
   catch {close $file}
   set file [open $spamkickcounter w]
   puts $file [expr $currentkicks + 1]
   catch {close $file}
   }
}

## Thanks to ppslim for this filter
proc spam:filter {str} {
  regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
  return $str
}


putlog "\[LOADED\] Spam Kicker Script v4.58.ab by \002awyeah (awyeah@usa.net)\002"
putlog "\002***ACTIVATED***\002 Spam Kicker Bot \002(Opped Channel Bot: *$nick*)\002 on:\002 $spamchanslwr\002"

return
Moderated: Placed that chunk of code within proper tags

/NML_375
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The error comes from lines such as this one:

Code: Select all

if {($spamkickmsg == 0)} { putquick "KICK $spamchan $spamnick :4[2Private Spam/Advertiser4] 12---> 6Caught By Spam Bot....
The culprit here, are the [], which tcl interprets as "command substitution characters". Roughly said, it takes whatever inside and executes it as a separate command, then replaces the [] along with it's content with the output from the other command. These either have to be removed, or escaped:

Code: Select all

[...] => \[...\]
NML_375
Post Reply