Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello, I am looking for advice on how to parse my log files. I want to get the IPAddresses and the ports their scanning. I dont quite understand GREP or SED enough on how to parse the various IP and Port Numbers in Linux.
I am looking for advice on how to parse my log files.
What logfiles? Portscanning usually means a group of ports covered over a period of time by one or multiple IP addresses. Manual correllation will be tedious and prolly errorprone. If you want to see a lot of interesting details use Snort's portscan detection, else search Freshmeat for something simple like PSAD, ippl or portsentry.
well yes so you need to use a text processing language / app like grep or sed or perl or awk to do this... off the top of my head i couldn't guess what your log files look like.....
How would one Grep for just the IP Addresses?
Should show the remote IP and local destination port for all of today's incoming traffic destined for this box:
d=$(date '+%b %e'); ipaddr=$(hostname -i)
grep /var/log/messages -ie "${d}.*kernel:.*DST=$ipaddr"\
|tr -s " "|cut -d " " -f 10,18|sed -e "s/D..=//g"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.