{"id":15190178,"url":"https://github.com/aojea/netkat","last_synced_at":"2025-10-27T13:30:31.126Z","repository":{"id":46965062,"uuid":"364681851","full_name":"aojea/netkat","owner":"aojea","description":"netcat using netstack userspace library and eBPF","archived":false,"fork":false,"pushed_at":"2021-09-20T08:59:59.000Z","size":10438,"stargazers_count":136,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T05:41:16.154Z","etag":null,"topics":["ebpf","gvisor","netcat","netstack"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aojea.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}},"created_at":"2021-05-05T19:13:42.000Z","updated_at":"2024-03-16T22:34:11.000Z","dependencies_parsed_at":"2022-09-07T22:22:59.672Z","dependency_job_id":null,"html_url":"https://github.com/aojea/netkat","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aojea%2Fnetkat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aojea%2Fnetkat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aojea%2Fnetkat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aojea%2Fnetkat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aojea","download_url":"https://codeload.github.com/aojea/netkat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238497658,"owners_count":19482295,"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":["ebpf","gvisor","netcat","netstack"],"created_at":"2024-09-27T20:05:41.428Z","updated_at":"2025-10-27T13:30:28.637Z","avatar_url":"https://github.com/aojea.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netkat\n\nnetcat version using raw sockets to avoid iptables and/or other OS filtering mechanisms.\n\n### Motivation\n\nKubernetes environments have a LOT of iptables, hence the necessity to bypass iptables sometimes, for testing, debugging, troubleshooting, ...\n\n![](https://i.imgur.com/ZwEMrbQ.jpg =400x)\n\n## Requirements\n\nIt only works on Linux with a Kernel version \u003e 5.2\nIt requires CAP_NET_RAW and CAP_SYS_RESOURCE capabilities\n... or just run it with `sudo` ;)\n\n## Install\n\n```sh\nmake build\n```\n\n## Usage\n\nIt requires root privileges:\n\n```sh\nsudo ./bin/netkat\nUsage: nk [options] [hostname] [port]\n\n  -debug\n        Debug\n  -interface string\n        Specify interface to use. Default interface with default route\n  -listen\n        Bind and listen for incoming connections\n  -source-port int\n        Specify source port to use\n  -udp\n        Use UDP instead of default TCP\n```\n\n### Docker image\n\nIt can be used as a container image, based in alpine:\n\n```sh\ndocker run -it --privileged aojea/netkat:latest 192.168.68.1 80\n2021/05/31 21:29:42 Using source address 172.17.0.2/16\n2021/05/31 21:29:42 Creating raw socket\n2021/05/31 21:29:42 Adding ebpf ingress filter on interface eth0\n2021/05/31 21:29:42 filter {LinkIndex: 99, Handle: 0:1, Parent: ffff:fff2, Priority: 0, Protocol: 3}\n2021/05/31 21:29:42 Creating user TCP/IP stack\n2021/05/31 21:29:42 Dialing ...\n2021/05/31 21:29:42 Connection established\n```\n\n## Development\n\nnetkat uses the [gvisor userspace TCP/IP stack \"netstack\"](https://pkg.go.dev/gvisor.dev/gvisor/pkg/tcpip)\n\nIt creates a RAW socket attached to the interface with the route to the destination IP,\nattaching a BPF filter for the traffic mathing the connection parameters specified as\narguments.\n\nIt also creates an ingress queue and attaches an eBPF filter, to drop the traffic of\nthe connection directed to the RAW socket, preventing that the host stack drops the\nconnection.\n\nMore details [here](development.md)\n\n## References\n\n- [eCHO episode 14: netkat with Antonio Ojea](https://hackmd.io/@Echo-Live/014)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faojea%2Fnetkat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faojea%2Fnetkat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faojea%2Fnetkat/lists"}