Nice! I've got two style nits that I would have used had I written this code:
  1. I try to use significant variable names: $i -> $pid
  2. I always try to reduce the number of indent levels: if -> next
So the body of the code would look like this if I had written it:
my $pid; for $pid (0..65536) { #test -f $pid/cmdline && (cat $pid/cmdline; echo $pid); next unless -f "/proc/$pid/exe"; my $target = readlink "/proc/$pid/exe"; next if -f $target; open F, "< /proc/$pid/cmdline"; my @data = <F>; print "ALERT: '@data' is running (pid $pid)\n"; close F; local $/ = "\x00"; open F, "< /proc/$pid/environ"; @data = <F>; print "ALERT: 'environment: @data'\n"; close F; };

Liz


In reply to Re: Checking for unlinked process executables by liz
in thread Checking for unlinked process executables by Corion

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.