Skip to content
qtvibingPublic

About

Tiny C library that hijacks DNS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

dnswarp

Tiny C library that hijacks DNS calls

what it does

Hooks libc functions (connect, sendto, recvfrom, etc.) to redirect port 53 traffic. Works with node, dig, whatever uses normal DNS calls

Also spoofs response addresses so c-ares doesn't throw a fit

build

gcc -shared -fPIC -o dns.so dns.c -ldl -lpthread

use

LD_PRELOAD=./dns.so node server.js
LD_PRELOAD=./dns.so dig google.com

note

By default dns is deferred to 9.9.9.10, the non-filtering server by Quad9

If you'd like to change that: sed 's/9\.9\.9\.10/X\.Y\.Z\.W/g' dns.c

limitations

  • IPv4 only
  • no DoT/DoH
  • basic getaddrinfo implementation
  • won't work with statically linked stuff
  • might leak memory under awkward circumstances

license

MIT

About

Tiny C library that hijacks DNS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages