# TCL SCRIPT FOR !nslookup !traceroute

putlog "Channel script version 0.5.3 by |SmUrF| loaded"

proc commandchar {} {
	return "!"
}

bind pub - [commandchar]nslookup nslookup
bind pub - [commandchar]traceroute traceroute

proc nslookup {nick host hand chan text} {
		if {[onchan $text $chan] == 1} {
			set host [lindex [split [getchanhost $text $chan] @] 1]
		} else {
			set host $text
		}
		set input [open "|nslookup $host" r]
		set trash [gets $input]
		set trash [gets $input]
		while {![eof $input]} {
			catch {set contents [gets $input]}
			putserv "PRIVMSG $nick :$contents"
		}
		catch {close $input}
}

proc traceroute {nick host hand chan text} {
		if {[onchan $text $chan] == 1} {
			set host [lindex [split [getchanhost $text $chan] @] 1]
		} else {
			set host $text
		}
		set input [open "|traceroute $host" r]
		while {![eof $input]} {
		        catch {set contents [gets $input]}
		        putserv "PRIVMSG $nick :$contents"
	        }
		catch {close $input}
}
Published in: TCL
Download

Related snippets