Why your code doesn't work

If all the machines have their C-Drive shared as c$ (and that's a big if, but I don't know your network, and then it's Windows' default sharename anyway), then you will have to escape the $, as in

"//$_/c\$/Program Files/KaZaA Lite/kazaa.exe"

The rest doesn't need to be escaped.

Ways to improve your code

Using the same approach, but more clean code:

my %paths = ('KaZaA Lite' => 'c$/Program Files/KaZaA Lite/kazaa.exe', 'KaZaA' => 'c$/Program Files/Kazaa/kazaa.exe'); foreach (@machine) { foreach my $key (keys %paths) { print "Bah! Someone installed $key on $_!\n" if (-e "//$_/$key"); } }

Now, you can scan for additional files very easily, without changing too much of your code (only the hash at the beginning, actually).

Different approaches

You might consider running a portscan against these machines, focusing on ports that are known to be used by p2p software. Yes, it's not failsafe, but it helps. Most users will not bother to customize their install, I guess.

You might also consider scanning the whole network share for suspicious file names, in case the user installs the program in a non-standard location.


In reply to Re: Tracking Kazaa? by crenz
in thread Tracking Kazaa? by ergowolf

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.