#!/usr/bin/perl # # NIST NVD Feed Parser # David Kyger 7-6-07 # License - GNU GPL use XML::Simple qw(:strict); use Data::Dumper; use POSIX qw(strftime); my $report = "report.html"; open(REPORT,">$report"); my $url = 'http://nvd.nist.gov/download/nvdcve-recent.xml'; `/usr/local/bin/wget -q $url`; my $file = "nvdcve-recent.xml"; my $today = strftime( "%Y-%m-%d", localtime ); my $yesterday = strftime( "%Y-%m-%d", localtime(time-86400)); $xml = new XML::Simple; $data = $xml->XMLin( "nvdcve-recent.xml", KeyAttr => { cve => 'entry' }, ForceArray => [ 'cve', 'ref' ] ); my $e; print REPORT '<html><body>'; print REPORT '<table style="text-align: left;" border="1" cellpadding="2" cellspaci +ng="2"><tbody>'; print REPORT '<tr><td><b>Name</b></td><td><b>Published</b></td><td><b>Modified</b>< +/td><td><b>Severity</b></td><td><b>Description</b></td><td><b>Referen +ces</b></td></tr>' ; foreach $e ( @{ $data->{entry} } ) { if ( $e->{severity} =~ /High/ && $e->{modified} =~ /($today|$yeste +rday)/ ) { ; print REPORT '<tr><td>' . $e->{name} . '</td>'; print REPORT '<td>' . $e->{published} . '</td>'; print REPORT '<td>' . $e->{modified} . '</td>'; print REPORT '<td>' . $e->{severity} . '</td>'; print REPORT '<td>' . $e->{desc}->{descript}->{content} . '</td><td><br>'; foreach $ref ( @{ $e->{refs}->{ref} } ) { print REPORT '<a href="' . $ref->{url} . '" target="_blank +">'; print REPORT $ref->{source} . '</a><br>'; } } } print REPORT '</td></tr>'; print REPORT '</table><p>'; print REPORT '</html></body>';

In reply to NIST NVD Feed Parser by semio

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.