Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Can I Ping in REBOL?

 [1/8] from: geraint::jones::meirion-dwyfor::ac::uk at: 17-Apr-2001 11:08


Hello REBOLers, I have just started learning REBOL and have found it to be easy so far (that could be because I am only on Chapter 6 of The Official Guide!). My congrats to Carl Sassenrath for designing such a different but nice language. Now to the problem I have: I am a Computer Technician for a college in the UK and the Network Administrator here wants to write a CGI Ping tool. He is fluent in Perl but there are severe limitations with implementing the tool with this language, i.e. to use TCP/IP Perl requires that the user of the tool be logged-in as root (an unacceptable security risk). So he asked me to look into it with REBOL, hence the big question: How do I write a Ping type tool with REBOL, that can use TCP/IP and is autonomous? And it's not possible with REBOL, will another language do it? Geraint Jones.

 [2/8] from: mat:eurogamer at: 17-Apr-2001 11:56


Heya Geraint, GJ> Now to the problem I have: I am a Computer Technician for a GJ> college in the UK and the Network Administrator here wants to GJ> write a CGI Ping tool. No. RT hath decreed that there is no use for ICMP in Rebol. So we've had to use other languages for that task. GJ> will another language do it? Certainly. -- Mat Bettinson - EuroGamer's Gaming Evangelist with a Goatee http://www.eurogamer.net | http://www.eurogamer-network.com

 [3/8] from: geraint:jones:meirion-dwyfor:ac at: 17-Apr-2001 13:19


17/04/01 13:56:29, Mat Bettinson <[mat--eurogamer--net]> wrote:
>Heya Geraint, >GJ> Now to the problem I have: I am a Computer Technician for a
<<quoted lines omitted: 4>>
>GJ> will another language do it? >Certainly.
Thanks for the response, but since Perl can't use ICMP without being logged-in as the root user and it won't work properly with other protocols, which CGI language can we use to ping our own server periodically where security is an issue? Or is it possible to code our own ICMP functions in REBOL or Perl, and if so, how (bearing in mind that I am an amateur REBOL programmer but the Network Administrator here is fluent in Perl)? Geraint Jones.

 [4/8] from: mat:eurogamer at: 17-Apr-2001 13:43


Heya Geraint, GJ> Thanks for the response, but since Perl can't use ICMP without being logged-in as the root user and it won't GJ> work properly with other protocols, which CGI language can we use to ping our own server periodically where GJ> security is an issue? Or is it possible to code our own ICMP functions in REBOL or Perl, and if so, how (bearing GJ> in mind that I am an amateur REBOL programmer but the Network Administrator here is fluent in Perl)? You could always use Rebol/view/pro and call an external application to do the pinging? I wrote a whole load of game server polling stuff in Rebol (UDP funkiness) and then found someone had written a command line application that did just about every game server under the sun and also had a funky raw output with your own delimiter chosen. Threw out all my code and slapped that in. It's currently running under Rebol/Command but I've just bought view/pro so I'll probably run that as my other network stuff doesn't work properly under /command. -- Mat Bettinson - EuroGamer's Gaming Evangelist with a Goatee http://www.eurogamer.net | http://www.eurogamer-network.com

 [5/8] from: joel:neely:fedex at: 17-Apr-2001 2:47


Perhaps all is not gloomy... Geraint Jones wrote:
> 17/04/01 13:56:29, Mat Bettinson <[mat--eurogamer--net]> wrote: > >GJ> Now to the problem I have: I am a Computer Technician for a
<<quoted lines omitted: 12>>
> periodically where security is an issue? Or is it possible to code > our own ICMP functions in REBOL or Perl, and if so, how ...
What's wrong with ping? Is there some local security rule? Can you run ping from the command line under the same account that the web server runs as? If so, I submit the following:
> cat ping.pl.cgi
#!/usr/local/bin/perl -w use strict; my $HOSTNAME = "x.y.z.com"; # name changed to protect my job ;-) open (PING, "ping -q -c 5 $HOSTNAME |"); my @results = <PING>; close (PING); print <<PAGE; <html> <head> <title>Ping results for $HOSTNAME</title> </head> <body> <h1>Ping results for $HOSTNAME</h1> <pre>@results</pre> </body> </html> PAGE exit (0); which I can run to get the following output:
> ./ping.pl.cgi
<html> <head> <title>Ping results for x.y.z.com</title> </head> <body> <h1>Ping results for x.y.z.com</h1> <pre>PING x.y.z.com (300.301.302.303) from 300.301.302.303 : 56(84) bytes of data. --- x.y.z.com ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 80.1/97.7/110.1 ms </pre> </body> </html> (which is actual output, except for the mangling of host name and IP addresses). Translating the above into REBOL "is left as an exercise for the reader"... ;-) -jn-

 [6/8] from: holger:rebol at: 17-Apr-2001 6:42


On Tue, Apr 17, 2001 at 11:08:05AM +0100, Geraint Jones wrote:
> Hello REBOLers, > > Now to the problem I have: I am a Computer Technician for a college in the UK and the Network Administrator here wants to write a CGI Ping tool. He is > fluent in Perl but there are severe limitations with implementing the tool with this language, i.e. to use TCP/IP Perl requires that the user of the tool be > logged-in as root (an unacceptable security risk). So he asked me to look into it with REBOL, hence the big question: How do I write a Ping type tool with > REBOL, that can use TCP/IP and is autonomous? And it's not possible with REBOL, will another language do it?
Ping always requires root permission, with any language. This is a side effect of the way ICMP works in Unix, not a limitation of any particular language. There are two ways to get root permission. One is to be logged in as root, the other one is to install the program that needs to ping with "setuid root". That's how "/sbin/ping" is typically installed. This limitation of ICMP is exactly the reason why REBOL currently does not provide an ICMP scheme. There are two workarounds though: if you only want to check for connecticity you could use UDP instead of ICMP. That is what traceroute does, for example. The other possibility is to call "/sbin/ping" as an external program from REBOL/Command, REBOL/View/Pro or the upcoming REBOL/Core/Pro. -- Holger Kruse [holger--rebol--com]

 [7/8] from: ptretter:charter at: 17-Apr-2001 10:51


Purchase REBOL/View/Pro and use shell features. I know I can get it to work on my win2k box. Paul Tretter

 [8/8] from: depotcity:telus at: 17-Apr-2001 10:22


To ping on Win2k with /View/Pro... Rebol [] n: "" call/output ["ping www.rebol.com"] n print n

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted