public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Perkel <mperkel@yahoo.com>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How would I do this? (expert tricks) OT
Date: Tue, 19 Jun 2007 12:36:00 -0700 (PDT)	[thread overview]
Message-ID: <684309.25266.qm@web52508.mail.re2.yahoo.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0706191919280.5731@fbirervta.pbzchgretzou.qr>


--- Jan Engelhardt <jengelh@computergmbh.de> wrote:

> 
> On Jun 19 2007 10:14, Marc Perkel wrote:
> >> 
> >> tcpdump -lni any port 25
> >> iptables -p tcp --dport 25 -j NFQUEUE
> >> ...
> >> 
> >
> >Thanks Jan, but I'm not sure it answers my
> question.
> 
> There's more than one way to do it.
> 
> One is...
> 	tcpdump -lni eth0 tcp [extra operands to match SYN
> packets] |
> 	myprogram
> 
> a longer one is to write your own netfilter
> userspace program
> that receives the TCP SYNs (by means of -j NFQUEUE)
> and does
> take action.
> 
> Another one is to use -j LOG and let your program
> parse
> down /var/log/firewall. Like
> 
> 	iptables -A INPUT -p tcp --dport 25 --syn -j LOG
> --log-prefix "[evil]"
> 	tail -f /var/log/firewall | grep '^\[evil\]' |
> myscript
> 
> myscript:
> #!/usr/bin/perl
> 
> while (defined(my $line = <>)) {
> 	my($ip) = ($line =~ /SRC=(\S+)/);
> 	# Do something
> }
> 
> >I want to run a script every time a connection
> attempt is made in real time
> 
> The scripts runs constantly, preferably.
> 
> >with the IP address as a parameter to the script.
> How would I do that? Suppose
> >my script is:
> >
> >iplog <ipaddress>
> >
> >
> >
> >
> >       
>
>____________________________________________________________________________________
> >Take the Internet to Go: Yahoo!Go puts the Internet
> in your pocket: mail, news, photos & more. 
> >http://mobile.yahoo.com/go?refer=1GNXIC
> >

Thanks Jan,

I think what you sent me is workable. I noticed it
goes to the file /var/log/messages. Is there a way to
make it go to a specific file? Thanks a lot for your
help. I've been experimenting with some new and very
interesting ways to catch spam and this could be yet
another breakthrough.






      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



  reply	other threads:[~2007-06-19 19:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 16:48 How would I do this? (expert tricks) OT Marc Perkel
2007-06-19 16:54 ` Jan Engelhardt
2007-06-19 17:14   ` Marc Perkel
2007-06-19 17:28     ` Jan Engelhardt
2007-06-19 19:36       ` Marc Perkel [this message]
2007-06-19 19:37         ` Jan Engelhardt
2007-06-27 20:02 ` Bill Davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=684309.25266.qm@web52508.mail.re2.yahoo.com \
    --to=mperkel@yahoo.com \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox