{"id":20445868,"url":"https://github.com/rapid7/resynth","last_synced_at":"2025-04-13T00:44:34.813Z","repository":{"id":156176908,"uuid":"621843119","full_name":"rapid7/resynth","owner":"rapid7","description":"A network packet synthesis language","archived":false,"fork":false,"pushed_at":"2025-01-20T11:41:49.000Z","size":418,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-13T00:44:31.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rapid7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-31T14:01:53.000Z","updated_at":"2025-01-29T21:29:00.000Z","dependencies_parsed_at":"2025-01-20T12:28:26.410Z","dependency_job_id":"68ea73bd-8305-48ae-94a0-56bb178aa486","html_url":"https://github.com/rapid7/resynth","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fresynth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fresynth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fresynth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fresynth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rapid7","download_url":"https://codeload.github.com/rapid7/resynth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650419,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:15:08.593Z","updated_at":"2025-04-13T00:44:34.793Z","avatar_url":"https://github.com/rapid7.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# resynth: A Network Packet Synthesis Language\n\n[![Latest Version](https://img.shields.io/crates/v/resynth)](https://crates.io/crates/resynth/)\n[![Documentation](https://img.shields.io/docsrs/resynth)](https://docs.rs/resynth/latest/resynth/)\n\n## About\nResynth is a packet synthesis language. It produces network traffic (in the\nform of pcap files) from textual descriptions of traffic. It enables\nversion-controlled packets-as-code workflows which can be useful for various\npacket processing, or security research applications such as DPI engines, or\nnetwork intrusion detection systems.\n\n\n## Examples\nHere is how you might represent an HTTP request and response in resynth:\n\n```\nimport ipv4;\nimport dns;\nimport text;\n\nlet cl = 192.168.0.1;\nlet sv = 109.197.38.8;\n\ndns::host(cl, \"www.scaramanga.co.uk\", ns: 8.8.8.8, sv);\n\nlet http = ipv4::tcp::flow(\n  cl/32768,\n  sv/80,\n);\n\nhttp.open();\n\nhttp.client_message(\n  text::crlflines(\n    \"GET / HTTP/1.1\",\n    \"Host: www.scaramanga.co.uk\",\n    text::CRLF,\n  )\n);\n\nhttp.server_message(\n  text::crlflines(\n    \"HTTP/1.1 301 Moved Permanently\",\n    \"Date: Sat, 17 Jul 2021 02:55:05 GMT\",\n    \"Server: Apache/2.4.29 (Ubuntu)\",\n    \"Location: https://www.scaramanga.co.uk/\",\n    \"Content-Type: text/html; charset=iso-8859-1\",\n    text::CRLF,\n  ),\n);\n\nhttp.server_close();\n```\n\nYou can compile this to a pcap file with the command `resynth http.rsyn` - a\nfile called `http.pcap` will be created.\n\n\n## Currently Supported Protocols\nNot only can you write arbitrary TCP, UDP, ICMP packets, raw IP packets, and IP\nfragments, but there are also library modules to help with crafting packets for\nthe following protocols:\n- VXLAN, ERSPAN Types I \u0026 II\n- DHCP\n- DNS\n- Netbios name service (NBNS)\n- TLS (early stages, still need support for SSL2 and common extensions,\n  although you can craft arbitrary TLS frames)\n- I/O: packets can be crafted which include the contents of external files\n\n\n## Why not use $OTHER\\_TOOL?\n- Scapy and python-based packet generation frameworks: they are incredibly slow\n  for my intended use-cases (fuzz-testing, live high-speed packet-generation),\n  even by the standards of what is possible in a pure python program. For very\n  high-rate applications, I don't think it would be possible to automatically\n  and transparently optimize scapy programs without adding some other layer\n  designed specifically to speed things up.\n- flowsynth: Flowsynth is really nice, and a big source of inspiration for\n  this. But it lacks support for higher-level protocols and that little bit of\n  extensibility which I really need.\n\n\n## Future Directions\nI plan to combine this with a DPDK-based packet generator in order to build a\nnetwork performance-testing suite (think T-Rex). The idea would be to add a\nmulti-instancing feature to the language to scale up the number of flows. The\nresynth programs would be compiled in to a set of pre-canned packet templates\nwhich could just be copied in to the tx ring-buffer with fields (eg. IP\naddresses and port numbers) modulated. This would move all of the expensive\nwork out of the packet transmit mainloop and allow us to generate traffic at\nupwards of 20Gbps per CPU.\n\nThe language is pretty bare-bones right now but I plan to add:\n- More builtin types: eg. signed integers, booleans, integers of various widths\n- Arithmetic and logical operators so that complex expressions can be built\n- The ability to coerce any type in to bytes\n- Syntax for concatenating buffers\n\nI plan to add support for the following protocols to the standard library:\n- Support for PMTU and segmentization of TCP messages\n- More direct support for HTTP\n- SMB2\n- ARP\n- DCE-RPC\n- More exotic TCP/IP interactions and better ICMP support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapid7%2Fresynth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapid7%2Fresynth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapid7%2Fresynth/lists"}