Advertisement
Guest User

Untitled

a guest
Oct 7th, 2011
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 3.10 KB | None | 0 0
  1. # open proxy checker for eggdrop
  2. # (c) James Seward 2003/4
  3. # version 1.0
  4.  
  5. # http://www.jamesoff.net/projects/eggdrop
  6. # james@jamesoff.net
  7.  
  8. # Released under the GPL
  9.  
  10. ## INSTRUCTIONS
  11. ###############################################################################
  12.  
  13. # This script will check the hosts of people joining channels against one or
  14. # RBLs. Choose your RBLs wisely, some of them list DIALUP SPACE and that would
  15. # be a bad thing to be matching your IRC users against :P
  16. #
  17. # Enable the 'proxycheck' flag for channels you want the script active on
  18. # --> .chanset #somechannel +proxycheck
  19. #
  20. # Users who are +o, +v, or +f in your bot (local or global) won't be checked.
  21. #
  22. # Turn on console level d on the partyline to see some debug from the script
  23. # --> .console +d (to enable)
  24. # --> .console -d (to disable)
  25.  
  26. ## CONFIG
  27. ###############################################################################
  28.  
  29. # space-separated list of RBLs to look in
  30. set proxycheck_rbls { "dnsbl.swiftbl.org" "dnsbl.ahbl.org" "ircbl.ahbl.org" "rbl.efnet.org" "dnsbl.dronebl.org" }
  31.  
  32. # time in minutes to ban for
  33. set proxycheck_bantime 15
  34.  
  35. # stop editing here unless you're TCL-proof
  36.  
  37.  
  38.  
  39. ## CODE
  40. ###############################################################################
  41.  
  42. #add our channel flag
  43. setudef flag proxycheck
  44.  
  45. #bind our events
  46. bind join - *!*@* proxycheck_join
  47.  
  48. #swing your pants
  49.  
  50. # catch joins
  51. proc proxycheck_join { nick host handle channel } {
  52.   #check we're active
  53.   if {![channel get $channel proxycheck]} {
  54.     return 0
  55.   }
  56.  
  57.   #don't apply to friends, voices, ops
  58.   if {[matchattr $handle fov|fov $channel]} {
  59.     return 0
  60.   }
  61.  
  62.   #get the actual host
  63.   regexp ".+@(.+)" $host matches newhost
  64.   if [regexp {[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $newhost] {
  65.     #it's a numeric host, skip the lookup
  66.     proxycheck_check2 $newhost $newhost 1 $nick $newhost $channel
  67.   } else {
  68.     putloglev d * "proxycheck: doing dns lookup on $newhost to get IP"
  69.     dnslookup $newhost proxycheck_check2 $nick $newhost $channel
  70.   }
  71. }
  72.  
  73. # first callback (runs RBL checks)
  74. proc proxycheck_check2 { ip host status nick orighost channel } {
  75.   global proxycheck_rbls
  76.  
  77.   if {$status} {
  78.     putloglev d * "proxycheck: $host resolves to $ip"
  79.  
  80.     # reverse the IP
  81.     regexp {([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})} $ip matches a b c d
  82.     set newip "$d.$c.$b.$a"
  83.  
  84.     # look it up in the rbls
  85.     foreach rbl $proxycheck_rbls {
  86.       putloglev d * "proxycheck: looking up $newip.$rbl"
  87.       dnslookup "$newip.$rbl" proxycheck_check3 $nick $host $channel $rbl
  88.     }
  89.   } else {
  90.     putlog "proxycheck: Couldn't resolve $host. (No further action taken.)"
  91.   }
  92. }
  93.  
  94. # second callback (catches RBL results)
  95. proc proxycheck_check3 { ip host status nick orighost channel rbl } {
  96.   global proxycheck_bantime
  97.  
  98.   if {$status} {
  99.     putlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
  100.     newchanban $channel "*@$orighost" "proxychk" "proxycheck: $rbl" $proxycheck_bantime
  101.   }
  102.   #if we didn't get a host, they're not in RBL
  103. }
  104.  
  105. putlog "proxycheck 1.0 by JamesOff loaded"
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement