in reply to Re^4: Setting MAC addresses with Net::Frame::Simple
in thread Setting MAC addresses with Net::Frame::Simple
I believe your issue is Net::Write::Layer3 while trying to pass an Ethernet header. Try using Net::Write::Layer2 for your $oWrite object.
The frame you're creating ($eth, $ip4, $tcp) works fine for me using Perl Packet Crafter (see Re: Net::RawIP for IPv6) on Windows 7 x64 with Strawberry 5.22.1 x64. On Windows, the Net::Write packages won't install which is why I rolled my own in the form of PPC.
UPDATE:
VinsWorldcom@C:\Users\VinsWorldcom> ppc -i wlan0 Welcome to Perl Packet Crafter (PPC) Version: 1.11 wlan0 ppc> $src = '1.1.1.39'; ppc> $target = '1.1.1.99'; ppc> $port = 22; ppc> $eth = Net::Frame::Layer::ETH->new(src => "00:0c:29:d1:03:06", ds +t => "03:03:03:03:03:03"); ppc> $ip4 = Net::Frame::Layer::IPv4->new(src => $src,dst => $target); ppc> $tcp = Net::Frame::Layer::TCP->new(dst => $port, options => "\x02 +\x04\x54\x0b",payload => 'test'); ppc> $oSimple = packet $eth,$ip4,$tcp; ppc> hexdump $oSimple; 0x00000: 03 03 03 03 03 03 00 0c 29 d1 03 06 08 00 45 00 ........).. +...E. 0x00010: 00 30 b5 65 00 00 80 06 80 d7 01 01 01 27 01 01 .0.e....... +..'.. 0x00020: 01 63 e8 9c 00 16 13 b4 a0 f0 00 00 00 00 60 02 .c......... +...`. 0x00030: ff ff c0 0e 00 00 02 04 54 0b 74 65 73 74 ........T.t +est ppc> print $oSimple->print; ETH: dst:03:03:03:03:03:03 src:00:0c:29:d1:03:06 type:0x0800 IPv4: version:4 hlen:5 tos:0x00 length:48 id:46437 IPv4: flags:0x00 offset:0 ttl:128 protocol:0x06 checksum:0x80d7 IPv4: src:1.1.1.39 dst:1.1.1.99 TCP: src:59548 dst:22 seq:0x13b4a0f0 ack:0x0000 TCP: off:0x06 x2:0x0 flags:0x02 win:65535 checksum:0xc00e urp:0x0 +0 TCP: optionsLength:4 options:0204540b TCP: payload:74657374 ppc> sendp $oSimple; . Sent 1 packet ppc>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Setting MAC addresses with Net::Frame::Simple
by iThunder (Beadle) on Nov 20, 2016 at 08:32 UTC |