Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Well I guess I should not post when I am tired. Does that sound better then posting without a license? ;-)

In your case that does make sense! 500 Servers ick. I was going to say why not automate but if you have 500 servers then you have a few thousand workstations. Right?

I only have about 350 machines total. The script I wrote checks all machines. I used the Roth NetAdmin mod to get a list of all NT/2000 workstations and servers. The only problem is that you have to build exclusion routines for stuff like Samba servers. But again in my case, people here would not always update the input file.

Why not build a ping into the routine. That way if a machine is down, you avoid the registry error when it tried to connect. I needed this because a few of our junior admins would go looking for the down machine and try and figure out why it did not have McAfee or Netshield installed! *SIGH*

A simple code:
my $p = Net::Ping->new("icmp"); if ($p->ping($computer)) { #run your checks } else { print"* Unable to Ping $computer *\n"; } $p->close(); }

Also this is strictly a choice of the person since there is no "real" noticible difference. But if you played with Connect option you could lesson some of your typing. As in:

if ($key = $Registry->Connect("$computer","LMachine/Software/Network A +ssociates/" . "TVD/NetShield NT/CurrentVersion/" {Access=>KEY_READ} ) ) { unless ($version = $key->GetValue("szProductVer")) { $version = "Unknown"; } unless ($dat = $key->GetValue("szVirDefVer")) { $dat = "Unknown"; } unless ($engine = $key->GetValue("szEngineVer")) { $engine = "Unknown"; } }

But this again is the choice of the person. For me if there was a typo, I would have to work at the long lines because I have dyslexia. So the chopped up lines make it a easier for me to read.

Oh did you know you could toss your delimeter up in the use statement? One less line....

use Win32::TieRegistry( Delimiter=>"/" );

How about a piece offering. This code will go out to the mcafee downloads site and get you the current dat, superdat and engine info. You will need LWP::UserAgent, HTTP::Request, and HTML::TableExtract(this is a slick mod).

For some strange reason the engine info comes out with a bunch of lines. Can't tell if NAI did something to their website or it is a bug. I think it is their site because it worked fine in the morning. You can correct this issue by resaving the engine var as an int

# # GetCurrentVersion will the Mcafee download page and grab the version + number # for the latest DAT, superDAT, and engine. sub GetCurrentVersion { my $key; my $dat; my $superdat; my $engine; my $html_code; my $row; my $ts; # # Lets access the Network Associates download page for the Virus I +nfo. my $ua = new LWP::UserAgent; my $url = ' +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); foreach $ts ($te->table_states) { #print "Table found at ", join(',', $ts->coords), ":\n"; foreach $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 = @$row[1]; } #print " ", join(' , ', @$row), "\n"; } } return($dat, $superdat, $engine); }

So again I meant no disrespect. Sorry for such a wanky post.

In reply to My apologies by Marza
in thread McAfee Dat Check by OzzyOsbourne

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2023-09-30 00:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found