full-disclosure-uk May 2007 archive
Main Archive Page > Month Archives  > full-disclosure-uk archives
full-disclosure-uk: Re: [Full-disclosure] Mac OS X "ps(3)&q

Re: [Full-disclosure] Mac OS X "ps(3)" and "top(3)" truncate output

From: <Valdis.Kletnieks_at_nospam>
Date: Fri May 11 2007 - 15:40:38 GMT
To: matador matador <m4t4d00r@gmail.com>


On Fri, 11 May 2007 17:18:20 +0200, matador matador said:

> rfc-1918:~ xxx$ ps aux > ps_output

> we can see that "ps" doesn't print completely the path.

ps auxw will do so. If that isn't enough, try 'ps auxewwwwww'

> rfc-1918:~ xxx$ cat ps_output | grep iTunes

This wins an award for 'Pointless use of cat'. Preferred:

% grep iTunes ps_output
% grep iTunes < ps_output

Or don't bother with the intermediate file at all:

% ps auxw | grep 'i[T]unes'

(Yes, the [] are intentional, and experienced Unix/Linux users know why :)

(As an added bonus, on some systems /bin/ps will notice that it's going to a pipe, and automagically disable the 'trim to terminal width' code for you, totally obviating the issue. A quick check shows Linux does, Solaris and an older AIX box don't.)

> These issues open an user-space rootkit scenario.

No scenario that hasn't been there for literally a quarter of a century already, the 'w' flag was added *decades* ago for basically this reason....



Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html Hosted and sponsored by Secunia - http://secunia.com/