We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,852 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Doing a whois lookup against a .csv file

I have a shell script that currently pulls data from a mysql database and writes it to a .csv file. The problem is I would like to do a whois lookup against each public IP to see where they are coming from. I basically have two firewalls writing syslog data to a mysql database and want to make sense of the data.

.csv data output

"ReceivedAt","External","Hit_Count","Port"
"2010-04-21 00:04:43","189.24.154.198","1120","445"
"2010-04-21 00:17:16","221.195.73.86","14","1080"
"2010-04-21 00:17:07","221.195.73.86","12","8000"
"2010-04-21 05:12:12"," 119.39.248.178","10","22"
"2010-04-21 05:12:12","119.39.248.178","10","22"
"2010-04-21 09:26:51","222.37.37.33","8","1434"

Thanks in Advance,
-lo

2
Contributors
1
Reply
55 Minutes
Discussion Span
3 Years Ago
Last Updated
2
Views
-lodogg-
Newbie Poster
4 posts since Jan 2010
Reputation Points: 16
Solved Threads: 0
Skill Endorsements: 0

Hello,

try this where one.csv is your file and it will create a file with the IP address as the name with the whois data,

for x in `cat one.csv  | sed s/\"//g | awk -F, {' print $2 '} `; do  whois $x > $x; done
rch1231
Veteran Poster
1,040 posts since Sep 2009
Reputation Points: 142
Solved Threads: 154
Skill Endorsements: 12

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.5081 seconds using 2.63MB