Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 07:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found