Skip to content

peppergrayxyz/bind2device

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bind2device

This tool binds an app to a different network device

Usage

A bash script is provided for convenience:

$ ./bind2device.sh <device> <path_to_exe> <arguments>

LD_PRELOAD:

$ BIND2DEVICE=<device> LD_PRELOAD=./bind2device.so <path_to_exe> <arguments>

Example

You are directly connected to the internet and via a VPN which is exposed on tun0 (e.g. if you are using Network Manger, add a VPN and check "Use this connection for ressources on its network"):

$ curl https://ifconfig.me
140.82.116.4
$ curl --interface tun0 https://ifconfig.me
204.79.197.200
$ ./bind2device.sh tun0 curl https://ifconfig.me
204.79.197.200

How

A shared library is provided which can be used with LD_PRELOAD to change application behavior at run-time. The 'socket' call is intercepted and rewired to use the specified interface (SO_BINDTODEVICE).

Build

$ make

Credits

https://unix.stackexchange.com/a/648791

About

force programs to use a specific network interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published