https://github.com/damnever/hosts-hijacking
[NSFW] Hijack UDP-based(libc recvfrom) DNS A/AAAA response with LD_PRELOAD.
https://github.com/damnever/hosts-hijacking
dns hosts ld-preload libc
Last synced: about 2 months ago
JSON representation
[NSFW] Hijack UDP-based(libc recvfrom) DNS A/AAAA response with LD_PRELOAD.
- Host: GitHub
- URL: https://github.com/damnever/hosts-hijacking
- Owner: damnever
- License: bsd-3-clause
- Created: 2020-08-02T14:19:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-06T15:16:01.000Z (almost 6 years ago)
- Last Synced: 2025-12-29T07:17:25.776Z (6 months ago)
- Topics: dns, hosts, ld-preload, libc
- Language: C
- Homepage:
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hosts-hijacking
Hijack UDP-based([libc recvfrom](https://man7.org/linux/man-pages/man2/recvfrom.2.html)) DNS A/AAAA response with LD_PRELOAD.
```
# make build
# cat /path/to/hosts
10.8.8.8 google.com
# HOSTS_HIJACKING=/path/to/hosts LD_PRELOAD=$(pwd)/src/hosts-hijacking.so xx-cmd-using-libc-recvfrom
```
## Why
- We want to keep the dirty hack at the client-side.
- We have no permission to change the hosts file(or we do not want to change it, see below).
- No side effect to other processes.
## NOTES
- NOT FULLY TESTED!!!
- If you want to use it with golang, the most reliable way is compiling the golang program with `-tags netcgo`(DO NOT use cross-platform compile).