1822521 Members
2496 Online
109642 Solutions
New Discussion юеВ

script help too

 
SOLVED
Go to solution
file system
Frequent Advisor

script help too

I want to capture 80 port in the server every 10 minute.

1 have already done captured 80 port every 10 minute, but the output is not suitable

The output that I want is below.

Tue Apr 1 17:14:40 KST 2008
125.139.203.113 3028
210.106.190.136 8480
211.173.34.244 14596
211.221.23.87 14858
211.228.90.229 9625
211.238.90.65 7466
218.147.243.50 7506
218.238.250.32 8638
218.239.251.108 11265

Tue Apr 1 17:14:50 KST 2008
25.137.203.113 3028
210.106.190.136 8480
11.173.34.244 14596
211.221.23.87 14858
211.228.93.229 9625
211.238.92.65 7466
218.147.243.50 7506
218.238.250.32 8638
218.239.251.108 11265

1.print date and captured 80 port

help
how difficult it is for me..--;

can you give me much advice ? help
3 REPLIES 3
Change_happens
Honored Contributor

Re: script help too

what is output you are getting now?
i think u can just add date in first line each of file dont u?
Ivan Ferreira
Honored Contributor
Solution

Re: script help too

If you want to run continuously out of cron, you can do something like this:

while true
do
date
netstat -n | awk '{ print $5}'| grep ":80 " | tr ":" " " | sort -u -k 1,1
echo
sleep 600
done

If you run from cron, then you should use something like this:

LOGFILE=/var/log/capture
date >> $LOGFILE
netstat -n | awk '{ print $5}'| grep ":80 " | tr ":" " " | sort -u -k 1,1 >> $LOGFILE
echo >> $LOGFILE
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
file system
Frequent Advisor

Re: script help too

Thank you for all your reply.
I'm happy to get many helps from all of you

I'm appreciate that.