This little bit of code was used as part of a AVP checker. I needed something that would go out to the network Associates site and get the current versions of the DAT, SuperDat, and engine.

You will need

use LWP::UserAgent; use HTTP::Request; use HTML::TableExtract;
# # GetCurrentVersion will access the Mcafee download page and grab the +version number # for the latest DAT, superDAT, and engine. sub GetCurrentVersion { # # Lets access the Network Associates download page for the Virus I +nfo. my $html_code; my $ua = new LWP::UserAgent; my $url = 'http://www.mcafeeb2b.com/naicommon/download/dats/find.a +sp'; my $request = new HTTP::Request('GET',$url); # # Do we need to login? #$request->authorization_basic('login', 'password'); $ua->timeout(10); my $response = $ua->request($request); my $responsecode = $response->code(); # # Now we need to gather the information. if ($responsecode != 200) { print "Failed to Access the Mcafee site!: $responsecode\n"; } else { # # Load the HTML junk into a var. my @array = (split "\n", $ua->request($request)->as_string); foreach (@array) { $html_code .= $_ . "\n"; } } # # It's time to use TableExtract. We use the File Version and Date +for # header info to locate our tables. Once found; we look for certa +in # names and assing the version info to our needed vars. my $te = new HTML::TableExtract( headers => [qw(File Version Date) +] ); $te->parse($html_code); my ( $dat, $superdat, $engine); foreach my $ts ($te->table_states) { #print "Table found at ", join(',', $ts->coords), ":\n"; foreach my $row ($ts->rows) { # # DAT Version if (@$row[0] =~ /DAT File for weekly v4x \(DAT Only\)/) { #print "DAT = @$row[1]\n"; $dat = @$row[1]; } # # SuperDAT version which has both Engine and DAT. if (@$row[0] =~ /SuperDat File for v4x \(DAT \+ Engine\)/) + { #print "Superdat = @$row[1]\n"; $superdat = @$row[1]; } # # Engine only Version. if (@$row[0] =~ /Superdat File for v4x \(Intel Engine only +\)/) { $engine = int @$row[1]; } #print " ", join(' , ', @$row), "\n"; } } return($dat, $superdat, $engine); }

In reply to Mcafee Version Checker by Marza

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.