The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
whois VS jwhois and timeout PWSwebmaster Shell Programming and Scripting 4 02-15-2008 02:54 AM
Max's Whois 1.0 (Default branch) iBot Software Releases - RSS News 0 01-21-2008 09:00 PM
whois lookup from script intermittently not working aliberson Shell Programming and Scripting 0 06-23-2007 04:31 PM
scripting guru's pls help me with scripting on AIX thatiprashant Shell Programming and Scripting 1 01-20-2006 07:58 PM
Traceroute and Whois mystery DumDum IP Networking 2 07-03-2002 11:24 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-06-2008
stesecci stesecci is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
whois scripting

Hi guys,

I need a script that given an IP address, say IPA, do the following:

- queries "whois IPA"
- extracts, from the whois answer, the IP network string indicated after the string "route:",
- searches the IP network string in a given text file, say CIDR2ASN.txt, which has several lines, each line containing an IP network string and a number next (the ASN, autonomous system number indeed),
- gets the ASN and display it or save it into a file.

I know a little about unix scripting... I suppose I should use grep and cat commands within a for cycle and/or a case nest, any suggestion?

Best,
Ste
  #2 (permalink)  
Old 11-07-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,884
I don't know what "route" is. Your script will need other things, such as auto-detect of a forwarded whois-entry. But here's a start.
Code:
dnshosts=` whois tiscover.com @whois.ascio.com | awk '/Domain servers.*:/,0' | awk -v IGNORECASE=1 '/'tiscover.com'/  { print $1 }' `
for hostname in $dnshosts ; do 
  grep -F $hostname CIDR2ASN.txt
done
Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0