{"id":13508144,"url":"https://github.com/h3xduck/RawTCP_Lib","last_synced_at":"2025-03-30T09:33:25.010Z","repository":{"id":42178052,"uuid":"352409449","full_name":"h3xduck/RawTCP_Lib","owner":"h3xduck","description":"A C library for creating and using TCP/IP packets with raw network sockets","archived":false,"fork":false,"pushed_at":"2024-12-20T13:03:22.000Z","size":8521,"stargazers_count":64,"open_issues_count":0,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T10:07:57.210Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/h3xduck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-28T18:40:02.000Z","updated_at":"2025-03-05T21:21:23.000Z","dependencies_parsed_at":"2025-03-17T10:13:48.567Z","dependency_job_id":null,"html_url":"https://github.com/h3xduck/RawTCP_Lib","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3xduck%2FRawTCP_Lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3xduck%2FRawTCP_Lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3xduck%2FRawTCP_Lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3xduck%2FRawTCP_Lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h3xduck","download_url":"https://codeload.github.com/h3xduck/RawTCP_Lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"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-08-01T02:00:48.847Z","updated_at":"2025-03-30T09:33:24.754Z","avatar_url":"https://github.com/h3xduck.png","language":"C","funding_links":[],"categories":["C","others","Protocols"],"sub_categories":["Network protocols"],"readme":"\n```\n██████╗  █████╗ ██╗    ██╗████████╗ ██████╗██████╗ \n██╔══██╗██╔══██╗██║    ██║╚══██╔══╝██╔════╝██╔══██╗\n██████╔╝███████║██║ █╗ ██║   ██║   ██║     ██████╔╝\n██╔══██╗██╔══██║██║███╗██║   ██║   ██║     ██╔═══╝ \n██║  ██║██║  ██║╚███╔███╔╝   ██║   ╚██████╗██║     \n╚═╝  ╚═╝╚═╝  ╚═╝ ╚══╝╚══╝    ╚═╝    ╚═════╝╚═╝     \n                                                   \n```\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/h3xduck/RawTCP_Lib)\n![Maintainability](https://img.shields.io/static/v1?label=maintainability\u0026message=B\u0026color=green)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/h3xduck/RawTCP_Lib)\n![GitHub last commit](https://img.shields.io/github/last-commit/h3xduck/RawTCP_Lib)\n\n\n# RawTCP_Lib\n\nRawTCP is a library to build custom TCP/IP packets from the ground and send/receive them using only raw sockets and the C language.\n\n## Features\n* Create custom TCP/IP packets with control over all their fields (including network flags).\n* Automatically build packets' checksums, or request a recalculation manually.\n* Send built packets over raw sockets.\n* **NEW:** Sniff incoming packets to your device, and operate with them later.\n\n## Use cases\nYou can have a look at my project [TCPcannon](https://github.com/h3xduck/TCPcannon) built on top of this library for an example!\n\n* Send spoofed network packets (fake source IP/port).\n* Build specific packets for network attacks (e.g SYN flooding).\n* Monitor your device network traffic.\n* Fast integration in your network application.\n  \n  \nNote: RawTCP uses the AF_INET address family so it supports both customization of the Network Layer (IP) and the Transport Layer (TCP) headers. Support for the Link Layer will come in future updates.\n\n\n\n## Installation\nRawTCP is built as an static library to facilitate integration with your project. \n1.  [Download](https://github.com/h3xduck/RawTCP_Lib/releases/latest) RawTCP and put it in your project directory.\n2.  Integrate it in your project\n    *  METHOD 1: With gcc compiler\n    ```sh\n    gcc \u003cyour-files\u003e libRawTCP_Lib.a\n    ```\n\n    * METHOD 2 With cmake\n    ```cmake\n    target_link_libraries(\u003cyour-target\u003e ${CMAKE_CURRENT_SOURCE_DIR}/libRawTCP_Lib.a)\n    ```\n    Note that you will need to specify the path to the library in both cases if you stored it under a project folder.\n3. Import \"RawTCP.h\" from a source file whenever you need RawTCP.\n\n## Examples\n### Create a TCP/IP packet\n```c\n//Packet indicates source=192.168.1.10:8000, dest=192.168.1.20:8080\npacket_t packet = build_standard_packet(8000, 8080, \"192.168.1.10\", \"192.168.1.20\", 4096, \"MyMessage\");\n```\n\n### Set TCP flag active\nRawTCP uses [hexadecimal notation](https://synfinner.blog/tcp-flags-hex-values) for the TCP flags. Multiple flags can be set at the same time by adding their values.\n```c\n//Setting both SYN and FIN flags\nset_TCP_flags(packet, 0x03);\n```\nRawTCP manages the recomputation of the checksums automatically.\n\n### Sending packet to destination\n```c\n//Destination port and destination IP are those specified when creating the packet.\nrawsocket_send(packet);\n```\nIMPORTANT: Raw sockets need root priviliges, so you will need them before you can run this specific function.\n### Continously sending packets\n```c\n//Sequence number \u0026 checksum automatically updated by OS\npacket_t packet = build_standard_packet(...)\nwhile(1){\n    rawsocket_send(packet);\n}\n```\n\n### Sniff incoming TCP packets\n```c\n//The packet can be used as if it was generated with build_standard_packet()\npacket_t packet = rawsocket_sniff();\n```\n\n## Issues?\nWhether it is a bug, question or suggestion, please [open a ticket](https://github.com/h3xduck/RawTCP_Lib/issues/new) and I will have a look at it as fast as I possibly can.\n## LICENSE\nThis software is licensed under the MIT license. See [LICENSE](https://github.com/h3xduck/RawTCP_Lib/blob/master/LICENSE)\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh3xduck%2FRawTCP_Lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh3xduck%2FRawTCP_Lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh3xduck%2FRawTCP_Lib/lists"}