f-off-friendly-scanner.pl 481 B

12345678910111213141516171819
  1. #!/usr/bin/perl
  2. # Fsck Friendly Scanner
  3. #
  4. use Data::Dumper;
  5. require ESL;
  6. $| = 1;
  7. my $c = new ESL::ESLconnection("localhost", "8021", "ClueCon");
  8. $c->events("plain", "CUSTOM sofia::register");
  9. while ($c->connected()) {
  10. my $event = $c->recvEvent();
  11. my $user_agent = $event->getHeader('user-agent');
  12. my $network_ip = $event->getHeader('network-ip');
  13. if ($user_agent =~ m/(friendly-scanner|sipcli)/i) {
  14. system("/sbin/iptables -I INPUT -s $network_ip -j DROP");
  15. }
  16. }