Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Kristian Evensen <kristian.evensen@gmail.com>
To: aragonx@dcsnow.com
Cc: netfilter@vger.kernel.org
Subject: Re: Identifiying and modifying packets
Date: Thu, 26 Mar 2009 21:45:09 +0100	[thread overview]
Message-ID: <49CBE955.7030507@gmail.com> (raw)
In-Reply-To: <c8c16aac285fb28dc9a3c09a70855718.squirrel@www.dcsnow.com>

aragonx@dcsnow.com skrev:
>> Hi,
>>     
>>> Can someone tell me what tools I could use to examine outbound packet
>>> data
>>> for the usernames and modify it if it matches a list of accounts we want
>>> to block?
>>>
>>>
>>>       
>> I suggest writing your own netfilter-module that does the packet
>> inspection, and if a packet matches you can simply return NF_DROP to
>> instruct the kernel to drop the packet. A good tutorial/book is
>> available here: http://jengelh.medozas.de/
>>
>> Maybe you can do something similar with libpcap, but I am not sure if
>> you can drop packets.
>>     
>
> I would love to just drop the packets but this causes the client
> application to crash.  So I think I need to modify ones that match to an
> invalid user name.  I've seen it mentioned that libpcap can capture the
> traffic, I have not seen where it can modify and then send it on.  Can it
> do that?
>
>   
Yes, with Netfilter your modules recieve the skb and it will not be 
passed on until the module is finished with it. You can then toy around 
with it (including the payload) as much as you want. Section 5.6 in [1] 
shows an example of modifying the payload.

I am not sure about libpcap, I haven't used it for a while, but I think 
you only receive a copy and thus cannot change what is sent over the 
network.

-Kristian

[1] - http://jengelh.medozas.de/documents/Netfilter_Modules.pdf

  reply	other threads:[~2009-03-26 20:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 18:24 Identifiying and modifying packets aragonx
2009-03-26 19:23 ` Kristian Evensen
2009-03-26 19:43   ` aragonx
2009-03-26 20:45     ` Kristian Evensen [this message]
2009-03-26 20:54       ` Verify rules Scott Miller
2009-03-26 23:35         ` Mike Wright
2009-03-27  8:05         ` Mart Frauenlob
2009-03-27 17:15           ` Scott Miller
2009-03-27 18:49             ` Mike Wright
2009-03-27 18:58               ` Mike Wright
2009-03-27 19:49                 ` Scott Miller
2009-03-27 19:55                   ` Mike Wright
2009-03-27 20:12                     ` Scott Miller
2009-03-27 22:49                       ` Mart Frauenlob
2009-03-27 19:56                   ` Mike Wright
2009-03-27 19:25               ` Rob Sterenborg

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=49CBE955.7030507@gmail.com \
    --to=kristian.evensen@gmail.com \
    --cc=aragonx@dcsnow.com \
    --cc=netfilter@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