ksb26 [Kernel Socks Bouncer] is a Linux Kernel 2.6.x Loadable Kernel Module that that redirects tcp connection (to user-defined target hosts) through socks 4/5 chains.
Kernel Socks Bouncer is subdivided into a lkm [Linux Loadable Kernel Module] and a userspace manager.
ksb26 lkm intercepts and redirects tcp connections. ksb26manager keeps updated socks list and loads target hosts list via character device.
is the lkm. It intercepts and redirects tcp connections.
modprobe ksb26 [nsocks=N]
[ insmod /lib/modules/2.6.x/extra/ksb26.ko ]
This command will load ksb26 lkm.
[nsocks=N] will load ksb26 lkm setting the number of SOCKS to use in chain to N.
To detect major number read dmesg kernel logs running for example:
~# cat /var/log/messages
Between messages of ksb26 module there’s this string:
[ksb26] Major device number = num
~# mknod /dev/ksb26 c num 0 // creates the char device
is the userspace manager for ksb26 lkm. It needs wget, egrep and sed to work.
[You don’t need ksb26manager. You can add SOCKS and target hosts manually via /dev/ksb26 character device].
ksb26manager keeps updated the SOCKS list using http://ksb26.sourceforge.net/socks/socks5.php
ksb26manager [-h] [-d ksb26_device] [-m ksb26_lkm_name] [-n nsocks] [-t thosts_file] [-w wait_time]
[-d ksb26_device]: character device used by ksb26
[-m ksb26_lkm_name]: lkm’s name to use in modprobe command
[-n nsocks]: number of SOCKS used in chains
[-t thosts_file]: file containing target hosts
[-s socks_file]: file containing default socks list
[-w wait_time]: number of seconds to wait before updating the SOCKS list
/dev/ksb26 strings format:
/dev/ksb26 is the character device used by ksb26 to keep SOCKS and target hosts lists updated. Strings formats accepted:
ip addresses and port of SOCKS 4/5
ip addresses and port of target hosts [when ksb26 finds a new connection from localhost
to that host[:port], this connection will pass through a SOCKS chain before reach the target host]
clear SOCKS list string [ csl ] : ksb26 clears the SOCKS list
To add a new SOCKS server to the list:
manual submission of a new SOCKS:
~# echo ”#S127.0.0.1:1080;5|” > /dev/ksb26
If you use ksb26manager you can set a default socks list in /etc/ksb26/socks that will be loaded automatically by the userspace tool .
If you don’t use ksb26manager you can create a new file as this below:
~# cat socks.txt > /dev/ksb26
To add a new target host to the list [if you use the userspace manager see /etc/ksb26/thosts]:
If host_ip is *, connection directed to all IPs will be redirected.
If host_port is 0, all connection directed to that host will be redirected through a Socks chain.
To clear SOCKS list:
What's New in This Release:
· This release adds a small bugfix and support for a default socks list in ksb26manager (useful if you use TOR).