Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: (perlvar) changing program name

by sintadil (Pilgrim)
on Sep 11, 2004 at 21:24 UTC ( [id://390319]=note: print w/replies, xml ) Need Help??


in reply to (perlvar) changing program name

hello, i'm trying this "proof of concept" script, to make sure i can modify the output of a ps for a given perl script, as stated on perlvar manpage.

If you're aiming for any sort of portability across operating systems -- or even different versions of the same operating system -- you should keep in mind that not all systems support modifying this value. Any halfway secure operating system won't let you.

But what if I want to hide what I'm running from other people? Not being able to change $^X is insecure!

Reconsider the ethical standpoint of what you're doing, or install a decent operating system (or OS interface) which allows you to hide your processes from other users (except, optionally, the super-user(s) or a select group of administrators).

Replies are listed 'Best First'.
Re^2: (perlvar) changing program name
by steves (Curate) on Sep 11, 2004 at 21:59 UTC

    The man page for perlvar says:

    On some operating systems assigning to "$0" modifies the argument area that the ps program sees.
    The emphasis being on some

    Printing $0 in your program means nothing. That's the value that your program sees. If, as a side effect, the value ps sees is also modified, you can bet that Perl isn't querying that ps value to show you what it has in $0.

      i /do/ realize this, that's exactly why i've pointed out which Operating System i'm running ( Linux, kernel 2.4.21, distro Slackware ). I don't aim any portability at all, just a script that should be able to inform it's current state on the "ps" output of a linux machine.
Re^2: (perlvar) changing program name
by slipwalker (Acolyte) on Sep 11, 2004 at 22:53 UTC
    thanks !!! these two comments gave me the answer !!!
    ( or even different versions of the same operating system && Any halfway secure operating system won't let you )
    the script won't work on Slackware, but runs fine on Mandrake Linux ( the target system is RedHat, so another test is needed, but i'm confident it's not "halfway secure" as Slack )
    again, thank you !!!!
      I didn't see anyone mention this. 5.8.0 had a bug under some OSes where setting $0 just didn't work. Linux was one of these affected. This was fixed in some later release, but I don't know which 5.8.x that was.

      I got trapped by this and other bits, needing to wait for a post-5.8.0 release, and then getting hit with "but now the system is too important to risk upgrading." But somehow arranging for the backup second system hasn't been important ...

Re^2: (perlvar) changing program name
by slipwalker (Acolyte) on Sep 11, 2004 at 22:38 UTC
    But what if I want to hide what I'm running from other people? Not being able to change $^X is insecure!
    excuse me, but where did this quote came from ? not from anywhere in my original post...

      excuse me, but where did this quote came from ? not from anywhere in my original post...

      It was from a hypothetical, stereotypical user who doesn't exist except in my twisted mind. :) Think of it as answering an unasked question before it was asked.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://390319]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found