6

In order to test a firewall, I want to send malformed packets to its interface, regardless of my routing table.

Is there a way to ask linux "send this exact tcp package, to this MAC address, regardless of any network configuration on the system"? I assume I'll need root acccess, but that's OK.

xhienne
  • 17,075
  • 2
  • 52
  • 68
Elazar Leibovich
  • 3,131
  • 5
  • 27
  • 28

4 Answers4

4

I would use nmap in root, it can already send quite all advanced spoofed packets with just some flags.

shellholic
  • 6,215
  • 1
  • 20
  • 15
4

Scapy is commonly used tool for this purpose. It can be used for creating any kind of packets.

snap
  • 631
  • 4
  • 6
2

hping3 gets cited as a way to do this sort of thing, without having to learn Python.

2

All previous answers are good, there is a number of very good tools to do that. If you want to take it a step further, writing a simple injector in C is actually quite easy.

Here is a sample of code I wrote a few years back: http://jve.linuxwall.info/ressources/code/forgetcp.c

Julien Vehent
  • 226
  • 1
  • 3
  • Excellent! That worked. Small thing, though, for the `-c` command line option, did you really mean `p.tcp.check = (int)optarg;` or were you thinking of using `p.tcp.check = atoi(optarg);`? – Alexis Wilke Nov 03 '22 at 17:59