Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 2nd, 2001, 03:36 PM
sjbates sjbates is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: England, UK
Posts: 41 sjbates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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.

Reply With Quote
  #2  
Old July 2nd, 2001, 04:51 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
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

Reply With Quote
  #3  
Old July 2nd, 2001, 05:19 PM
sjbates sjbates is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: England, UK
Posts: 41 sjbates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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.

Reply With Quote
  #4  
Old July 2nd, 2001, 05:33 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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

Reply With Quote
  #5  
Old July 2nd, 2001, 06:54 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Quick search on Google.com

Look at:

http://whois.bw.org/

this may be a good start for a whois script

Good Luck

Reply With Quote
  #6  
Old July 2nd, 2001, 08:00 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
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);

Reply With Quote
  #7  
Old July 3rd, 2001, 12:57 PM
sjbates sjbates is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: England, UK
Posts: 41 sjbates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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.

Reply With Quote
  #8  
Old July 7th, 2001, 02:22 PM
sjbates sjbates is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: England, UK
Posts: 41 sjbates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > simple whois script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT