{"id":25150265,"url":"https://github.com/wolfyangfan/porthog","last_synced_at":"2025-04-03T08:46:19.807Z","repository":{"id":274928947,"uuid":"924522293","full_name":"WolfYangFan/PortHog","owner":"WolfYangFan","description":"A minimalist port occupier that aggressively holds TCP ports for testing and development purposes.","archived":false,"fork":false,"pushed_at":"2025-02-19T00:00:55.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T00:29:29.222Z","etag":null,"topics":["golang","honeypot","http-server","port-scanner","tcp-protocol","tcp-server"],"latest_commit_sha":null,"homepage":"","language":"Go","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/WolfYangFan.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":"2025-01-30T06:51:33.000Z","updated_at":"2025-02-19T00:00:58.000Z","dependencies_parsed_at":"2025-01-30T07:31:03.085Z","dependency_job_id":"f5b888c5-5f62-4ebc-8aee-a33be0d893be","html_url":"https://github.com/WolfYangFan/PortHog","commit_stats":null,"previous_names":["wolfyangfan/porthog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WolfYangFan%2FPortHog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WolfYangFan%2FPortHog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WolfYangFan%2FPortHog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WolfYangFan%2FPortHog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WolfYangFan","download_url":"https://codeload.github.com/WolfYangFan/PortHog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246970341,"owners_count":20862508,"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":["golang","honeypot","http-server","port-scanner","tcp-protocol","tcp-server"],"created_at":"2025-02-08T22:18:12.215Z","updated_at":"2025-04-03T08:46:19.778Z","avatar_url":"https://github.com/WolfYangFan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PortHog 🐖\n\n\u003cp align=\"center\"\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/last-commit/WolfYangFan/PortHog.svg?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/issues-pr-closed/WolfYangFan/PortHog.svg?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/commit-activity/w/WolfYangFan/PortHog?style=for-the-badge\"\n  /\u003e\n  \u003cbr /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/languages/code-size/WolfYangFan/PortHog.svg?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/repo-size/WolfYangFan/PortHog?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/languages/count/WolfYangFan/PortHog?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/languages/top/WolfYangFan/PortHog?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/issues/WolfYangFan/PortHog?style=for-the-badge\"\n  /\u003e\n  \u003cimg\n    src=\"https://img.shields.io/github/issues-closed-raw/WolfYangFan/PortHog?style=for-the-badge\"\n  /\u003e\n  \u003cbr /\u003e\n  ⭐️ Your Star is very important for me!\n\u003c/p\u003e\n\nA minimalist port occupier that aggressively holds TCP ports for testing and development purposes.\n\nPerfect for reserving ports during CI/CD pipelines or local environment setup.\n\n---\n\n## Features 🚀\n\n- **Multi-port** occupancy with comma-separated values\n- **Port range** support using `start-end` syntax\n- **Instant connection termination** (RST packets)\n- **Graceful shutdown** with `SIGINT/SIGTERM` handling\n- **Connection monitoring** with detailed logging\n- **Zero dependencies** easy to use\n\n## Installation 📦\n\n```bash\n# Install latest version\ngo install github.com/WolfYangFan/PortHog@latest\n```\n\nor use [Github Actions Artifact](https://github.com/WolfYangFan/PortHog/actions)\n\n## Usage 💻\n\n### Basic\n\n```bash\nporthog -p PORT_SPEC\n```\n\n### Examples \n\n```bash\n# Single port + range combination\nporthog -p 8080,9000-9005,12345\n\n# Development mode with debug logs\nporthog -p 3000-3010 --level debug\n```\n\n### Sample Output\n\n```log\n2025/01/30 INFO PortHog started version=dev commit=unknown pid=114514\n2025/01/30 INFO Port occupied successfully port=80\n2025/01/30 INFO Received signal - initiating graceful shutdown... signal=interrupt\n2025/01/30 DEBUG Closing listener port=80\n2025/01/30 DEBUG Stopping listener port=80\n2025/01/30 INFO Shutdown completed\n```\n\n## Technical Details 🔧\n\n### Port Handling\n\n- Uses raw TCP listeners with `SO_REUSEADDR`\n- Immediate connection reset (SO_LINGER=0)\n- Background goroutine per port\n\n### Signal Handling\n\n```mermaid\ngraph TD\n    A[SIGINT/SIGTERM] --\u003e B{Active Listeners?}\n    B --\u003e|Yes| C[Close Listeners]\n    C --\u003e D[Wait 5s Timeout]\n    D --\u003e E[Force Exit]\n    B --\u003e|No| E\n```\n\n## Contributing 🤝\n\n1. Fork [this repository](https://git.213891.xyz/WolfYangFan/PortHog)\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit changes (`git commit -m 'Add amazing feature'`)\n4. Push to branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\nPlease follow our [Code of Conduct](CODE_OF_CONDUCT.md).\n\n## License 📜\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n\u003e \"Hog those ports like there's no tomorrow!\" 🐽💻","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfyangfan%2Fporthog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwolfyangfan%2Fporthog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfyangfan%2Fporthog/lists"}