| | |
Sed Awk Bash Grep Ip Address from logs
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2007
Posts: 1
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Searching WinXP using win-bash and Gnu grep (Computer Science)
- case statement (meaning of this block of code) (Shell Scripting)
- Help with SED/AWK email parser (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: script not working in RedHat Linux.
- Next Thread: How to remove spaces from a string
| Thread Tools | Search this Thread |





