https://github.com/filosottile/otherport
LD_PRELOAD hack to redirect connections to other ports
https://github.com/filosottile/otherport
Last synced: about 1 year ago
JSON representation
LD_PRELOAD hack to redirect connections to other ports
- Host: GitHub
- URL: https://github.com/filosottile/otherport
- Owner: FiloSottile
- License: mit
- Created: 2015-12-03T14:37:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-03T16:58:50.000Z (over 10 years ago)
- Last Synced: 2025-04-12T17:58:55.350Z (about 1 year ago)
- Language: C
- Homepage:
- Size: 3.91 KB
- Stars: 43
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# otherport
LD_PRELOAD hack to redirect connections to other ports. When started with *otherport*, binaries will believe they are connecting to OLD_PORT, while actually connecting to NEW_PORT.
Currently it rewrites only `sendto` and `recvfrom`.
## Usage
```
$ make
$ OLD_PORT=53 NEW_PORT=10053 LD_PRELOAD=$PWD/otherport.so ...
```
**Note**: all packets received on NEW_PORT will be rewritten to look like they were received from OLD_PORT, so NEW_PORT becomes effectively unusable.
## Example
For example, it lets you test DNS resolvers against servers running on high ports instead of port 53.
```
$ OLD_PORT=53 NEW_PORT=10053 LD_PRELOAD=$PWD/otherport.so unbound-host google.com
```
In this case, `unbound-host` will transparently connect to all DNS servers on the port 10053, allowing root-less tests.