Posted to tcl by Stu at Fri Mar 29 14:29:51 GMT 2024view raw

  1. # Slop filter "botstopper"
  2.  
  3. proc filter_init {} { variable filter_bots [list claudebot] }
  4.  
  5. proc filter_bots {} { variable filter_bots; return $filter_bots }
  6.  
  7. proc filter_do {d} {
  8. set ua_bot [format_ua_bot [dict get $d ua]]
  9. if {$ua_bot ni [filter_bots]} skip
  10. set ip [dict get $d ip]
  11. exec -ignorestderr /usr/bin/doas /sbin/pfctl -tbots -Tadd $ip 2>@1
  12. #ok "Added $ua_bot [dict get $d ip]"
  13. skip
  14. }
  15.  
  16. # EOF