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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
-
Elfriede
- Halfop
- Posts: 67
- Joined: Tue Aug 07, 2007 4:21 am
Post
by Elfriede »
Hi everyone
Im looking for a script, that pings a given address and replies ping time / if url is up or down / in seconds.
Like:
!ping 173.194.69.104
bot: ping reply 1.4s
or !ping 177.777.154
bot: down / not reachable
if possible a configurable timeout would be appreciated.
Hope someone is willing to do me this favour!
Thanks!
-
i
iRoc
Post
by iRoc »
5:01:33pm / * <iRoc> !ping 74.125.235.49
5:01:36pm / * <iB0T> Address: 74.125.235.49 Status:
ONLINE PING Speed: 71.82 ms
5:07:39pm / * <iRoc> !ping google.com
5:07:41pm / * <iB0T> Address: google.com Status:
ONLINE PING Speed: 11.53 ms
5:01:54pm / * <iRoc> !ping 205.234.179.173
5:01:56pm / * <iB0T> Address: 205.234.179.173 Status:
OFFLINE PING Speed: 0 ms
Code: Select all
bind pub -!- !ping ping
proc ping {nick uhost hand chan text} {
set ping(page) http://www.iwebtool.com/ping?domain=
set t [::http::geturl "$ping(page)$text" -timeout 30000]
set data [::http::data $t]
set text [lindex [split $text] 0]
::http::cleanup $t
putlog "$ping(page)$text"
# putlog "$l"
if {[string is space $text]} {
putserv "PRIVMSG $chan :No IP given. Usage : !ping <IPADDRESS>"
return 0
} else {
set l [regexp -all -inline -- {<tr><td align="center">.*?</td><td>(.*?)</td><td align="center"><font color="#.*?"><b>(.*?)</b></font></td><td align="center">(.*?)</td></tr>} $data]
foreach {black a b c} $l {
set a [string trim [string map {{ } {} {\n} {}} $a]]
set b [string trim [string map {{ONLINE} {3ONLINE} {OFFLINE} {4OFFLINE} { } {} {\n} {}} $b]]
set c [string trim [string map {{ } {} {\n} {}} $c]]
putserv "PRIVMSG $chan :Address:14 $a Status: $b PING Speed:14 $c "
return 0
}
putserv "privmsg $chan :Sorry, $nick $text Not Valid IP"
}
}
-
CrunchyCap
- Voice
- Posts: 2
- Joined: Tue Jan 17, 2012 10:53 am
Post
by CrunchyCap »
I tried this out but get this error
Tcl error [ping]: invalid command name "::http::geturl"
Means I am missing a package or?
-
CrunchyCap
- Voice
- Posts: 2
- Joined: Tue Jan 17, 2012 10:53 am
Post
by CrunchyCap »
Add this as first line of the script to get it to work.
"package require http"
Thanks thommey!