{"id":17209376,"url":"https://github.com/de-vri-es/inet-remap","last_synced_at":"2025-03-25T11:42:08.490Z","repository":{"id":27792758,"uuid":"31281702","full_name":"de-vri-es/inet-remap","owner":"de-vri-es","description":"Force programs to bind to different ports.","archived":false,"fork":false,"pushed_at":"2016-03-18T22:18:00.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-30T10:41:49.581Z","etag":null,"topics":["intercept-calls","internet","ld-preload","remap"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/de-vri-es.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":"2015-02-24T21:01:32.000Z","updated_at":"2024-08-09T14:17:24.000Z","dependencies_parsed_at":"2022-09-03T11:41:44.138Z","dependency_job_id":null,"html_url":"https://github.com/de-vri-es/inet-remap","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/de-vri-es%2Finet-remap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Finet-remap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Finet-remap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Finet-remap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/de-vri-es","download_url":"https://codeload.github.com/de-vri-es/inet-remap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245458056,"owners_count":20618693,"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":["intercept-calls","internet","ld-preload","remap"],"created_at":"2024-10-15T02:51:27.188Z","updated_at":"2025-03-25T11:42:08.458Z","avatar_url":"https://github.com/de-vri-es.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nForce programs to bind to different ports.\n\n`inet-remap` is not meant for regular use.\nHowever, sometimes you're faced with a closed source binary\nthat just has bind to some specific port.\nFor whatever reason, you may want to have it bind to a different port.\nIn such cases, `inet-remap` can help you bend that closed source binary to your will.\n\nUse cases include forcing an application to bind to an unprivileged port\nand running the same application twice, each instance binding to different ports.\n\n`inet-remap` uses `LD_PRELOAD` to intercept `bind()` calls.\nWhen a `bind()` call is intercepted, the protocol and port number used\nare looked up in a table parsed from the `INET_REMAP` environment variable.\nYou can specify a remapping as `protocol:old_port:new_port`,\nwhere `protocol` can be either `tcp` or `udp`.\nYou can specify multiple remappings by separating them with a comma or a space.\n\nFor example, to remap TCP port 7331 to 1337:\n```\ninet-remap -b tcp:7331:1337 ./program\n```\n\nWhich behind the scenes is the same as:\n```\nLD_PRELOAD=libinet-remap-preload.so INET_REMAP=tcp:7331:1337 ./program\n```\n\nOr remap multiple ports:\n```\ninet-remap -b tcp:503:2503 -b udp:53:2053  ./program\n```\n\nWhich comes down to:\n```\nLD_PRELOAD=libinet-remap-preload.so INET_REMAP=tcp:503:2503,udp:53:2053 ./program\n```\n\nNote that as a security precaution `LD_PRELOAD` and thus `inet-remap` do not work with setuid binaries\nor binaries with elevated privileges on most UNIX systems.\n\n## TODO:\n* ~~Finish setting up build scripts.~~\n* ~~Support IPv6.~~\n* Make protocol specification in remaps optional.\n* Support filtering based on IP address as well as protocol and port number.\n* Support for intercepting `connect()` calls to alter remote endpoints.\n* Get rid of non-POSIX SO_PROTOCOL socket option.\n* ~~Add an executable/script wrapper for easy invocation.~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-vri-es%2Finet-remap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fde-vri-es%2Finet-remap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-vri-es%2Finet-remap/lists"}