#****************************************************************************#
# Kernel Socks Bouncer Manager for KSB26 [KSB26]                             #
# (c) 2004, 2005 Paolo Ardoino <ardoino.gnu@disi.unige.it>                   #
#****************************************************************************#
#									     #
# This program is free software; you can redistribute it and/or modify	     #
# it under the terms of the GNU General Public License as published by	     #
# the Free Software Foundation; either version 2 of the License, or	     #
# (at your option) any later version.					     #
# This program is distributed in the hope that it will be useful,	     #
# but WITHOUT ANY WARRANTY; without even the implied warranty of	     #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	             #
# GNU General Public License for more details.				     #
#									     #
# You should have received a copy of the GNU General Public License	     #
# along with this program; if not, write to the Free Software		     #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  #
#****************************************************************************#

#!/bin/bash

version=0.0.1

thosts_file=/root/thosts	#File containing target hosts
sleep_time=600			#Seconds between socks5 and target hosts list updates

echo "KSB26 Manager v$version for ksb26"
echo ""
rmmod ksb26lkm > /dev/null 2>&1
err=`modprobe ksb26lkm > /dev/null`
if [ ! "${err}" = "FATAL" ] ; then
	cat $thosts_file > /dev/ksb26
	if [ ! -e $thosts_file ] ; then
		echo "$thosts_file: No such file or directory"
		exit -1
	fi
	while true; do
		echo "csl" > /dev/ksb26
		wget -O - -q http://www.atomintersoft.com/products/alive-proxy/socks5-list/ | egrep -o "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*" | sed 's/$/;/' | sed 's/^/S/' > /dev/ksb26
		sleep $sleep_time
	done
else
	exit -1
fi
