#!/usr/bin/perl -w

# (c) 2006 Vincent Deffontaines <vincent@inl.fr>
#This script is licensed under the GPL v2 license.
# DISCLAIMER :
# Of course, this script doesn't work so use at your own risks.
# This script WILL delete unwanted email, and you will get fired because of that.
# Not my fault !

use strict;
#use Data::Dumper;

use LWP::UserAgent;

#EDIT THIS AND REPLACE WITH YOUR OWN PROJECT
my @crap_list = ('http://lists.nongnu.org/mailman/admindb/nufw-devel',
                 'http://lists.nongnu.org/mailman/admindb/nufw-announces',
                 'http://lists.nongnu.org/mailman/admindb/nufw-users'
                 );

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->cookie_jar({ file => "/tmp/.cookies.txt" });

foreach my $url(@crap_list)
{
#EDIT THIS AND REPLACE WITH YOUR OWN PASSWORD
  my @password = ('adminpw'=>'CHANGETHIS');
  my $response = $ua->post($url,\@password);
  @password=('discardalldefersp'=>1);
  my $i=0;

  
#  print Dumper($ua->cookie_jar);
#  $password['discardalldefersp']=1;
  $response = $ua->post($url,\@password);
#  print $response->content;

  my $res = $response->content;
  while ($res =~ s/.*name=\"([^"]+)\"\s+\S+\s+value=\"(\d+)\"\s+CHECKED//)
  {
    push(@password,$1=>$2);
  }
#  print Dumper(@password);
#  exit(0);

  $response = $ua->post($url,\@password);
#  print $response->content;
  

}
