Sed Awk Bash Grep Ip Address from logs

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2007
Posts: 1
Reputation: xkmail is an unknown quantity at this point 
Solved Threads: 0
xkmail xkmail is offline Offline
Newbie Poster

Sed Awk Bash Grep Ip Address from logs

 
0
  #1
Jul 15th, 2007
I have a small server and want to ban ip address I get alot of spam from.
I use fedora 4 with iptables, spamassassin, clamav, and psotfix.
I get the line in /var/log/maillog that says:
Jul 14 20:52:33 xkmail amavis[15966]: (15966-06) Blocked SPAM, LOCAL [127.0.0.1] [216.22.18.252] <ret@threecurtain.com> -> <miranda@xkmail.hopto.org>,
Message-ID: <1184460111.5804@threecurtain.com>, mail_id: fiWKW0St3zjg, Hits: 25.766, 2123 ms
I want a simple script to get that ip address out of that line and run it in iptables using:
/sbin/iptables -I INPUT -i eth0 -s xxx.xxx.xxx.xxx -j DROP
I tried grep but looks like I need sed and cut, any input appreciated
kevin
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC