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.
Old posts that have not been replied to for several years.
mcdarby
Halfop
Posts: 69 Joined: Tue Jul 16, 2002 7:46 pm
Location: Bangor, Pennsylvania
Contact:
Post
by mcdarby » Tue Jan 18, 2005 4:29 am
Hi, I had gotten a TCL that is supposed to response to pub and msg !dns, !nslookup, and !nsl commands. But the problem is egg is responding with the following error message from a "!dns NickServ" and there is no problem when I do "!dns IP Address". The error is "Tcl error [msg_nslookup]: can't read "name": no such variable". Here is the code being used, I would like to find out what the problem is. And it now just started giving the same error message when trying to lookup IP addresses that start with 61, 80 to 90, and everything starting above 200. And I'm sure there are others that I didn't notice yet.
Code: Select all
bind pub - !nsl pub_nslookup
bind msg - !nsl msg_nslookup
bind pub - !dns pub_nslookup
bind msg - !dns msg_nslookup
bind pub - !nslookup pub_nslookup
bind msg - !nslookup msg_nslookup
proc pub_nslookup {nick uhost hand chan arg} {
global nsl_path
set input [open "|$nsl_path $arg" r]
while {![eof $input]} {
catch {set contents [gets $input]}
if {[string first "Name:" $contents] >= 0} {
set name [string range $contents 9 end]
}
if {[string first "Address:" $contents] >= 0} {
set address [string range $contents 10 end]
}
}
catch {close $input}
if {$name != ""} {
putserv "PRIVMSG $chan :DNS Lookup: $name <-> $address"
return 0
} else {
putserv "PRIVMSG $chan :DNS Lookup: Unable to resolve address."
return 0
}
}
proc msg_nslookup {nick uhost hand arg} {
global nsl_path
set input [open "|$nsl_path $arg" r]
while {![eof $input]} {
catch {set contents [gets $input]}
if {[string first "Name:" $contents] >= 0} {
set name [string range $contents 9 end]
}
if {[string first "Address:" $contents] >= 0} {
set address [string range $contents 10 end]
}
}
catch {close $input}
if {$name != ""} {
putserv "PRIVMSG $nick :DNS Lookup: $name <-> $address"
return 0
} else {
putserv "PRIVMSG $nick :DNS Lookup: Unable to resolve address."
return 0
}
}
[/quote]
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Tue Jan 18, 2005 6:28 am
Code: Select all
if {[string first "Name:" $contents] >= 0} {
set name [string range $contents 9 end]
}
if {[string first "Address:" $contents] >= 0} {
set address [string range $contents 10 end]
}
}
here is your problem its not meeting this condition, maybe set name {} in the beginning of the script or let it break if it doesn't exist in after the while ..
like
or show an error code didn't read the entire script just saying why it goes wrong ..
XplaiN but think of me as stupid
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Tue Jan 18, 2005 6:31 am
try this
Code: Select all
proc pub_nslookup {nick uhost hand chan arg} {
global nsl_path
set input [open "|$nsl_path $arg" r]
while {![eof $input]} {
catch {set contents [gets $input]}
if {[string first "Name:" $contents] >= 0} {
set name [string range $contents 9 end]
}
if {[string first "Address:" $contents] >= 0} {
set address [string range $contents 10 end]
}
}
catch {close $input}
if {![info exists name]} {
putserv "PRIVMSG $chan :DNS Lookup: Unable to resolve address."
return 0
}
if {$name != ""} {
putserv "PRIVMSG $chan :DNS Lookup: $name <-> $address"
return 0
} else {
putserv "PRIVMSG $chan :DNS Lookup: Unable to resolve address."
return 0
}
}
XplaiN but think of me as stupid
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Tue Jan 18, 2005 3:14 pm
I hope you're not using this on a public network as executing stuff without any restrictions on the input is like begging for trouble.
Have you ever read "The Manual"?