#!perl
use IO::Socket;
use HTML::Entities;
$|=1;
@milw0rm = ( );
@milw0rm_title = ( );
$id1=0;
$id2=0;
$xpldir = "/opt/lampp/htdocs/parser/test";
while (1) {
$sock = IO::Socket::INET->new(Proto => "tcp", PeerAddr => "milw0rm.com", PeerPort => "80") || die("Could not connect to milw0rm.org");
print $sock "GET /rss.php HTTP/1.0\nHost: milw0rm.com\nConnection: close\n\n";
while ($foo = <$sock>) {
if ($foo =~ /(http:\/\/www.milw0rm.com\/exploits\/(\S+)<\/guid><\/item>)/gi) {
$xpl = $1;
$xpl =~ s/http:\/\/www.milw0rm.com\/exploits\///eg;
$xpl =~ s/<\/guid><\/item>//eg;
print "$xpl\n";
push(@milw0rm, "$xpl");
}
if ($foo =~ /((.*?)<\/title>)/gi) {
$title = $1;
next if $title =~ /milw0rm.com<\/title>/gi;
$title =~ s///eg;
$title =~ s/<\/title>//eg;
$title = decode_entities( $title );
print "$title\n";
push(@milw0rm_title, "$title");
}}
open (CH, ";
close CH;
@unique_milw0rm = ();
for (my $i;$i<=$#milw0rm_title;$i++) {
$seen = 0;
for (my $j;$j<=$#check;$j++) {
if ($milw0rm_title[$i] =~ /$check[$j]/) {
$seen = 1;
next;
}};
if ($seen == 0) { push @unique_milw0rm, $milw0rm_title[$i]};
};
foreach $title1 (@milw0rm_title) {
chomp $title1;
$id1++;
open (LOG, ">>/opt/lampp/htdocs/parser/test/exploit_description.txt");
print LOG "$id1|$title1\n";
close LOG;
}
foreach $xpl1 (@milw0rm) {
chomp $xpl1;
if (!-e "/opt/lampp/htdocs/parser/test/$xpl1") {
if (!-e "/opt/lampp/htdocs/parser/test/$xpl1.rar") {
$id2++;
open (LOG, ">>/opt/lampp/htdocs/parser/test/list.txt");
print LOG "$id2|$xpl1\n";
close LOG;
system("wget --no-clobber --directory-prefix=$xpldir http://milw0rm.com/exploits/download/$xpl1");
system("chmod 0644 $xpldir/$xpl1");
#system("cd $xpldir/; rar a -m5 -ed -o- -sve -tl -tsa -rr -vp -dh -ri1 -k -inul $xpldir/$xpl1.rar $xpldir/$xpl1 ; rm -rf $xpl1");
}}}
print "DONE FOR NOW\n";
sleep(20);
#sleep(10800);
}