I've been writing a script (part batch, VBS, and hta) that would allow an Admin of a server to submit his list of banned IP's to a master list of banned IP's. The admin could then turn around and download a list of banned IP's that other Admin's have also submitted. The idea behind this I first thought of after reading about adminalliance.com. Basically I'm trying to make it so that if you TK on one adminalliance.com member's server and get banned, chances are you'll also be banned from
ALL the admin alliance member's different servers if they use this utility I wrote. Be an asshole on one server, you're probably an asshole on them all correct?
I'll be putting out on the web tonight after I get off work, my first BETA release of this script, hoping that people will try it out and help me discover any bugs in the script. So far It's been tested under both win9x and winNT based OS's (incl XP pro). The CHOICE command in DOS is not available under WinXp-pro or Win 2000-Pro so CHOICE.com (win9x version) will be included with the script. ALSO the windows9x version of FTP.exe is used INSTEAD of the version you do have. The reason is for security. XP-pro and Win 2000's FTP.exe can't handle an IP translated into DWORD ie: 24.65.215.89 in DWORD translates to: 406968153. The reason I do this is because I don't want some banned clown probing my machine for open ports to seek revenge. Although this is FAR FROM failsafe, it does insure 99.99% of computer users wont have a clue how to find out what the server's IP really is.
The master list during the BETA testing phase will be maintained
BY ME until such time as this script has been thuroughly tested. Once this trial and error period is over, it is my hope that adminalliance.com will carry forth my endevour on THEIR server so that THEY maintain the master list of TK'ing peons. If not, I guess I'll just have to be custodian of the master TK list from then on.
The script
ONLY deals with banned IP's and NOT with banned names. Although I could have written the script to act on bad names, names are often not unique whereas IP addresses are and I wouldn't want to persecute the innocent MOHAA player for having the same name as some jerkoff.
Although I can write this script myself, as they say "two heads are better than one", so if there are any VBS, BATCHfile, or PERL (for linux version) script kids like myself who wish to help me make this better, please feel free to mail me
ctrl_07@hotmail.com and join in on the project. Better yet... maybe someone is nice enough to actually "code" this idea into a win32 executable?
The script goes like this:....... (NOTE....some of the longer ECHO statements get botched cutting and pasting into this puny php window....it comes out fine in a DOS window)
1) Begone.bat...
@echo off
CLS
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
echo.
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo Ü Ü
echo Ü Welcome to BeGone! Version 1.0 Ü
echo Ü Ü
echo Ü Time to kick to TK ASS! Ü
echo Ü Ü
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo.
echo.
::3 second INTRO screen
echo Wscript.Sleep 3000> sleep.vbs
start /w wscript.exe sleep.vbs
del sleep.vbs >nul
:check
::check for autokick
IF NOT EXIST "autokick.exe" GOTO notfind
goto begin
:notfind
CLS
ECHO.
ECHO You do not seem to have Autokick installed or this
ECHO batchfile isn't in the same directory as Autokick.
ECHO It MUST be run from the same directory as Autokick!
pause
goto finish
::check for ip entries in bannedip.txt. Since IP's have
::decimals, a FIND of "." will reveal IP's in the file.
:begin
FIND "." bannedip.txt >nul
::if user has a clean bannedip.txt file prompt him/her
::to download the latest master list of TK'ing goofs.
IF NOT ERRORLEVEL 1 goto putlist
goto blank
:blank
CLS
ECHO.
ECHO Autokick's bannedip.txt file seems to have no IP's in it.
ECHO.
ECHO Would you like to download the latest list of TK'ing morons?
ECHO Default YES in 10 seconds! Press Y for YES, N for NO
CHOICE /N /t:y,10
if errorlevel==2 goto finish
goto getlist
:putlist
CLS
Echo.
ECHO Would you like to submit your banned IP's to the master list?
Echo Default is YES in 10 seconds! Press Y for YES, N for NO
CHOICE /N /t:y,10
if errorlevel==2 goto update
goto sort1
:sort1
::this routine will weed out any blank lines in your bannedip.txt file
::and also occurances or two or more IP's on a single line of text.
FIND "." bannedip.txt >nul
IF NOT ERRORLEVEL 1 goto sort
goto endsort
:sort
set ip=
TYPE bannedip.txt|FIND "." | FIND /N "." >$temp$.bat
ECHO set ip=%%2 >[.bat
BFR "\5b1\5d" "\5b 1\5d " $temp$.bat -b >nul
CALL $temp$.bat
DEL $temp$.bat >nul
ECHO %ip% >>banned2.txt
BFR %ip% " " bannedip.txt -b >nul
goto sort1
:endsort
Del bannedip.txt >nul
TYPE banned2.txt|Sort >bannedip.txt
DEL banned2.txt >nul
DEL [.bat >nul
IF EXIST DEL $temp$.bat >nul
goto submit
:submit
IF EXIST 530.txt DEL 530.txt >nul
::Allowing a download of a list of morons is one thing....allowing just ANYONE to submit
::IP's to the list is asking for malicious abuse and mischief. Therefore we will only allow uploads of
::bannedip.txt to users with an account on the system. I create an .hta file (html application)
::that returns the inputed values as %USERNAME% and %PASSWORD%. These two variables are then echoed
::into the FTP upload script created below.
Call input.bat
ECHO ftp -s:putit.txt >putit.bat
ECHO open >putit.txt
ECHO 406968153 2101 >>putit.txt
ECHO %USERNAME% >>putit.txt
ECHO %PASSWORD% >>putit.txt
ECHO ascii >>putit.txt
ECHO put bannedip.txt >>putit.txt
ECHO bye >>putit.txt
::Call putit.bat and pipe it into FIND. If the login is incorrect the server will return code "530"
::This allows the script to detect bad logins and prompt the user to retype their username and password.
CALL putit.bat |FIND "530" >530.txt
type 530.txt | FIND "530"
IF NOT ERRORLEVEL 1 goto submit
:continue
DEL putit.txt >nul
DEL putit.bat >nul
IF EXIST DEL 530.txt >nul
CLS
ECHO.
ECHO Thank you for helping the MOHAA community!
ECHO.
goto update2
:update
CLS
ECHO.
:update2
Echo Would you now like to update your list with the banned IP's
Echo from master list on the server?
ECHO Default is YES in 10 seconds! Press Y for YES, N for NO
CHOICE /n /t:y,10
if errorlevel==2 goto finish
goto getlist
:getlist
ECHO ftp -s:getit.txt >getit.bat
ECHO open >getit.txt
ECHO 406968153 2101 >>getit.txt
ECHO admin >>getit.txt
ECHO admin@ >>getit.txt
ECHO ascii >>getit.txt
ECHO get master.txt >>getit.txt
ECHO bye >>getit.txt
CALL getit.bat
DEL getit.txt >nul
DEL getit.bat >nul
FC master.txt bannedip.txt |FIND "."|SORT >banned2.txt
BFR "Comparing files master.txt and BANNEDIP.TXT" "" banned2.txt -b >nul
BFR "***** BANNEDIP.TXT" "" banned2.txt -b >nul
BFR "***** master.txt" "" banned2.txt -b >nul
DEL bannedip.txt >nul
DEL master.txt >nul
REN banned2.txt bannedip.txt
goto sort2
::this opens up possibilities of duplicate IP entries so we'll rebuild
::the list using BRF to kill the duplicate entries.
:sort2
FIND "." bannedip.txt >nul
IF NOT ERRORLEVEL 1 goto resort
goto lastsort
:resort
set ip=
TYPE bannedip.txt|FIND "." | FIND /N "." >$temp$.bat
ECHO set ip=%%2 >[.bat
BFR "\5b1\5d" "\5b 1\5d " $temp$.bat -b >nul
CALL $temp$.bat
DEL $temp$.bat >nul
ECHO %ip% >>banned2.txt
BFR %ip% " " bannedip.txt -b >nul
goto sort2
:lastsort
Del bannedip.txt >nul
TYPE banned2.txt|Sort >bannedip.txt
DEL banned2.txt >nul
DEL [.bat >nul
IF EXIST DEL $temp$.bat >nul
goto finish
:finish
CLS
ECHO.
ECHO Would you like to start autokick with the new banned IP's?
ECHO.
CHOICE /N /C:yn Press Y for YES or N for NO.
if errorlevel==2 goto thanks
if errorlevel==1 goto startit
:startit
autokick.exe -a
:thanks
CLS
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
echo.
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo Ü Thank you using for BeGone! Version 1.0 Ü
echo Ü Ü
echo Ü by Ü
echo Ü Ü
echo Ü ]NBK[ G.I. Jerk Ü
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo.
echo.
::3 second EXIT screen
echo Wscript.Sleep 3000> sleep.vbs
start /w wscript.exe sleep.vbs
del sleep.vbs >nul
CLS
2)input.bat (creates the .hta authentification page)
cls
echo Please enter your user name and password in the entry box...
:: See if I can find myself
If not exist %0 goto ERROR
:: Make the web page
type %0 | find " " | find /v "Not Me!" > %TEMP%\UserIn.hta
:: Run the vbs code
start /w %TEMP%\UserIn.hta
:: At this point a batch file "%TEMP%\UserIn.bat" exists and you should
:: call it! If you don't call the batch file here and instead opt to
:: call it from another batch file, be sure NOT to delete it in the
:: "Clean up" code section below!
call %TEMP%\UserIn.bat
echo Your user name is %USERNAME%
echo Your password is %PASSWORD%
:: Clean up
del %TEMP%\UserIn.hta
del %TEMP%\UserIn.bat
pause
goto DONE
:ERROR
cls
echo %0 is not the full path and file name
echo for the batch file. You MUST call this
echo batch file with a full path and file name.
goto DONE
:HTA
:: All HTA code MUST be indented four or more spaces.
:: NOTHING else in this batch file may be indented four spaces.
<html>
<head>
<title>BeGone! v1.0 Password Entry</title>
<hta:application>
<script language="vbscript">
window.resizeTo 250,200
Sub SaveBatch()
Set fs = CreateObject("Scripting.FileSystemObject")
strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialF older(2), "UserIn.bat"))
Set ts = fs.OpenTextFile(strFile, 2, True)
ts.WriteLine "SET USERNAME=" & document.Forms(0).elements("username").value
ts.WriteLine "SET PASSWORD=" & document.Forms(0).elements("password").value
ts.Close
End Sub
</script>
</head>
<body bgcolor="000000">
<font FACE="arial,veranda" COLOR="white">
<form>
User Name:
<input type=text name=username tabindex=1>
Password:
<input type=password name=password>
<input type=button language="vbscript" value="OK"
onclick="SaveBatch : Window.Close">
</form>
</font>
<script language=vbscript>
document.Forms(0).elements("username").focus
</script>
</body>
</html>
:DONE
Comment? Suggestions?
]NBK[ G.I. Jerk