Skip to contentSkip to conversation

question

DISCUSSION Marcin Giedz 4 participants 11 messages Oct 27, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I'd like to ask if it possible to change "data" field (its content) in TCP packet on fly? I don't need to change data's lenght but only change few bytes in it.

Example:

0000  ff ff ff ff ff ff 00 11 25 31 ad e0 08 00 45 00   ........%1....E.
0010  00 c1 0a b1 00 00 80 11 82 0f ac 13 01 59 ff ff   .............Y..
0020  ff ff 04 2d 01 db 00 ad 60 78 ad a7 5b de 9f 26   ...-....`x..[..&
0030  ec 98 2d 26 ec 18 2d 26 ec 18 2d 26 ec 18 2d 26   ..-&..-&..-&..-&
0040  ec 18 2d 26 ec 18 2d 26 ec 18 2d 26 ec 18 2d 26   ..-&..-&..-&..-&

First line contains MAC address 00:11:25:31:ad:e0 - I need to change it to other value.

Is it possible at all?

Marcin

#1 lore raw

Hi Marcin,

Quoted 5 lines

I'd like to ask if it possible to change "data" field (its content) in TCP packet on fly? I don't need to change data's lenght but only change few bytes in it.

Example:
0000 ff ff ff ff ff ff 00 11 25 31 ad e0 08 00 45 00 ........%1....E.

much you can do with tcpdump.

Regards,
Ruprecht

------------------------------------------------------------------------------------------
Ruprecht Helms IT-Service & Softwareentwicklung

Tel./Fax +49[0]7621 16 99 16
Web: htp://www.rheyn.de

#2 lore raw

Dnia czwartek, 27 pa¼dziernika 2005 10:18, Ruprecht Helms napisa³:

Quoted 10 lines

Hi Marcin,

Quoted 6 lines

I'd like to ask if it possible to change "data" field (its content) in TCP packet on fly? I don't need to change data's lenght but only change few bytes in it.

Example:
0000 ff ff ff ff ff ff 00 11 25 31 ad e0 08 00 45 00 ........%1....E.

much you can do with tcpdump.

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

Marcin

Quoted 9 lines

Regards,
Ruprecht

---------------------------------------------------------------------------
--------------- Ruprecht Helms IT-Service & Softwareentwicklung

Tel./Fax +49[0]7621 16 99 16
Web: htp://www.rheyn.de

#3 lore raw
Quoted 3 lines · Marcin Giedz

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

You are right. As I know it only dump.
What you need is a hexeditor or you are looking for a tool that do hexediting in the fly.

But that is offtopic in this list.

Regards,
Ruprecht

#4 lore raw
Quoted 8 lines · Ruprecht Helms
Quoted 4 lines · Marcin Giedz

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

Quoted 5 lines

You are right. As I know it only dump.
What you need is a hexeditor or you are looking for a tool that do hexediting in the fly.

But that is offtopic in this list.

I think he needs a packet mangling tool: he's not offtopic.

#5 lore raw
In reply to Ruprecht Helms

Dnia czwartek, 27 pa¼dziernika 2005 11:09, Ruprecht Helms napisa³:

Quoted 8 lines
Quoted 3 lines · Marcin Giedz

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

You are right. As I know it only dump.
What you need is a hexeditor or you are looking for a tool that do hexediting in the fly.

Absolutely!

Quoted 2 lines

But that is offtopic in this list.

But I really don't know where to start? Perhaps some did it earlier.

Marcin

Quoted 3 lines

Regards,
Ruprecht

#6 lore raw

Hi Marcin,

iptables and netfilter will not do the job, unless you are willing to sacrifice stability and security. The problem is that the strings that netfilter will see are broken down into smaller pieces. So the string "iptables and netfilter" might actually be transmitted as "iptables and" and then "netfilter" in a separate packet. On top of this, people might try to intentionally break your filters by fragmenting the above string into "i", "p", "t", ... etc packets.

The good thing to do in this case, is to wait until the TCP stream has reached the application layer and has been reassembled properly. Hence, you will want to either write your own proxy, or to use someone elses proxy.

If you want to use it, I just uploaded a tunnel/proxy program to
http://www.frozentux.net/stunnel.tgz. This is an unfinished program I started on a couple of years ago. It is written in C. It is horribly coded and pretty much sucks, but it has no memory leaks and might serve as a starting point.

Have a nice day;).

Quoted 23 lines · Marcin Giedz
Quoted 8 lines · Ruprecht Helms
Quoted 3 lines · Marcin Giedz

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

You are right. As I know it only dump.
What you need is a hexeditor or you are looking for a tool that do hexediting in the fly.

Absolutely!

Quoted 2 lines

But that is offtopic in this list.

But I really don't know where to start? Perhaps some did it earlier.

Marcin

Quoted 3 lines

Regards,
Ruprecht

#7 lore raw

Dnia czwartek, 27 pa¼dziernika 2005 12:04, Oskar Andreasson napisa³:

Quoted 15 lines

Hi Marcin,

iptables and netfilter will not do the job, unless you are willing to sacrifice stability and security. The problem is that the strings that netfilter will see are broken down into smaller pieces. So the string "iptables and netfilter" might actually be transmitted as "iptables and" and then "netfilter" in a separate packet. On top of this, people might try to intentionally break your filters by fragmenting the above string into "i", "p", "t", ... etc packets.

The good thing to do in this case, is to wait until the TCP stream has reached the application layer and has been reassembled properly. Hence, you will want to either write your own proxy, or to use someone elses proxy.

Quoted 5 lines

If you want to use it, I just uploaded a tunnel/proxy program to
http://www.frozentux.net/stunnel.tgz. This is an unfinished program I started on a couple of years ago. It is written in C. It is horribly coded and pretty much sucks, but it has no memory leaks and might serve as a starting point.

Great!!! Really thanks but I just can't reach your program - above address doesn't work :( Could you please do something or send the program on my private mail.

Thanks once again,
Marcin

Quoted 24 lines

Have a nice day;).

Quoted 20 lines · Marcin Giedz

Dnia czwartek, 27 pa¼dziernika 2005 11:09, Ruprecht Helms napisa³:

Quoted 8 lines
Quoted 3 lines · Marcin Giedz

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

You are right. As I know it only dump.
What you need is a hexeditor or you are looking for a tool that do hexediting in the fly.

Absolutely!

Quoted 1 line

But that is offtopic in this list.

But I really don't know where to start? Perhaps some did it earlier.

Marcin

Quoted 2 lines

Regards,
Ruprecht

#8 lore raw
Quoted 22 lines · Marcin Giedz
Quoted 15 lines · Oskar Andreasson

Hi Marcin,

iptables and netfilter will not do the job, unless you are willing to sacrifice stability and security. The problem is that the strings that netfilter will see are broken down into smaller pieces. So the string "iptables and netfilter" might actually be transmitted as "iptables and" and then "netfilter" in a separate packet. On top of this, people might try to intentionally break your filters by fragmenting the above string into "i", "p", "t", ... etc packets.

The good thing to do in this case, is to wait until the TCP stream has reached the application layer and has been reassembled properly. Hence, you will want to either write your own proxy, or to use someone elses proxy.

Quoted 5 lines

If you want to use it, I just uploaded a tunnel/proxy program to
http://www.frozentux.net/stunnel.tgz. This is an unfinished program I started on a couple of years ago. It is written in C. It is horribly coded and pretty much sucks, but it has no memory leaks and might serve as a starting point.

Quoted 4 lines

Great!!! Really thanks but I just can't reach your program - above address doesn't work :( Could you please do something or send the program on my private mail.

Sorry about that, I got an urgent task on my desk and forgot to upload the file:). It's uploaded now. Do note that this is just a very ugly framework really, you need to do all the parsing etc on your own, and I have a bad habit of not commenting work in progress projects... =)

Quoted 27 lines

Thanks once again,
Marcin

Quoted 24 lines

Have a nice day;).

Quoted 20 lines · Marcin Giedz
Quoted 8 lines · Ruprecht Helms
Quoted 3 lines · Marcin Giedz

I don't get it :(
How with tcpdump as tcpdump is only dump traffic tool - as I know it can't change anything or I'm wrong?

You are right. As I know it only dump.
What you need is a hexeditor or you are looking for a tool that do hexediting in the fly.

Absolutely!

Quoted 1 line

But that is offtopic in this list.

But I really don't know where to start? Perhaps some did it earlier.

Marcin

Quoted 2 lines

Regards,
Ruprecht

#9 lore raw
Quoted 4 lines

Sorry about that, I got an urgent task on my desk and forgot to upload the file:). It's uploaded now. Do note that this is just a very ugly framework really, you need to do all the parsing etc on your own, and I have a bad habit of not commenting work in progress projects... =)

Hmm.. still have the same problem - sorry :( I tried http://www.frozentux.net
as well but it seems like some problems with PHP script :(

BR,
Marcin

#10 lore raw

Shit happens, but now it works again. the admin of my site decided to switch the dns records over to a temporary site while they are upgrading the machine. my local dns server cached the old records while you seem to have gotten to the new servers, and i didn't see it.

To make a long story short, it's fixed. Same place as previously mentioned... 3rd times the charm *crossing fingers* =)

Quoted 10 lines · Marcin Giedz
Quoted 4 lines

Sorry about that, I got an urgent task on my desk and forgot to upload the file:). It's uploaded now. Do note that this is just a very ugly framework really, you need to do all the parsing etc on your own, and I have a bad habit of not commenting work in progress projects... =)

Hmm.. still have the same problem - sorry :( I tried http://www.frozentux.net
as well but it seems like some problems with PHP script :(

BR,
Marcin