scapy icon indicating copy to clipboard operation
scapy copied to clipboard

Add TCPROS layer to contrib

Open vmayoral opened this issue 3 years ago • 2 comments

TCPROS is a transport layer for ROS Messages and Services. It uses standard TCP/IP sockets for transporting message data. Inbound connections are received via a TCP Server Socket with a header containing message data type and routing information. This class focuses on capturing the ROS Slave API.

An example package is presented below:

    B0 00 00 00 26 00 00 00 63 61 6C 6C 65 72 69 64  ....&...callerid
    3D 2F 72 6F 73 74 6F 70 69 63 5F 38 38 33 30 35  =/rostopic_88305
    5F 31 35 39 31 35 33 38 37 38 37 35 30 31 0A 00  _1591538787501..
    00 00 6C 61 74 63 68 69 6E 67 3D 31 27 00 00 00  ..latching=1'...
    6D 64 35 73 75 6D 3D 39 39 32 63 65 38 61 31 36  md5sum=992ce8a16
    38 37 63 65 63 38 63 38 62 64 38 38 33 65 63 37  87cec8c8bd883ec7
    33 63 61 34 31 64 31 1F 00 00 00 6D 65 73 73 61  3ca41d1....messa
    67 65 5F 64 65 66 69 6E 69 74 69 6F 6E 3D 73 74  ge_definition=st
    72 69 6E 67 20 64 61 74 61 0A 0E 00 00 00 74 6F  ring data.....to
    70 69 63 3D 2F 63 68 61 74 74 65 72 14 00 00 00  pic=/chatter....
    74 79 70 65 3D 73 74 64 5F 6D 73 67 73 2F 53 74  type=std_msgs/St
    72 69 6E 67                                      ring

vmayoral avatar Nov 28 '21 19:11 vmayoral

Thanks for the review @polybassa, I believe I addressed all comments. Let me know if I missed anything.

vmayoral avatar Dec 21 '21 08:12 vmayoral

One more remark. Could you please add build and dissect tests for all your packet classes.

polybassa avatar Dec 22 '21 08:12 polybassa

@vmayoral Are you still interested in this?

stryngs avatar Dec 06 '22 08:12 stryngs

@stryngs I am, but I haven't had bandwidth to meet what @polybassa requested above. It may take a while for me to find time for it. Any help would be appreciated.

vmayoral avatar Dec 06 '22 09:12 vmayoral

@vmayoral I will take a look and see what I can come up with. Scapy handling ROS (eventually mavlink?) would be terrific.

stryngs avatar Dec 06 '22 16:12 stryngs

@vmayoral I will take a look and see what I can come up with. Scapy handling ROS (eventually mavlink?) would be terrific.

Thanks. Ping me if you can address the comments above and happy to push together. The current contribution focuses on TCPROS (ROS1). UDPROS is pretty straightforward from this implementation.

As for ROS 2, we got that merged already at https://github.com/secdev/scapy/pull/3403.

Regarding MAVLink, you can easily process that today with dissectors like https://github.com/lsalab/scapy_mavlink. Integrating that upstream would be an awesome contribution indeed as it'll allow you to (as you hint) dissect combinations.

vmayoral avatar Dec 06 '22 17:12 vmayoral

(very sorry for the delay)

gpotter2 avatar Feb 04 '24 19:02 gpotter2

Codecov Report

Merging #3462 (257cb9a) into master (6c7c35f) will increase coverage by 29.07%. Report is 485 commits behind head on master. The diff coverage is 55.17%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3462       +/-   ##
===========================================
+ Coverage   52.12%   81.19%   +29.07%     
===========================================
  Files         168      346      +178     
  Lines       37989    81641    +43652     
===========================================
+ Hits        19802    66290    +46488     
+ Misses      18187    15351     -2836     
Files Coverage Δ
scapy/contrib/tcpros.py 55.17% <55.17%> (ø)

... and 332 files with indirect coverage changes

codecov[bot] avatar Feb 04 '24 19:02 codecov[bot]