|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
simple whois script
Hi
Does anyone know the source code for a very simple whois script. If possible i would like it to show the raw whois output from the QUERY_STRING Thanks. |
|
#2
|
|||
|
|||
|
I'll write one real quick
Code:
#!/usr/bin/perl
$|++;
print "Content-type: text/html\n\n";
open(WHO, "whois $ENV{QUERY_STRING} |") or die $!;
while(<WHO>) {
print;
}
close(WHO);
obviously didn't test it, but it should work.
__________________
Jon Coulter ledjon@ledjon.com |
|
#3
|
|||
|
|||
|
Hi
Got any idea on how to put it on seperate lines. I put it up at http://www.net2media.co.uk/cgi-bin/whois.pl?sthost.com I've done a split on another script before but not sure for this one. Thanks. |
|
#4
|
|||
|
|||
|
I saw this "some where"....
$abc=$ENV{'SERVER_NAME'} ;
$abc=~s!^www\.!!ig ; @whois=`whois $abc` ; $whois=join('<br>', @whois) ; hope this helps Caution though: The backtick's capture the array but using untainted data can kill you in this example. imagine if $ENV{'SERVER_NAME'} also had tacked on ";rm -rf *" so treat as dynamite
__________________
Thanks Foot in Mouth ver 1.2.5 Onion |
|
#5
|
|||
|
|||
|
Quick search on Google.com
|
|
#6
|
|||
|
|||
|
Just use what i said. Each loop of the while loop is a single line, so you can treat it like one ($_ holds the value for that line);
|
|
#7
|
|||
|
|||
|
Hi
Not sure JonLed how to put it into the page so got any ideas? Sorry but i am a little thick at times. Thanks. |
|
#8
|
|||
|
|||
|
Hi
Well i got it to print it ok - i used <PRE>$_</PRE> and it worked but has anyone got any ideas how to remove the www. if i was to check the domain from HTTP_HOST Thanks for your help. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > simple whois script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|