I have taken Roger Eriksson's SURBL batch file and using the magic of copy and paste 
have altered it to use the Big Evil SURBL. 

This list is much larger than the Spamcop SURBL so your performance may suffer.

Attached renamed exclusion file and the cmd file.
You'll need to rename the besurbl_filter.txt back to besurbl_filter.cmd.
You'll also need the wget.exe and the todos.exe from Roger's original SURBL. See:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg17870.html






127.0.0.
surbl.org
@echo off
setlocal

rem ----- besurbl_filter.cmd version 1.2 -----
rem ----- original work by [EMAIL PROTECTED] (April 18, 2004) -----
rem
rem This script downloads the rbldns zone file of the Spam URI Realtime Blocklist,
rem converts it to a body filter, and updates the existing filter file. It also
rem creates a log file (besurbl_log.txt). The filter is named besurbl.txt and requires
rem Declude JunkMail Pro 1.78b or later. Domains and ip addresses in the file
rem besurbl_exclude.txt will be excluded from the filter (by partial match). The script
rem uses wget.exe for the download and todos.exe to convert the Unix line breaks.
rem It should be scheduled to run at least once a day.
rem
rem These settings must be done (SETTINGS section below) before the script is used:
rem v_path: path to this folder
rem v_limit: update limit (max number of entries; blank or 0 if size should be 
unlimited)
rem v_maxweight: filter max weight (blank or 0 if no max weight should be used)
rem              and filter entry weight (defaults to 0 if blank)
rem v_skipweight: filter skip weight (blank or 0 if filter never should be skipped)
rem v_url: download URL for the rbldns zone file
rem v_exclude: test entries in the rbldns zone file (excluded from the filter file)

rem --------------- SETTINGS ---------------

rem --- Settings (see explanation above): ---
set v_path=D:\IMail\Declude\BESURBL
set v_limit=10000
set v_maxweight=3
set v_skipweight=42
set v_url=http://www.surbl.org/be.surbl.org.rbldns
set v_exclude=test.surbl.org test.be.surbl.org example.com 2.0.0.127

rem --------------- MAIN SCRIPT ---------------

rem --- Create timestamp: ---
for /f "tokens=*" %%a in ('date /t') do set v_time=%%a
for /f "tokens=*" %%b in ('time /t') do set v_time=%v_time% %%b

rem --- Check settings and change current folder (or exit if path is incorrect): ---
if "%v_limit%"=="" set v_limit=0
if "%v_maxweight%"=="" set v_maxweight=0
if "%v_skipweight%"=="" set v_skipweight=0
if not exist %v_path%\nul (set v_result=path error) & (goto :s_end)
cd /d %v_path%

rem --- Download rbldns zone file (or exit if download failed): ---
if exist besurbl.rbldns.tmp del besurbl.rbldns.tmp
if exist wget.exe wget %v_url% -O besurbl.rbldns.tmp
if not exist besurbl.rbldns.tmp (set v_result=download error) & (goto :s_end)

rem --- Convert line breaks from LF to CRLF (or exit if conversion failed): ---
if exist todos.exe todos besurbl.rbldns.tmp
for /f "tokens=*" %%c in ('findstr /r "$" besurbl.rbldns.tmp') do set v_result=ok
if not "%v_result%"=="ok" (set v_result=conversion error) & (goto :s_end)

rem --- Add rbldns entries to file (skip header, test entries, and trailing 
spaces/tabs): ---
if exist besurbl.rbldns.entries.tmp del besurbl.rbldns.entries.tmp
for /f "tokens=1 delims=         " %%d in ('findstr /v /b /i /l "$ @ : ; ! # 
%v_exclude%" besurbl.rbldns.tmp') do echo %%d>> besurbl.rbldns.entries.tmp

rem --- Add filter entries to file (unreversed ip addresses and domains): ---
if exist besurbl.filter.entries.tmp del besurbl.filter.entries.tmp
for /f "tokens=1-4 delims=." %%e in ('findstr /i /r 
"^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\>" besurbl.rbldns.entries.tmp') do echo 
%%h.%%g.%%f.%%e>> besurbl.filter.entries.tmp
for /f "tokens=1" %%i in ('findstr /i /r "^.*\.[A-Z]*\>" besurbl.rbldns.entries.tmp') 
do echo %%i>> besurbl.filter.entries.tmp

rem --- Create filter file header: ---
if exist besurbl.filter.tmp del besurbl.filter.tmp
echo # SURBL filter updated %v_time%> besurbl.filter.tmp
echo # Spam URI Realtime Blocklist (%v_url%)>> besurbl.filter.tmp
if %v_maxweight%%v_skipweight% NEQ 0 echo # This filter will be:>> besurbl.filter.tmp
if %v_maxweight% NEQ 0 echo # - stopped at first match with the additional weight 
%v_maxweight% >> besurbl.filter.tmp
if %v_skipweight% NEQ 0 echo # - skipped if the weight %v_skipweight% already has been 
reached>> besurbl.filter.tmp
if %v_skipweight% NEQ 0 echo # - skipped if the message has not failed any previous 
tests>> besurbl.filter.tmp
echo.>> besurbl.filter.tmp
if %v_maxweight% NEQ 0 echo MAXWEIGHT %v_maxweight% >> besurbl.filter.tmp
if %v_skipweight% NEQ 0 echo SKIPIFWEIGHT %v_skipweight% >> besurbl.filter.tmp
if %v_skipweight% NEQ 0 echo TESTSFAILED END ISBLANK>> besurbl.filter.tmp
if %v_maxweight%%v_skipweight% NEQ 0 echo.>> besurbl.filter.tmp

rem ---
rem --- 
Rem ---  Add END tests here to bypass the filter if needed 
rem ---   
rem ---
echo #>> besurbl.filter.tmp
echo # End Filter Bypasses>> besurbl.filter.tmp
echo #>> besurbl.filter.tmp
echo #>> besurbl.filter.tmp
rem --- sammple REVDNS END ENDSWITH ipswitch.com>> besurbl.filter.tmp
rem --- sample echo MAILFROM END ENDSWITH @declude.com>> besurbl.filter.tmp
echo #>> besurbl.filter.tmp


rem --- Add entries to filter file (skip entries in exclusion file; exclusion ---
rem --- match pattern can be modified by inserting /x [exact], /b [begins with], ---
rem --- or /e [ends with] before /g:surbl_exlude.txt below): --
if not exist besurbl_exclude.txt echo.> bebesurbl_exclude.txt
for /f %%j in ('findstr /i /r "." besurbl_exclude.txt') do set v_excludefile=ok
if "%v_excludefile%"=="ok" (
for /f "tokens=*" %%k in ('findstr /v /i /l /g:besurbl_exclude.txt 
besurbl.filter.entries.tmp') do echo BODY %v_maxweight% CONTAINS %%k>> 
besurbl.filter.tmp
) else (
for /f "tokens=*" %%l in (besurbl.filter.entries.tmp) do echo BODY %v_maxweight% 
CONTAINS %%l>> besurbl.filter.tmp
)

rem --- Count number of entries (and exit if filter file is empty or limit is 
exceeded): ---
for /f "tokens=1 delims=:" %%m in ('findstr /v /b /i /r "# $ MAXWEIGHT SKIPIFWEIGHT 
TESTSFAILED" besurbl.filter.tmp ^| findstr /n /l "."') do set v_count=%%m
if "%v_count%"=="" (set v_result=no entries) & (goto :s_end)
if %v_limit% EQU 0 goto :s_replace
if %v_count% GTR %v_limit% (set v_result=limit exceeded) & (goto :s_end)

rem --- Replace existing filter file: ---
:s_replace
if exist besurbl.old del besurbl.old
if exist besurbl.txt rename besurbl.txt besurbl.old
rename besurbl.filter.tmp besurbl.txt

rem --- Write log entry and clean up: ---
:s_end
if not exist besurbl_log.txt (echo # SURBL filter log created %v_time%> 
besurbl_log.txt) & (echo.>> besurbl_log.txt)
if "%v_result%"=="ok" (echo %v_time% Update successful [%v_count% entries]>> 
besurbl_log.txt) else (echo %v_time% Update failed [%v_result%]>> besurbl_log.txt)
if exist besurbl.rbldns.tmp del besurbl.rbldns.tmp
if exist besurbl.rbldns.entries.tmp del besurbl.rbldns.entries.tmp
if exist besurbl.filter.entries.tmp del besurbl.filter.entries.tmp
if exist besurbl.filter.tmp del besurbl.filter.tmp
endlocal

Reply via email to