https://github.com/FiloSottile/otherport
LD_PRELOAD hack to redirect connections to other ports
https://github.com/FiloSottile/otherport
Last synced: 5 months 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 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-03T16:58:50.000Z (over 9 years ago)
- Last Synced: 2024-11-06T02:49:34.155Z (5 months ago)
- Language: C
- Homepage:
- Size: 3.91 KB
- Stars: 42
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ld-preload - otherport - redirect connections to other ports (Libraries)
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.