; ------------------------------------- ; --- Tor-Be-Gone --- ; --- By WTSh4rK @ irc.undernet.org --- ; --- Version 1.1.1 --- ; ------------------------------------- ; ; --- Change Log --- ; ; 20.02.2010: The script no longer reads from the csv file, all IP addresses are stored in a hash table. ; 20.02.2010: Update routine added, csv file can now be downloaded in mirc and added to hash more easily. ; 20.02.2010: Old IP's are kept in the hash table for 2 weeks and will be removed if not updated, new IP's are added. ; 24.02.2010: GUI Added ; 24.02.2010: Now multi channel ; 24.02.2010: Update now uses mirc socks to get ip list so no download of files are needed, 1 hour auto update added. ; 09.03.2010: IP's are now kept for 2 days only due to the use of dynamic IP's (too many IP's in the hash) ; 26.03.2010: Multi site updates added. ; 20.11.2010: Added a que system, users are added to a scan que and scanned one at a time, no more timers. ; 20.11.2010: Added DNS cache, no need to lookup addresses that have already been looked up now. ; 22.11.2010: dronebl.org DNSBL lookup added. ; 02.01.2011: Added Global Ignore List ; 08.02.2011: /who channel when addresses are not found in mirc IAL hidden, stops pnp whois window poping up. ; 08.02.2011: Other bug fixes and tidy up. ; 10.03.2011: Multi DNSBL lookup added. ; ; ------------------ on 1:START: { unset %TBG* set %tbg.ini $shortfn($mircdir $+ torips\) $+ tbg.ini if (!$hget(tor.ips)) { if (!$exists(torips)) { .mkdir torips } if (!$exists(torips\tns_list.txt)) { write torips\tns_list.txt torstat.xenobite.eu write torips\tns_list.txt torstatus.all.de write torips\tns_list.txt torstatus.asprion.org write torips\tns_list.txt torstatus.blutmagie.de write torips\tns_list.txt torstatus.cyberphunk.org write torips\tns_list.txt torstatus.rueckgr.at } if (!$exists(torips\tor_ips.hash)) { .hmake tor.ips 1000 } else { .hmake tor.ips 1000 | .hload -b tor.ips torips\tor_ips.hash } If (!$window(@Tor-Be-Gone)) { window -k0nz @Tor-Be-Gone | .log on @Tor-Be-Gone -f Tor-Be-Gone.log } echo 2 -st *** Tor-Be-Gone 1.1.1 By Skxawng (WTSh4rK @ irc.Undernet.org) http://spontan-you-us.net23.net  echo 2 -st *** Loaded IP Address Hash, $hget(tor.ips,0).item IP's in Hash, Running Update... .timertbgQ 0 0.5 do.tbgQ tbgupdate } } on 1:DISCONNECT: { If ($window(@tbgQ)) { window -c @tbgQ } } on 1:JOIN:#: { if (($nick != $me) && ($istok($readini(torips\tbg.ini,lists,chans),$chan,172))) { addto.tbgQ $nick $chan } } on 1:OP:#: { if (($opnick == $me) && ($istok($readini(torips\tbg.ini,lists,chans),$chan,172)) && ($readini(torips\tbg.ini,$chan,scan))) { tbgscan $chan } } on 1:SERVEROP:#: { if (($opnick == $me) && ($istok($readini(torips\tbg.ini,lists,chans),$chan,172)) && ($readini(torips\tbg.ini,$chan,scan))) { tbgscan $chan } } alias addto.tbgQ { if ($1 == $me) return if (!%tbg.ini) set %tbg.ini $shortfn($mircdir $+ torips\) $+ tbg.ini If (!$window(@tbgQ)) { window -h @tbgQ } if (!$timer(tbgQ)) .timertbgQ 0 0.5 do.tbgQ if (($1 == ¬StartScanChan) || ($1 == ¬FinishScanChan)) { aline @tbgQ $1 $2 $3 $4 $5 | return } else aline @tbgQ $1 $2 ~ Waiting if ($window(@TBG-Status)) aline @TBG-Status $timestamp Added $1 from $2 to the Scan Que... } alias do.tbgQ { if ($line(@tbgQ,0)) { if ($gettok($line(@tbgQ,1),1,32) == ¬StartScanChan) { echo 6 -t $gettok($line(@tbgQ,1),2,32) *** [TBG] Starting to scan $iif($gettok($line(@tbgQ,1),3,32),$gettok($line(@tbgQ,1),3,32),$gettok($line(@tbgQ,1),2,32)) for TOR $iif($readini(%tbg.ini,$gettok($line(@tbgQ,1),2,32),dnsbl),and DNSBL) please wait... dline @tbgQ 1 | return } if ($gettok($line(@tbgQ,1),1,32) == ¬FinishScanChan) { echo 6 -t $gettok($line(@tbgQ,1),2,32) *** [TBG] The TOR $iif($readini(%tbg.ini,$gettok($line(@tbgQ,1),2,32),dnsbl),and DNSBL) scan of $iif($gettok($line(@tbgQ,1),5,32),$gettok($line(@tbgQ,1),5,32),$gettok($line(@tbgQ,1),2,32)) has finished, Scanned $gettok($line(@tbgQ,1),3,32) users in $duration($calc($ctime - $gettok($line(@tbgQ,1),4,32))) dline @tbgQ 1 | return } if (!$address($gettok($line(@tbgQ,1),1,32),5)) { if ($chan($gettok($line(@tbgQ,1),2,32)).inwho) return else { .who $gettok($line(@tbgQ,1),2,32) set %tbg.who $gettok($line(@tbgQ,1),2,32) %tbg.who } } if ($gettok($line(@tbgQ,1),1,32) !ison $gettok($line(@tbgQ,1),2,32)) { if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Scan Que (not on channel) dline @tbgQ 1 | .dns -c | return } if ($address($gettok($line(@tbgQ,1),1,32),5)) { if ($gettok($line(@tbgQ,1),4,32) == Waiting) { rline @tbgQ 1 $puttok($line(@tbgQ,1),Checking $ctime,4,32) ;echo -s $line(@tbgQ,1) inc %¬tbg.scans if ($window(@TBG-Status)) aline @TBG-Status $timestamp Sending $gettok($line(@tbgQ,1),1,32) ( $+ $address($gettok($line(@tbgQ,1),1,32),5) $+ ) from $gettok($line(@tbgQ,1),2,32) for Check... [# $+ %¬tbg.scans $+ ] torchk $gettok($line(@tbgQ,1),1,32) $gettok($line(@tbgQ,1),2,32) } if (($gettok($line(@tbgQ,1),4,32) == Checking) && ($calc($ctime - $gettok($line(@tbgQ,1),5,32)) > 10)) { if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Scan Que (timeout) echo 2 -t @Tor-Be-Gone *** WARNING: Removed $gettok($line(@tbgQ,1),1,32) from the Scan Que (timeout) dline @tbgQ 1 | .dns -c | return } } } } alias TBGmakeDNSBL { ;$1 = IP address only if ($remove($1,.) isnum) { ; ************************ DNSBL Scan List ************************ ; ****** Add your rbl lists here with a space between each ******** ; ***************************************************************** var %tbg.dnsbl_list = dnsbl.dronebl.org rbl.efnetrbl.org ircbl.ahbl.org dnsbl.swiftbl.org ; ***************************************************************** ; ***************************************************************** ; ***************************************************************** var %tbg.dnsbl_c = 1 while ($gettok(%tbg.dnsbl_list,%tbg.dnsbl_c,32)) { if (%tbg.dnsbl) var %tbg.dnsbl = %tbg.dnsbl $+ ¬ $+ $gettok($1,4,46) $+ . $+ $gettok($1,3,46) $+ . $+ $gettok($1,2,46) $+ . $+ $gettok($1,1,46) $+ . $+ $gettok(%tbg.dnsbl_list,%tbg.dnsbl_c,32) else var %tbg.dnsbl = $gettok($1,4,46) $+ . $+ $gettok($1,3,46) $+ . $+ $gettok($1,2,46) $+ . $+ $gettok($1,1,46) $+ . $+ $gettok(%tbg.dnsbl_list,%tbg.dnsbl_c,32) ;if ($window(@TBG-Status)) aline @TBG-Status $timestamp DNSBL Sent > $gettok($1,4,46) $+ . $+ $gettok($1,3,46) $+ . $+ $gettok($1,2,46) $+ . $+ $gettok($1,1,46) $+ . $+ $gettok(%tbg.dnsbl_list,%tbg.dnsbl_c,32) .dns $gettok($1,4,46) $+ . $+ $gettok($1,3,46) $+ . $+ $gettok($1,2,46) $+ . $+ $gettok($1,1,46) $+ . $+ $gettok(%tbg.dnsbl_list,%tbg.dnsbl_c,32) inc %tbg.dnsbl_c } return %tbg.dnsbl } else { echo -ts [TBG makeDNSBL Error] IP Address ONLY! | halt } } alias torchk { ;$1 = nick $2 = chan if (($1 == $null) || ($2 == $null)) { echo -t torchk error: incorrect argument halt } if (!$timer(TBG.update)) { .timerTBG.update 0 3600 TBGupdate } if (!$hget(tor.ips)) { if (!$exists(torips\tor_ips.hash)) { hmake -s tor.ips 1000 } else { .hmake -s tor.ips 1000 | .hload -bs tor.ips torips\tor_ips.hash } } if (!$hget(tbg_dns_cache)) { hmake tbg_dns_cache 1000 if ($exists(torips\tbg_dns_cache.hash)) { hload tbg_dns_cache torips\tbg_dns_cache.hash } } if ($1 !ison $2) { dline @tbgQ 1 | halt } set %tbg.ignore 1 var %tbg.ignore.list = $readini(%tbg.ini,lists,ignore) while ($gettok(%tbg.ignore.list,%tbg.ignore,172)) { if ($gettok(%tbg.ignore.list,%tbg.ignore,172) iswm $address($1,5)) { dline @tbgQ 1 if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp On Ignore List, Removed $1 from the Tor Scan Que halt } inc %tbg.ignore } if (($address($1,4) == *!*@*.users.undernet.org) || ($1 == X)) { dline @tbgQ 1 | if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp Undernet User... Removed $1 from the Tor Scan Que | halt } if (($hget(tbg_dns_cache)) && ($hfind(tbg_dns_cache,$gettok($address($1,2),2,64)))) { var %toraddress = $gettok($hget(tbg_dns_cache,$gettok($address($1,2),2,64)),1,32)) if ($window(@TBG-Status)) aline 7 @TBG-Status $timestamp $1 Address found $gettok($hget(tbg_dns_cache,$gettok($address($1,2),2,64)),1,32)) in DNS cache... } else { var %toraddress = $gettok($address($1,2),2,64) } If (!$window(@Tor-Be-Gone)) { window -k0nz @Tor-Be-Gone | .log on @Tor-Be-Gone -f Tor-Be-Gone.log } if ($remove(%toraddress,.) isnum) { hadd -m torchk %toraddress $1 $+ ¬ $+ $2 if ($hfind(tor.ips,%toraddress,1)) { set %tbg.type 1 kicktor $1 $2 %toraddress hdel torchk %toraddress if ($window(@TBG-Status)) aline 4 @TBG-Status $timestamp Tor Address found: ( $+ $1 $+ ) %toraddress in $2  dline @tbgQ 1 if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $1 from the Tor Scan Que halt } else { hdel torchk %toraddress if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp Not a Tor address ( $+ $1 $+ ) %toraddress in $2 if (!$readini(%tbg.ini,$2,dnsbl)) { if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 halt } if (!$hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2))) { rline @tbgQ 1 $addtok($line(@tbgQ,1),$TBGmakeDNSBL(%toraddress),32) if ($window(@TBG-Status)) aline @TBG-Status $timestamp Sending $1 for DNSBL lookup... halt } if ($gettok($hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2)),1,32) == good) { if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp $gettok($line(@tbgQ,1),1,32) not listed in DNSBL... (cached) if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 halt } if ($gettok($hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2)),1,32) == bad) { if ($window(@TBG-Status)) aline 4 @TBG-Status $timestamp $gettok($line(@tbgQ,1),1,32) from $gettok($line(@tbgQ,1),2,32) listed in DNSBL (cached) set %tbg.type 0 kicktor $gettok($line(@tbgQ,1),1,32) $gettok($line(@tbgQ,1),2,32) %toraddress [DNSBL] Your host is listed in a DNSBL if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 halt } } } if (!$hget(torchk).size) hmake torchk 100 hadd -m torchk %toraddress $1 $+ ¬ $+ $2 .dns %toraddress if ($window(@TBG-Status)) aline 7 @TBG-Status $timestamp $1 sent for DNS Lookup... } on 1:dns: { if (($line(@tbgQ,0)) && ($dns(0).addr == $gettok($address($gettok($line(@tbgQ,1),1,32),2),2,64))) { if (!$dns(1).ip) { echo -t @Tor-Be-Gone DNS Error: Could not look up IP for ( $+ $gettok($hget(torchk,$dns(0).addr),1,172) $+ ) $dns(0).addr in $gettok($hget(torchk,$dns(0).addr),2,172) echo 7 -t $gettok($hget(torchk,$dns(0).addr),2,172) *** DNS Error: Could not look up IP for ( $+ $gettok($hget(torchk,$dns(0).addr),1,172) $+ ) $dns(0).addr in $gettok($hget(torchk,$dns(0).addr),2,172) if ($window(@TBG-Status)) aline 12 @TBG-Status $timestamp DNS Error: Could not look up IP for ( $+ $gettok($hget(torchk,$dns(0).addr),1,172) $+ ) $dns(0).addr in $gettok($hget(torchk,$dns(0).addr),2,172) hdel torchk $dns(0).addr dline @tbgQ 1 if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($hget(torchk,$dns(1).addr),1,172) from the Tor Scan Que halt } if (!$hget(tbg_dns_cache)) { hmake tbg_dns_cache 1000 if ($exists(torips\tbg_dns_cache.hash)) { hload tbg_dns_cache torips\tbg_dns_cache.hash } } hadd tbg_dns_cache $dns(1).addr $dns(1).ip $ctime hsave -o tbg_dns_cache torips\tbg_dns_cache.hash if ($window(@TBG-Status)) aline @TBG-Status $timestamp Adding $dns(1).addr $dns(1).ip to DNS cache... if (($hfind(tor.ips,$dns(1).ip,1)) && ($gettok($hget(torchk,$dns(1).addr),1,172))) { if ($window(@TBG-Status)) aline 4 @TBG-Status $timestamp Tor Address found: ( $+ $gettok($hget(torchk,$dns(1).addr),1,172) $+ ) $dns(1).addr ( $+ $dns(1).ip $+ ) set %tbg.type 1 kicktor $gettok($hget(torchk,$dns(1).addr),1,172) $gettok($hget(torchk,$dns(1).addr),2,172) $dns(1).ip if ($window(@TBG-Status)) aline 4 @TBG-Status $timestamp Kicking and Banning $gettok($hget(torchk,$dns(1).addr),1,172) $gettok($hget(torchk,$dns(1).addr),2,172) $dns(1).ip hdel torchk $dns(1) dline @tbgQ 1 if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($hget(torchk,$dns(1).addr),1,172) from the Tor Scan Que } else { if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp Not a Tor address ( $+ $gettok($hget(torchk,$dns(1).addr),1,172) $+ ) $dns(1).addr ( $+ $dns(1).ip $+ ) hdel torchk $dns(0).addr if (!$readini(%tbg.ini,$gettok($line(@tbgQ,1),2,32),dnsbl)) { dline @tbgQ 1 halt } if (!$hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2))) { rline @tbgQ 1 $addtok($line(@tbgQ,1),$TBGmakeDNSBL($dns(1).ip),32) if ($window(@TBG-Status)) aline @TBG-Status $timestamp Sending $gettok($line(@tbgQ,1),1,32) for DNSBL lookup... halt } if ($gettok($hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2)),1,32) == good) { if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp $gettok($line(@tbgQ,1),1,32) not listed in DNSBL... (cached) if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 halt } if ($gettok($hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2)),1,32) == bad) { if ($window(@TBG-Status)) aline 4 @TBG-Status $timestamp Listed in DNSBL, Kicking and Banning $gettok($line(@tbgQ,1),1,32) from $gettok($line(@tbgQ,1),2,32) (cached) set %tbg.type 0 kicktor $gettok($line(@tbgQ,1),1,32) $gettok($line(@tbgQ,1),2,32) $dns(1).ip) [DNSBL] Your host is listed in a DNSBL ( $+ $dns(0).addr $+ ) if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 halt } } } var %tbg.qdnsbl = $gettok($line(@tbgQ,1),6,32) if (($line(@tbgQ,0)) && ($dns(0).addr isin %tbg.qdnsbl)) { if (!$dns(1).ip) { if ($window(@TBG-Status)) aline 3 @TBG-Status $timestamp $gettok($line(@tbgQ,1),1,32) not listed in DNSBL... ( $+ $dns(0).addr $+ ) if ($hget(TBG_DNSBL,$address($gettok($line(@tbgQ,1),1,32),2)) != bad) .hadd -mn1800 TBG_DNSBL $address($gettok($line(@tbgQ,1),1,32),2) good $ctime var %tbg.qdnsbl = $remtok(%tbg.qdnsbl,$dns(0).addr,1,172) if (%tbg.qdnsbl) rline @tbgQ 1 $puttok($line(@tbgQ,1),%tbg.qdnsbl,6,32) if (!%tbg.qdnsbl) { if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 } } else { if ($window(@TBG-Status)) aline 4 @TBG-Status $timestamp $gettok($line(@tbgQ,1),1,32) from $gettok($line(@tbgQ,1),2,32) listed in DNSBL! ( $+ $dns(0).addr $+ ) set %tbg.type 0 kicktor $gettok($line(@tbgQ,1),1,32) $gettok($line(@tbgQ,1),2,32) $dns(0).addr [DNSBL] Your host is listed in a DNSBL ( $+ $dns(0).addr $+ ) .hadd -mn1800 TBG_DNSBL $address($gettok($line(@tbgQ,1),1,32),2) bad if ($window(@TBG-Status)) aline @TBG-Status $timestamp Removed $gettok($line(@tbgQ,1),1,32) from the Tor Scan Que dline @tbgQ 1 } } } alias kicktor { ;$1 = Nick $2 = chan $3 = IP [$4- = Alt Kick Msg Over Ride] var %tbg.cc = 1 var %tbg.chan.list = $readini(torips\tbg.ini,lists,chans) If (!$window(@Tor-Be-Gone)) { window -k0nzg1 @Tor-Be-Gone | .log on @Tor-Be-Gone -f Tor-Be-Gone.log } else window -g1 @Tor-Be-Gone echo 4 -t @Tor-Be-Gone *** $iif(%tbg.type,Tor Address:,DNSBL Address:) $address($1,5) ( $+ $3 $+ ) found in $2  echo 4 -t $2 *** [# $+ %¬tbg.scans $+ ] $iif(%tbg.type,Tor Address:,DNSBL Address:) $address($1,5) ( $+ $3 $+ ) found in $2  while ($chan(%tbg.cc)) { if ($istok(%tbg.chan.list,$chan(%tbg.cc),172)) { if ((!%tbg.type) && (!$readini(torips\tbg.ini,$chan(%tbg.cc),dnsbl))) { goto tbgbypass } if ($4-) { set %tbg.kick.msg [TBG $asctime(d mmm yyyy) $+ ] $4- } else { set %tbg.kick.msg [TBG $asctime(d mmm yyyy) $+ ] [TOR] $replace($readini(torips\tbg.ini,$chan(%tbg.cc),banmsg),[ip],$3,[addr],$address($1,2),[chan],$chan(%tbg.cc),[nick],$1) } if ($me isop $chan(%tbg.cc)) { if ($1 ison $chan(%tbg.cc)) { if (($network == undernet) && (r !isincs $chan($chan(%tbg.cc)).mode)) { var %tbg.mode = +rb | .timer 1 60 mode $chan(%tbg.cc) -r } else var %tbg.mode = +b raw -q mode $chan(%tbg.cc) %tbg.mode $address($1,2) $+ $crlf $+ kick $chan(%tbg.cc) $1 : %tbg.kick.msg If (!$window(@Tor-Be-Gone)) { window -k0nzg1 @Tor-Be-Gone | .log on @Tor-Be-Gone -f Tor-Be-Gone.log } else window -g1 @Tor-Be-Gone echo 4 -t @Tor-Be-Gone *** $iif(%tbg.type,TOR Address:,DNSBL Address:) $address($1,5) ( $+ $3 $+ ) was kicked and banned from $chan(%tbg.cc) ( $+ %tbg.kick.msg $+ )  } if (($readini(torips\tbg.ini,$chan(%tbg.cc),x)) && (X ison $chan(%tbg.cc)) && ($chan(%tbg.cc) == $2)) { .msg X ban $chan(%tbg.cc) $address($1,2) $readini(torips\tbg.ini,$chan(%tbg.cc),xdays) $+ d 75 $left(%tbg.kick.msg,124) $+ $iif($len(%tbg.kick.msg) > 124,...) } } if ($me !isop $chan(%tbg.cc)) { if (($readini(torips\tbg.ini,$chan(%tbg.cc),x)) && (X ison $chan(%tbg.cc)) && ($chan(%tbg.cc) == $2)) { .msg X ban $chan(%tbg.cc) $address($1,2) $readini(torips\tbg.ini,$chan(%tbg.cc),xdays) $+ d 75 $left(%tbg.kick.msg,124) $+ $iif($len(%tbg.kick.msg) > 124,...) } } } :tbgbypass inc %tbg.cc } } alias tbgscan { if ((!$chan) && ($1)) { var %tbgscan = $1 } elseif ($chan) { var %tbgscan $chan } else { echo 4 -at TBGScan: Need to know what channel you want to scan. | halt } set %tbgscan.count 1 var %tbg.scantime = $ctime addto.tbgQ ¬StartScanChan %tbgscan while ($nick(%tbgscan,%tbgscan.count,rv)) { addto.tbgQ $nick(%tbgscan,%tbgscan.count,rv) %tbgscan inc %tbgscan.count } addto.tbgQ ¬FinishScanChan %tbgscan %tbgscan.count %tbg.scantime unset %tbgscan.count } alias TBGupdate { if (!$exists(torips\tns_list.txt)) { echo 4 -st *** TBGupdate Error: $mircdir $+ torips\tns_list.txt is missing | halt } if (!$1) { set %TBG.site $read(torips\tns_list.txt) } else { set %TBG.site $1 } if (!$hget(tor.ips)) { if (!$exists(torips)) { .mkdir torips } if (!$exists(torips\tor_ips.hash)) { .hmake tor.ips 1000 } else { .hmake tor.ips 1000 | .hload -b tor.ips torips\tor_ips.hash } } if (!%TBG.site) { TBGupdate | halt } set %TBG.b4 $hget(tor.ips,0).item if (!$sock(TBG)) { sockopen TBG %TBG.site 80 } } on *:sockread:TBG:{ if (!%TBG_csv.bytes) { set %TBG_csv.bytes 0 } var %stext sockread %stext if (($remove(%stext,.) isnum) && ($numtok(%stext,46) == 4)) { hadd tor.ips %stext $ctime } set %TBG_csv.bytes $calc(%TBG_csv.bytes + $sockbr) } on *:sockopen:TBG:{ if ($sockerr) { sockclose $sockname echo 2 -t @Tor-Be-Gone --- echo 2 -t @Tor-Be-Gone *** Tor-Be-Gone: Err there was some error connecting to %TBG.site tbgupdate } else { echo 2 -t @Tor-Be-Gone --- echo 2 -t @Tor-Be-Gone *** Connected to %TBG.site $+ , Downloading update IP list... sockwrite -n $sockname GET /ip_list_all.php/Tor_ip_list_ALL.csv HTTP/1.1 sockwrite -n $sockname Host: %TBG.site $+ $crlf $+ $crlf } } on *:sockclose:TBG: { set %TBG_csv 1 set %TBG_csv.remove 0 while ($hget(tor.ips,%TBG_csv).item) { if ($calc($ctime - $hget(tor.ips,%TBG_csv).data) > 86400) { hdel tor.ips $hget(tor.ips,%TBG_csv).item | inc %TBG_csv.remove } inc %TBG_csv } hsave -bo tor.ips torips\tor_ips.hash If (!$window(@Tor-Be-Gone)) { window -k0nz @Tor-Be-Gone | .log on @Tor-Be-Gone -f Tor-Be-Gone.log } echo 2 -t @Tor-Be-Gone *** IP's Added:3 $calc($hget(tor.ips,0).item - %TBG.b4 + %TBG_csv.remove) $+ , Removed:4 %TBG_csv.remove $+ , Now in Hash:3 $hget(tor.ips,0).item 15( $+ $bytes(%TBG_csv.bytes,k) $+ kb dl from %TBG.site $+ ) unset %TBG.b4 | unset %TBG_csv* | unset %TBG.site tbg_cleandns } alias tbg_cleandns { set %TBG_csv1 1 set %TBG_csv.remove 0 while ($hget(tbg_dns_cache,%TBG_csv1).item) { if ($calc($ctime - $gettok($hget(tbg_dns_cache,%TBG_csv1).data,2,32)) > 172800) { hdel tbg_dns_cache $hget(tbg_dns_cache,%TBG_csv1).item | inc %TBG_csv.remove } inc %TBG_csv1 } echo 2 -t @Tor-Be-Gone *** Addresses Removed from DNS cache:4 %TBG_csv.remove  set %TBG_csv1 1 set %TBG_csv.remove 0 while ($hget(TBG_DNSBL,%TBG_csv1).item) { if (($gettok($hget(TBG_DNSBL,%TBG_csv1).data,1,32) == good) && ($calc($ctime - $gettok($hget(TBG_DNSBL,%TBG_csv1).data,2,32)) > 7200)) { hdel TBG_DNSBL $hget(TBG_DNSBL,%TBG_csv1).item | inc %TBG_csv.remove } if (($gettok($hget(TBG_DNSBL,%TBG_csv1).data,1,32) == bad) && ($calc($ctime - $gettok($hget(TBG_DNSBL,%TBG_csv1).data,2,32)) > 172800)) { hdel TBG_DNSBL $hget(TBG_DNSBL,%TBG_csv1).item | inc %TBG_csv.remove } inc %TBG_csv1 } echo 2 -t @Tor-Be-Gone *** Addresses Removed from DNSBL cache:4 %TBG_csv.remove  unset %TBG_csv* } dialog tbg { title "TBG+DNSBL 1.1.1 Settings" size -1 -1 300 120 option dbu button "Okay",1,200 107 25 11,ok button "Discard",2,270 107 25 11,cancel button "Apply",5,235 107 25 11 text "TBG+DNSBL 1.1.1 By Skxawng (Undernet User: WTSh4rK)",3,5 105 80 13 button "Update IP List",4,90 107 40 11 box "Channel:",10,5 3 190 20 text "Settings for:",11,10 11 40 10 combo 12,45 9 80 10,drop edit button "Add",13,133 9 25 11 button "Remove",14,165 9 25 11 box "Settings:",20,5 25 190 80 text "Use [nick] [chan] [ip] [addr] to get nick, channel, IP and address in your kick.",21,8 33 185 10 text "Ban Messsage:",22,8 44 45 12 combo 23,47 42 145 10,drop edit check "Scan channel when you OP to check for Tor IP's already in channel?",24,8 55 180 10 check "Use X to Kick and Ban Tor Addresses for",25,8 70 110 10 combo 26,118 70 30 10, drop text "days.",27,155 71 30 10 check "Send users for DNSBL lookup?",28,8 85 110 10 box "Addresses to ignore (Global)",30,200 3 95 102 text "",31,205 12 85 70, edit vsbar combo 32,205 22 85 70, edit vsbar button "Add",33,220 90 25 11 button "Remove",34,252 90 25 11 } on 1:dialog:tbg:init:0: { ;echo - %tbg.ini did -o tbg 31 1 $iif($len(e.g. $address($me,8)) >= 30,$left(e.g. $address($me,8),30) $+ ...,e.g. $address($me,8)) if (!$exists($shortfn($mircdir $+ torips\) $+ tbg.ini)) { mkdir torips | writeini $shortfn($mircdir $+ torips\) $+ tbg.ini lists banmsg [nick], Anonymity online is great just not here... BANNED: [ip] ([addr])¬The Onion Router is Banned, Tor Exit Node IP: [ip] ([addr])¬BANNED: Tor Exit Node IP: [ip] ([addr]) | TBGupdate } set %tbg.ini $shortfn($mircdir $+ torips\) $+ tbg.ini didtok tbg 23 172 $readini(%tbg.ini,lists,banmsg) did -c tbg 23 1 didtok tbg 12 172 $readini(%tbg.ini,lists,chans) didtok tbg 32 172 $readini(%tbg.ini,lists,ignore) var %tbg.xdays = 1 while (%tbg.xdays < 101) { did -a tbg 26 %tbg.xdays if (%tbg.xdays = 1) did -c tbg 26 1 inc %tbg.xdays } did -b tbg 14,23,24,25,26,33,34 if ($didwm(tbg,12,$active)) { set %tbg.chan $didwm(tbg,12,$active) did -c tbg 12 $didwm(tbg,12,$active) did -e tbg 14,23,24,25,26 did -b tbg 13 if ($readini(%tbg.ini,$active,banmsg)) { did -ac tbg 23 $readini(%tbg.ini,$active,banmsg) } if ($readini(%tbg.ini,$active,scan)) { did -c tbg 24 } if ($readini(%tbg.ini,$active,x)) { did -c tbg 25 } if ($readini(%tbg.ini,$active,xdays)) { did -c tbg 26 $readini(%tbg.ini,$active,xdays) } if ($readini(%tbg.ini,$active,dnsbl)) { did -c tbg 28 } } else { did -o tbg 12 0 $active | set %tbg.chan $didwm(tbg,12,$active) } } on 1:dialog:tbg:sclick:*: { if (($did == 1) || ($did == 5)) { writeini %tbg.ini lists chans $didtok(tbg,12,172) writeini %tbg.ini $did(tbg,12).seltext banmsg $did(tbg,23,0).text writeini %tbg.ini $did(tbg,12).seltext scan $did(tbg,24).state writeini %tbg.ini $did(tbg,12).seltext x $did(tbg,25).state writeini %tbg.ini $did(tbg,12).seltext xdays $did(tbg,26).seltext writeini %tbg.ini $did(tbg,12).seltext dnsbl $did(tbg,28).state if ($didtok(tbg,32,172)) writeini %tbg.ini lists ignore $didtok(tbg,32,172) else remini %tbg.ini lists ignore } if ($did == 12) { did -e tbg 1,14,23,24,25,26 did -b tbg 13 did -d tbg 23 3 if ($readini(%tbg.ini,$did(tbg,12).seltext,banmsg)) { did -ac tbg 23 $readini(%tbg.ini,$did(tbg,12).seltext,banmsg) } if ($readini(%tbg.ini,$did(tbg,12).seltext,scan)) { did -c tbg 24 } else { did -u tbg 24 } if ($readini(%tbg.ini,$did(tbg,12).seltext,x)) { did -c tbg 25 } else { did -u tbg 25 } if ($readini(%tbg.ini,$did(tbg,12).seltext,xdays)) { did -c tbg 26 $readini(%tbg.ini,$did(tbg,12).seltext,xdays) } if ($readini(%tbg.ini,$did(tbg,12).seltext,dnsbl)) { did -c tbg 28 } else { did -u tbg 28 } } if ($did == 13) { if ($did(tbg,12,0).text) { did -a tbg 12 $did(tbg,12,0).text did -c tbg 12 $didwm(tbg,12,$did(tbg,12,0).text) did -e tbg 1,14,23,24,25,26 did -b tbg 13 if ($readini(%tbg.ini,$did(tbg,12,0).text,banmsg)) { did -i1c 24 $readini(%tbg.ini,$did(tbg,12,0).text,banmsg) } if ($readini(%tbg.ini,$did(tbg,12,0).text,scan)) { did -c tbg 24 } if ($readini(%tbg.ini,$did(tbg,12,0).text,x)) { did -c tbg 25 } } } if ($did == 14) { if ($?!"Are you sure you want to remove $did(tbg,12).seltext $+ ?") { did -b tbg 1,14,23,24,25,26 did -u tbg 24,25 did -c tbg 26 14 did -d tbg 23 3 did -c tbg 23 1 did -e tbg 13 remini %tbg.ini $did(tbg,12).seltext did -d tbg 12 $did(tbg,12).sel writeini %tbg.ini lists chans $didtok(tbg,12,172) did -o tbg 12 0 $null } } if ($did == 4) { dialog -x tbg window -r @Tor-Be-Gone tbgupdate } if ($did = 33) { did -a tbg 32 $did(tbg,32).text did -b tbg 33 } if ($did == 32) { did -e tbg 34 } if ($did == 34) { did -d tbg 32 $did(tbg,32).sel did -b tbg 34 } } on 1:dialog:tbg:edit:*: { if ($did == 12) { did -b tbg 1,14,23,24,25,26 did -u tbg 24,25 did -c tbg 26 14 did -d tbg 23 3 did -c tbg 23 1 did -e tbg 13 } if ($did == 32) { if ($did(tbg,32).text) did -e tbg 33 else did -b tbg 33 } } menu channel { TBG+DNSBL .TBG Settings:dialog -m tbg tbg .Show TBG Status Window:window -rd @TBG-Status .Maintenance ..Clear The Scan Que (Que $line(@tbgQ,0) $+ ): { if ($input(Are you sure you want to clear the scan que?,y)) { window -c @tbgQ | if ($input(Scan Que Cleared.,o)) { } } } ..Clear The DNS cache (Cached $hget(tbg_dns_cache,0).item $+ ): { if ($input(Are you sure you want $hget(tor.tbg_dns_cache,0).item IP's deleted from the DNS IP cache?,y)) { .hfree tbg_dns_cache | .hmake tbg_dns_cache 1000 | hsave -o tbg_dns_cache torips\tbg_dns_cache.hash | if ($input(DNS IP's Cleared.,o)) { } } } ..Clear The Tor IP cache (Cached $hget(tor.ips,0).item $+ ): { if ($input(Are you sure you want $hget(tor.ips,0).item IP's deleted from the Tor IP cache?,y)) { .hfree tor.ips | .hmake tor.ips 1000 | hsave -bo tor.ips torips\tor_ips.hash | if ($input(Tor IP's Cleared. You will now need to update the Tor Exit Node IP List,o)) { } } } ..Clear The DNSBL cache (Cached $hget(TBG_DNSBL,0).item $+ ): { if ($input(Are you sure you want $hget(TBG_DNSBL,0).item IP's deleted from the DNSBL IP cache?,y)) { .hfree TBG_DNSBL | if ($input(DNSBL IP's Cleared,o)) { } } } .- . $+ $iif($istok($readini(torips\tbg.ini,lists,chans),$chan,172),Scan the channel for Tor $iif($readini(%tbg.ini,$chan,dnsbl),and DNSBL),) :tbgscan $chan .- .Update Tor exit node IP list: { window -r @Tor-Be-Gone | tbgupdate } } menu nicklist { - Check with TBG : { set %tbgscan.count 1 var %tbg.scantime = $ctime addto.tbgQ ¬StartScanChan $chan $1 ~ addto.tbgQ $1 $chan addto.tbgQ ¬FinishScanChan $chan %tbgscan.count %tbg.scantime $1 } - } raw 315:*: { if ($2 isin %tbg.who) { set %tbg.who $remtok(%tbg.who,$2,1,32) | haltdef } } raw 352:*: { if ($2 isin %tbg.who) { haltdef } } on 1:unload: { unset %tbg* timerTBG.update off timertbgq off hfree tor.ips hfree torchk hfree TBG_DNSBL hfree tbg_dns_cache echo -ts *** Tor-Be-Gone has been unloaded. }