outsider

TCL DnsBL

Feb 7th, 2011
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. setudef flag dnsbl
  2.  
  3. bind join - * dnsbl:join
  4. proc dnsbl:join { nick host hand chan } {
  5.         if {![channel get $chan dnsbl] || [string match *users.undernet.org $host]} {
  6.                 return 0
  7.         }
  8.         set host [lindex [split $host @] 1]
  9.         if {[testip $host]} {
  10.                 dnsbl:dns $host $host 1 $host $nick
  11.         } else {
  12.                 dnslookup $host dnsbl:dns $host $nick
  13.         }
  14. }
  15.  
  16. proc dnsbl:dns { ip host status host nick } {
  17.         if {$status == 0} { return 0 }
  18.         set a [lindex [split $ip .] 0]
  19.         set b [lindex [split $ip .] 1]
  20.         set c [lindex [split $ip .] 2]
  21.         set d [lindex [split $ip .] 3]
  22.     foreach dns "dnsbl.dronebl.org rbl.efnet.org dnsbl.njabl.org list.dsbl.org" {
  23.             dnslookup $d.$c.$b.$a.$dns dnsbl:reply $host $nick $ip $dns
  24.     }
  25. }
  26.  
  27. proc dnsbl:reply { ip host status host nick userip dnsbl} {
  28.         global botnick
  29.         if {$status == 0} { return 0 }
  30.         set reason "Your host is listed in $dnsbl - Goodbye"
  31.         foreach chan [channels] {
  32.                 if {[channel get $chan dnsbl]} {
  33.             if {![matchban $host $chan]} {
  34.                             if {[onchan X $chan]} {
  35.                     if {[botisop $chan] || [botisvoice $chan]} {
  36.                         putserv "CPRIVMSG X :ban $chan *!*@${host} 1d 100 $reason"
  37.                     } else {
  38.                                         putserv "PRIVMSG X :ban $chan *!*@${host} 1d 100 $reason"
  39.                     }
  40.                             } elseif {[botisop $chan]} {
  41.                     newchanban *!*@${host} $chan dnsbl $reason
  42.                             }
  43.             }
  44.                 }
  45.         }
  46. }
  47.  
  48. putlog "dnsBL TCL Loaded"
Add Comment
Please, Sign In to add comment