Closed kb1lqc closed 6 years ago
srcPacket = (IP(dst=destHost,
src=TUNMonitor._TUN._tun.addr) /
UDP(sport=9998,
dport=destPort) / "Hello, world!").__bytes__()
This results in a scapy.show()
IP parse of:
tests/test_tun.py::test_tunSend ###[ IP ]###
version = 4
ihl = 5
tos = 0x0
len = 41
id = 1
flags =
frag = 0
ttl = 64
proto = udp
chksum = 0x66c1
src = 10.0.0.1
dst = 10.0.0.2
\options \
###[ UDP ]###
sport = 9998
dport = 9999
len = 21
chksum = 0x5c58
###[ Raw ]###
load = 'Hello, world!'
Printing the hexlify value of this packet results in:
4500002900010000401166c10a0000010a000002270e270f00155c5848656c6c6f2c20776f726c6421
Printing the raw hex of this packet also results in:
E\x00\x00)\x00\x01\x00\x00@\x11f\xc1\n\x00\x00\x01\n\x00\x00\x02'\x0e'\x0f\x00\x15\\XHello, world!
This is NOT yet SLIP encoded.
A SLIP encoded version of the IP packet sending "Hello, world!" looks like:
\xc0E\x00\x00)\x00\x01\x00\x00@\x11f\xc1\n\x00\x00\x01\n\x00\x00\x02'\x0e'\x0f\x00\x15\\XHello, world!\xc0
Here's an example of an IP packet which contains a string with a SLIP escape character. SLIP is forced to escape the escape character within the string.
This string has \xdb which should escape in SLIP
When printed with scapy.show()
we can see the following output:
###[ IP ]###
version = 4
ihl = 5
tos = 0x0
len = 73
id = 1
flags =
frag = 0
ttl = 64
proto = udp
chksum = 0x66a1
src = 10.0.0.1
dst = 10.0.0.2
\options \
###[ UDP ]###
sport = 9998
dport = 9999
len = 53
chksum = 0xaade
###[ Raw ]###
load = b'This string has \xdb which should escape in SLIP'
Here is the hexlify format
4500004900010000401166a10a0000010a000002270e270f0035aade5468697320737472696e672068617320db2077686963682073686f756c642065736361706520696e20534c4950
The raw hex being sent is:
E\x00\x00I\x00\x01\x00\x00@\x11f\xa1\n\x00\x00\x01\n\x00\x00\x02'\x0e'\x0f\x005\xaa\xdeThis string has \xdb which should escape in SLIP
and finally the raw hex of the SLIP encoded IP packet
\xc0E\x00\x00I\x00\x01\x00\x00@\x11f\xa1\n\x00\x00\x01\n\x00\x00\x02'\x0e'\x0f\x005\xaa\xdeThis string has \xdb\xdd which should escape in SLIP\xc0
Closing this ticket as basic documentation of the expected serial port SLIP protocol IP packets has been completed. See the wiki page I created to satisfy this issue ticket.
https://github.com/FaradayRF/faradayio/wiki/SLIP-Encoded-IP-Packets
This ticket with help @kb1lqd by providing a wiki-based documentation of the expected SLIP format packets being sent over the serial port from the TUN interface
Goals
Wiki page with this documentation is: https://github.com/FaradayRF/faradayio/wiki/SLIP-Encoded-IP-Packets