Mercurial > hg > maltfilter
comparison maltfilter @ 67:8df5d52436a1
More work towards DroneBL support.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 18 Aug 2009 03:38:31 +0300 |
parents | 42889eed0ce8 |
children | bac5931b8312 |
comparison
equal
deleted
inserted
replaced
66:42889eed0ce8 | 67:8df5d52436a1 |
---|---|
516 ### DroneBL submission support | 516 ### DroneBL submission support |
517 ############################################################################# | 517 ############################################################################# |
518 sub dronebl_process | 518 sub dronebl_process |
519 { | 519 { |
520 return unless ($settings{"DRONEBL"} > 0); | 520 return unless ($settings{"DRONEBL"} > 0); |
521 return if ($settings{"DRY_RUN"}); | |
522 | 521 |
523 # Create submission data | 522 # Create submission data |
524 my $xml = "<?xml version=\"1.0\"?>\n<request key=\"".$settings{"DRONEBL_RPC_KEY"}."\">\n"; | 523 my $xml = "<?xml version=\"1.0\"?>\n<request key=\"".$settings{"DRONEBL_RPC_KEY"}."\">\n"; |
525 my $entries = 0; | 524 my $entries = 0; |
526 while (my ($ip, $entry) = each(%dronebl)) { | 525 while (my ($ip, $entry) = each(%dronebl)) { |
527 if ($entry->{"sent"} == 0 && $entry->{"tries"} < 3) { | 526 if ($entry->{"sent"} == 0 && $entry->{"tries"} < 3) { |
528 $xml .= "<add ip=\"".$ip."\" type=\"1\" />\n"; | 527 $xml .= "<add ip=\"".$ip."\" type=\"".$entry->{"type"}."\" />\n"; |
529 # $xml .= "<add ip=\"".$ip."\" type=\"".$entry->{"type"}."\" />\n"; | |
530 $entries++; | 528 $entries++; |
531 } | 529 } |
532 } | 530 } |
533 $xml .= "</request>\n"; | 531 $xml .= "</request>\n"; |
534 | 532 |
535 # Bait out if no entries to submit | 533 # Bait out if no entries to submit |
536 return unless ($entries > 0); | 534 return unless ($entries > 0); |
537 mlog(1, "[DroneBL] Trying to submit $entries entries.\n"); | 535 if ($settings{"DRY_RUN"}) { |
538 | 536 mlog(1, "[DroneBL] Would submit $entries entries.\n"); |
539 return; | 537 # return; |
540 | 538 } else { |
539 mlog(1, "[DroneBL] Trying to submit $entries entries.\n"); | |
540 } | |
541 | |
541 # Submit via HTTP XML-RPC | 542 # Submit via HTTP XML-RPC |
542 my $tmp = LWP::UserAgent->new; | 543 my $tmp = LWP::UserAgent->new; |
543 $tmp->agent("Maltfilter/".$progversion); | 544 $tmp->agent("Maltfilter/".$progversion); |
544 $tmp->timeout(10); | 545 $tmp->timeout(10); |
545 my $req = HTTP::Request->new(POST => $settings{"DRONEBL_RPC_URI"}); | 546 my $req = HTTP::Request->new(POST => $settings{"DRONEBL_RPC_URI"}); |