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.

script causes eggdrop bug

Old posts that have not been replied to for several years.
Locked
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

script causes eggdrop bug

Post by r0t3n »

Ok. I decided to modify the code which awyeah made, his w32aplore code, and wiebe's ircworm script. But now, when the eggdrop (its a windrop)connects to irc with this script loaded and joins #antipjen it causes a bug.

The bug:

Code: Select all

<level93|Tosser> .+chan #antipjen
<aP|Drone> [20:46] tcl: builtin dcc call: *dcc:+chan Tosser 9 #antipjen
<aP|Drone> [20:46] #Tosser# +chan #antipjen
<aP|Drone> [20:46] Tcl error [w32aplore:virus]: no such channel record
<aP|Drone> [20:46] * Last context: tclhash.c/684 [Tcl proc: *join:notes, param:  $_jp1 $_jp2 $_jp3 $_jp4]
<aP|Drone> [20:46] * Please REPORT this BUG!
<aP|Drone> [20:46] * Check doc/BUG-REPORT on how to do so.
<aP|Drone> [20:46] * Wrote DEBUG
<aP|Drone> [20:46] * SEGMENT VIOLATION -- CRASHING!
-
DCC session closed
The antipjen code:

Code: Select all

#by wiebe @ QuakeNet 

#counters this worm http://www.vsantivirus.com/drefir-e.htm

setudef flag antipjen
setudef str antipjen_scanned
setudef str antipjen_detected
setudef str antipjen_kicked
setudef str antipjen_id 

bind join -|- * ircworm:join
bind join - "*" w32aplore:virus 
bind join -|- * check:op:join
bind pub - !antipjen pub:antipjen:toggle
bind msg - antipjen antipjen:toggle  

proc ircworm:join { nick uhost handle chan } {
if {![isbotnick $nick]} {
if {[channel get $chan antipjen]} {
[expr [channel get $chan "antipjen_scanned"] +1]
#the nicks
  set pjennicks "Zenia Zoe Zilya Xenia Xylia Xandra Willa Wendy Vicky Vivian Violet Valora Vanessa Valda Ula Uma Sharon Silver Rosa Ruby Rita Rae Rachel Queen Peggy Pamela Olivia Olga Nicole Naomi Natalie Nora Nina Nova Nadia Maia Mary Melody Mimi Myra Linda Lisa Lolita Lynn Laura Lara Kara Kassia Kyle Kali Kacey Katrina Janet Jewel Joanna Juliet Julie Ida Idona Isabel Iris Ivana Ivory Helga Holly Haley Gloria Gilda Gale Faith Emily Evelyn Eve Erika Eliza Eden Ebony Donna Dora Doris Diana Danielle Daria Damita Camille Cara Carla Carmen Clarissa Chelsea Caitlin Bettina Blenda Bridget Briana Bella Becky Barbra Aldora Alysia Amorita Aretina Ara April Anita"

#check if nick ends in 2 digits and the rest of the nick is in the list
  if { [regexp {\d\d$} $nick] && ![string equal [lsearch -exact [split $pjennicks] [string range $nick 0 end-2]] -1] || [string match "*$pjennicks*" "[lindex [split $uhost @] 0]"] } {

#increase the detected counter
[expr [channel get $chan "antipjen_detected"] +1]

#set mask to ban
    set ban *!*@[lindex [split $uhost @] 1]

#increase the antipjen id counter
[expr [channel get $chan "antipjen_id"] +1]

#ban
if {[botisop $chan]} {
putquick "KICK $chan $nick :\[IrcWorm-1.3\] infected drone detected \(ID: [channel get $chan antipjen_id]\) \(Anti-pjen bot by #antipjen\)"
[expr [channel get $chan "antipjen_kicked"] +1]
} else {
putserv "PRIVMSG $chan :#Antipjen: If im not oped within 3 minutes i will part $chan \(Anti-pjen bot by #antipjen\)"
utimer 3 [check:op $chan]
}
newchanban $chan $ban $::botnick "\[IrcWorm-1.3\] infected drone detected \(ID: [channel get $chan antipjen_id]\) \(Anti-pjen bot by #antipjen\)" 0
      }    
    }
  }
}

proc check:op {chan} {
if {[string equal -nocase $::botnick $nick]} {
if {![botisop $chan]} {
set reason "no op"
putserv "PRIVMSG $chan :This channel has been deleted \(Reason: $reason\) \(Anti-pjen bot by #antipjen\)"
channel remove $chan
lappend suspended $chan $reason
putserv "PRIVMSG #antipjen :Channel '$chan' has be deleted from my channel list \(Reason: $reason\)"
}
}
}

proc check:op:join {nick host hand chan} {
if {[string equal -nocase $::botnick $nick]} {
if {![botisop $chan]} {
set reason "no op"
putserv "PRIVMSG $chan :This channel has been deleted \(Reason: $reason\) \(Anti-pjen bot by #antipjen\)"
channel remove $chan
lappend suspended $chan $reason
putserv "PRIVMSG #antipjen :Channel '$chan' has be deleted from my channel list \(Reason: $reason\)"
}
}
}




bind raw -|- "315" ircworm:raw

proc ircworm:raw { server numeric text } {
  set chan [string tolower [lindex [split $text] 1]]

#invalid chan
  if { ![validchan $chan] } { return 0 }

#check if we recently joined
  if { [expr [unixtime] - [getchanjoin $::botnick $chan]] > "60" } { return 0 }

#check each user
  foreach nick [chanlist $chan] { ircworm:join $nick [getchanhost $nick] [nick2hand $nick] $chan }
}

proc w32aplore:virus {nick uhost hand chan} {
if {[channel get $chan antipjen]} {
[expr [channel get $chan "antipjen_scanned"] +1]
if {![isbotnick $nick] && ![isop $nick $chan] && ![isvoice $nick $chan] && ![string equal -nocase "#indiahelp" $chan] && [regexp -nocase {^[a-z]{4,}[0-9]{2}$} $nick] && [string equal "~" [string index [lindex [split $uhost @] 0] 0]] && [regexp -all {^[^{}\\\[\\\]-_^`|\\\\]$} $nick] && [string equal "1" [check:ip [lindex [split $uhost @] 1]]] && [string match "*\[0-9\]\[0-9\]*" [string range [string trimleft [lindex [split $uhost @] 0] ~] [expr [string length [string trimleft [lindex [split $uhost @] 0] ~]]-2] end]]} { 
if {[string equal [string trimleft [lindex [split $uhost @] 0] ~] $nick] && [string equal [string length [string trimleft [lindex [split $uhost @] 0] ~]] [string length $nick]] || [string equal "2" [string length [string trimleft [lindex [split $uhost @] 0] ~]]] && [string equal [string range [string trimleft [lindex [split $uhost @] 0] ~] [expr [string length [string trimleft [lindex [split $uhost @] 0] ~]]-2] end] [string range $nick [expr [string length $nick]-2] end]]} { 
[expr [channel get $chan "antipjen_detected"] +1]
[expr [channel get $chan "antipjen_id"] +1]
if {[botisop $chan]} {
putquick "KICK $chan $nick :\[W32@aplore] infected drone detected \(ID: [channel get $chan antipjen_id]\) \(Anti-pjen bot by #antipjen\)"
[expr [channel get $chan "antipjen_kicked"] +1]
} else {
putserv "PRIVMSG $chan :#Antipjen: If im not oped within 3 minutes i will part $chan \(Anti-pjen bot by #antipjen\)"
utimer 3 [check:op $chan]
}
newchanban $chan $ban $::botnick "\[W32@aplore] infected drone detected \(ID: [channel get $chan antipjen_id]\) \(Anti-pjen bot by #antipjen\)" 0
} 
} 
}
} 

proc check:ip {str} { 
set tmp [split $str .] 
if {[llength $tmp] != 4} then { 
return 0 
} 
set index 0 
foreach i $tmp { 
if {(([regexp \[^0-9\] $i]) || ([string length $i] > 3) || (($index == 3) && (($i > 254) || ($i < 1))) || (($index <= 2) && (($i > 255) || ($i < 0))))} then { 
return 0 
} 
incr index 
} 
return 1 
} 

proc antipjen:toggle {n u h t} {
  set channel [lindex [split $t] 0]
  set option [lindex [split $t] 1]
  switch exact $option {
    "on" {
      if {[matchattr $h nmA|]} {
        if {![validchan $channel]} {
          putserv "NOTICE $n :Channel '$channel' is not a valid channel"
          } else {
          if {[channel get $channel "antipjen"]} {
            putserv "NOTICE $n :Anti-pjen is already enabled for $channel"
            } else {
            channel set $channel +antipjen
            putserv "NOTICE $n :Done"
          }
        }
      }
    }
    "off" {
      if {[matchattr $h nm|]} {
        if {![validchan $channel]} {
          putserv "NOTICE $n :Channel '$channel' is not a valid channel"
          } else {
          if {![channel get $channel "antipjen"]} {
            putserv "NOTICE $n :Anti-pjen is already disabled for $channel"
            } else {
            channel set $channel -antipjen
            putserv "NOTICE $n :Done"
          }
        }
      }
    }
    "default" {
      if {[matchattr $h nm|]} {
        if {![validchan $channel]} {
          putserv "NOTICE $n :Channel '$channel' is not a valid channel"
          } else {
          if {[channel get $channel "antipjen"]} {
            putserv "NOTICE $n :Anti-pjen is enabled for $channel"
            } else {
            putserv "NOTICE $n :Anti-pjen is disabled for $channel"
          }
        }
      }
      putserv "NOTICE $n :Please use: /msg $::botnick $::lastbind on|off" 
    }
  }
}

proc pub:antipjen:toggle {n u h c t} {
set option [lindex [split $t] 0]
if {$option == "stats"} {
putserv "NOTICE $n :Stats for $c: Scanned: [channel get $c "antipjen_scanned"] Detected: [channel get $c "antipjen_detected"] Kicked: [channel get $c "antipjen_kicked"]"
} else {
putserv "NOTICE $n :Please use: $::lastbind stats"
}
}

putlog "anti-pjen.tcl loaded!!"
Please help me, i dont see how this tcl script can cause such a bug.

Thanks in advance !!! :)
r0t3n @ #r0t3n @ Quakenet
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

irrelevant & wrong forum

awyeah's script is obviously buggy, but no script bug should ever crash eggdrop; report to eggheads or winheads
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Tosser^^ wrote:Ok. I decided to modify the code which awyeah made ...
Is it any wonder?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Locked