#!/usr/bin/perl use WWW::Google::Groups; $agent = new WWW::Google::Groups(server => 'http://groups.google.com'); $group = $agent->select_group('news.admin.net-abuse.sightings'); $threshold = $ARGV[0] || 20; $cnt = 0; open $blacklist, ">blacklist"; open $blacklist_log, ">blacklist_log"; while( $thread = $group->next_thread() ){ while( $article = $thread->next_article() ){ $body = $article->body(); if($body =~ /^From: .+$/mo){ if( $& =~ /[\b<](.+?@.+)[\b>]/o ){ print {$blacklist} $1,$/; $cnt++; } print {$blacklist_log} join( q/ /, $thread->title(), '=>', $1),$/; } last; } last if $cnt >= $threshold; }