{"id":13775769,"url":"https://github.com/nccgroup/binproxy","last_synced_at":"2025-04-06T02:09:36.260Z","repository":{"id":10109009,"uuid":"64512719","full_name":"nccgroup/BinProxy","owner":"nccgroup","description":"BinProxy is a proxy for arbitrary TCP connections. You can define custom message formats using the BinData gem.","archived":false,"fork":false,"pushed_at":"2022-12-01T00:56:43.000Z","size":125,"stargazers_count":176,"open_issues_count":13,"forks_count":44,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-30T01:08:25.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2016/september/introducing-binproxy/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nccgroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-29T21:57:40.000Z","updated_at":"2025-02-08T01:41:34.000Z","dependencies_parsed_at":"2022-08-08T19:30:33.485Z","dependency_job_id":null,"html_url":"https://github.com/nccgroup/BinProxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FBinProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FBinProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FBinProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nccgroup%2FBinProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nccgroup","download_url":"https://codeload.github.com/nccgroup/BinProxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"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-03T17:01:49.171Z","updated_at":"2025-04-06T02:09:36.240Z","avatar_url":"https://github.com/nccgroup.png","language":"Ruby","funding_links":[],"categories":["\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"0ff94312f3ab4898f5996725133ea9d1\"\u003e\u003c/a\u003e未分类"],"readme":"## Overview\n\nBinProxy is a proxy for arbitrary TCP connections.  You can define custom message\nformats using the [BinData] gem.\n\n[BinData]: https://github.com/dmendel/bindata/wiki\n\n## Installation\n\n### Prerequisites\n\n* Ruby 2.3 or later\n* A C compiler, Ruby headers, etc., are needed to compile several\n  dependencies.\n  * On Ubuntu, `sudo apt install build-essential ruby-dev` should do it.\n  * If you've installed a custom Ruby (e.g. with RVM), you probably already\n    have what you need.\n* `openssl` binary for `--tls` without an explicit cert/key.\n* To build the UI, node.js and npm.  (Not needed at runtime)\n\n### From Rubygems\n\n~~~bash\ngem install binproxy\n~~~\n\nYou may need to use `sudo`, depending on your Ruby installation.\n\n### From Source\n\n~~~sh\ngit clone https://github.com/nccgroup/BinProxy.git binproxy\ncd binproxy\n\n# Install ruby dependencies.\n# Depending on your setup, one or both of these may require sudo.\ngem install bundler \u0026\u0026 bundle\n\n# The UI is built with a webpack/babel toolchain:\n(cd ui \u0026\u0026 npm install) \\\n  \u0026\u0026 rake build-ui\n\n# Confirm that everything works\n# run.sh sets up the environment and passes all args to binproxy\n./run.sh --help\n~~~\n\nTo build and install the gem package:\n\n~~~sh\ngem build binproxy.gemspec\n\n# Again, you may need sudo here\ngem install binproxy-1.0.0.gem\n~~~\n\nBug reports on installation issues are welcome!\n\n## Usage\n\n### Basic Usage\n\n1. Run `binproxy` with no arguments.\n2. Browse to http://localhost:4567/\n3. Enter local and remote hostnames or IP addresses and ports, and click\n   'update'\n4. Point a client at the local service, and watch the packets flow.\n\n### Command Line Flags\n\nSee `--help` for the complete list, but in short:\n\n~~~sh\nbinproxy -c \u003cclass\u003e [\u003clocal-host\u003e] \u003clocal-port\u003e \u003cremote-host\u003e \u003cremote-port\u003e\n~~~\n\nIf you leave out the `-c` argument, a simple hex dump is shown.\n\nIf you leave out the local host, binproxy assumes localhost.\n\nWith the `--socks-proxy` or `--http-proxy` options, the remote host and port\nare determined dynamically, and should not be specified.\n\n#### Examples\n\n~~~sh\n# Proxy from localhost:9000 -\u003e example.com:9000\nbinproxy localhost 9000 example.com 9000\n\n# Act as a SOCKS proxy on localhost:1080\n# MITM and unwrap TLS on the proxied traffic, using a self-signed cert and key\nbinproxy -S --tls 1080\n\n# \"Poor substitute for Burp\" mode:\n#\n# HTTP proxy; MITM TLS w/ pre-generated cert; simple header parsing\n# Note: this will only work on HTTPS traffic, not plain HTTP!\n# If you're working with the source repo, you generate the certs with:\n#   rake makecert[example.com]\n# And then import certs/ca-cert.pem into your browser or OS's trust store.\nbinproxy -H --tls \\\n  --tls-cert certs/example.com-cert.pem \\\n  --tls-key certs/example.com-key.pem \\\n  --class-name DumbHttp::Message \\\n  localhost 8080\n~~~\n\n### Customizing\n\nBy default, the proxy uses the built-in RawMessage class, which just gives\nyou a hexdump of each message (assuming 1:1 between messages and TCP packets)\n\nYou can view parsed protocol information by specifying a BinData::Record\nsubclass† with the `--class` command line argument.\n\nYou may also wish to define the following in your class:\n\n~~~ruby\ndef summary\n  # return a single-line description of this record\nend\n\n# currently supported options are\n#   - nil : use default display\n#   - \"anon\" : for structs, show contents directly\n#   - \"hex\" : for numbers, display as 0x1234ABCD\n#   - \"hexdump\" : for strings, display like `hexdump -C`\ndefault_parameter display_as: \"...\"\n\n# TODO: document state stuff\ndef self.initial_state\nend\n\ndef current_state\nend\n\ndef update_state\nend\n~~~\n\n† Technically, any subclass of BinData::Base will work.\n\n## Dynamic Proxying\n\nBy default, BinProxy relays all traffic to a static upstream host and port.\nIt can also be configured to act as a SOCKS (v4 or v4a) or HTTP proxy with\nthe `--socks-proxy` and `--http-proxy` flags, respectively.\n\n**Note:** Currently, the HTTP proxy only supports connections tunneled with\nthe HTTP `CONNNECT` verb; it cannot proxy raw HTTP `GET`, `POST`, etc.,\nrequests.  In practice, this means that HTTPS traffic will work, but plain\nHTTP traffic will not unless the client supports a flag to force tunneling,\nlike `curl -p`.\n\n## TLS / SSL\n\nUse the `--tls` flag to unwrap TLS encryption before processing messages.  By\ndefault, BinProxy will generate a self-signed certificate.  You can sepecify\nPEM files containing a certificate and key with `--tls-cert` and `--tls-key`.\n(If you've cloned the source repo, use `rake makecert[example.com]` to\ngenerate a static CA and a certificate with the appropriate hostname.)\n\n## Known issues\n\n- The HTTP proxy functionality was thrown together at the last minute and is\n  not particularly robust.\n\nSee also the `TODO` file for random ideas and wishlist items.\n\n### Credits\n\nBinProxy's core TCP proxy functionality originated in a special purpose proxy\nwritten by Sean Devlin.  Rusty Burchfield contributed the HTML UI for that\nproxy.  While enough of the code has changed that they can no longer be\nblamed for any current bugs, BinProxy likely wouldn't exist without both of\ntheir work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnccgroup%2Fbinproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnccgroup%2Fbinproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnccgroup%2Fbinproxy/lists"}