From csides at autozone.com Tue Nov 21 15:20:37 2000 From: csides at autozone.com (Carl Brock Sides) Date: Thu Aug 5 00:07:15 2004 Subject: [Memphis.pm] perl discovery of the day Message-ID: <20001121152036.E9545@tanuki.autozone.com> Did you know you can affect how your perl process appears in a "ps" listing by writing to $0? csides@tanuki:~$ perl -e '$0 = "magic proctitle"; while(1){1}' & [1] 22279 csides@tanuki:~$ ps -ef | grep magic csides 22279 15033 96 15:17 pts/4 00:00:03 magic proctitle csides 22282 15033 0 15:17 pts/4 00:00:00 grep magic -- Brock Sides csides@autozone.com #/usr/bin/perl #.: .|-| ::||-| .||-:: ::|||-| :|-. :||-:: .:-| |-| 0-| .-| ||| #0 ||-:: ::|||-| |||-| |-| 0-| .-| |||-.: ::-:: :|||-| :||| #| .|||-| .||-.| :-| .||-| ||-| .-: .|-:: ::|||-| .||-| ::| open(Q,$0);while(){if(/^#(.*)$/){for(split('-',$1)){$q=0;$qq=0; for(split){s/\|/:.:/g;s/:/../g;$Q=$_?length:$_;$q+=$qq?$Q:$Q*20; $qq++;}print chr($q);}}}print"\n"; __END__ ---------------------------------------------------------------------------- To unsubscribe, please send email to majordomo@pm.org with 'unsubscribe memphis-pm-list' in the body of the message. ---------------------------------------------------------------------------- From perl at erd3.com Wed Nov 22 01:45:17 2000 From: perl at erd3.com (perl@erd3.com) Date: Thu Aug 5 00:07:15 2004 Subject: [Memphis.pm] perl discovery of the day In-Reply-To: <20001121152036.E9545@tanuki.autozone.com> Message-ID: On Tue, 21 Nov 2000, Carl Brock Sides wrote: > Did you know you can affect how your perl process appears in a "ps" > listing by writing to $0? You can also do it in C. I had a utility that required the password to be passed on the command line. It ran in the background like a daemon. When you did a 'ps auwwx' the password was visable. I modified the program so that it set all of it's arguments to a zero byte string. No more password in ps. > > #/usr/bin/perl > #.: .|-| ::||-| .||-:: ::|||-| :|-. :||-:: .:-| |-| 0-| .-| ||| > #0 ||-:: ::|||-| |||-| |-| 0-| .-| |||-.: ::-:: :|||-| :||| > #| .|||-| .||-.| :-| .||-| ||-| .-: .|-:: ::|||-| .||-| ::| > open(Q,$0);while(){if(/^#(.*)$/){for(split('-',$1)){$q=0;$qq=0; > for(split){s/\|/:.:/g;s/:/../g;$Q=$_?length:$_;$q+=$qq?$Q:$Q*20; > $qq++;}print chr($q);}}}print"\n"; > __END__ I know what the above code does, could you explain how it does it? Reece Dike ---------------------------------------------------------------------------- To unsubscribe, please send email to majordomo@pm.org with 'unsubscribe memphis-pm-list' in the body of the message. ---------------------------------------------------------------------------- From dysan_2000 at hotmail.com Mon Nov 27 16:39:45 2000 From: dysan_2000 at hotmail.com (Big Ed) Date: Thu Aug 5 00:07:15 2004 Subject: [Memphis.pm] perl discovery of the day Message-ID: Yup. Any time you fork(), you choose the name of the forked process. Same with a pipe(); Ed >From: >Reply-To: memphis-pm-list@pm.org >To: memphis-pm-list@pm.org >Subject: Re: [Memphis.pm] perl discovery of the day >Date: Wed, 22 Nov 2000 01:45:17 -0600 (CST) > > > >On Tue, 21 Nov 2000, Carl Brock Sides wrote: > > > Did you know you can affect how your perl process appears in a "ps" > > listing by writing to $0? > >You can also do it in C. I had a utility that required the password to be >passed on the command line. It ran in the background like a daemon. When >you did a 'ps auwwx' the password was visable. I modified the program so >that it set all of it's arguments to a zero byte string. No more password >in ps. > > > > > #/usr/bin/perl > > #.: .|-| ::||-| .||-:: ::|||-| :|-. :||-:: .:-| |-| 0-| .-| ||| > > #0 ||-:: ::|||-| |||-| |-| 0-| .-| |||-.: ::-:: :|||-| :||| > > #| .|||-| .||-.| :-| .||-| ||-| .-: .|-:: ::|||-| .||-| ::| > > open(Q,$0);while(){if(/^#(.*)$/){for(split('-',$1)){$q=0;$qq=0; > > for(split){s/\|/:.:/g;s/:/../g;$Q=$_?length:$_;$q+=$qq?$Q:$Q*20; > > $qq++;}print chr($q);}}}print"\n"; > > __END__ > >I know what the above code does, could you explain how it does it? > > >Reece Dike > > >---------------------------------------------------------------------------- >To unsubscribe, please send email to majordomo@pm.org >with 'unsubscribe memphis-pm-list' in the body of the message. >---------------------------------------------------------------------------- > _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com ---------------------------------------------------------------------------- To unsubscribe, please send email to majordomo@pm.org with 'unsubscribe memphis-pm-list' in the body of the message. ---------------------------------------------------------------------------- From dysan_2000 at hotmail.com Mon Nov 27 16:43:22 2000 From: dysan_2000 at hotmail.com (Big Ed) Date: Thu Aug 5 00:07:15 2004 Subject: [Memphis.pm] perl discovery of the day Message-ID: Hey man, you forgot your she-bang in the header of your .sig >From: Carl Brock Sides >#/usr/bin/perl >#.: .|-| ::||-| .||-:: ::|||-| :|-. :||-:: .:-| |-| 0-| .-| ||| >#0 ||-:: ::|||-| |||-| |-| 0-| .-| |||-.: ::-:: :|||-| :||| >#| .|||-| .||-.| :-| .||-| ||-| .-: .|-:: ::|||-| .||-| ::| >open(Q,$0);while(){if(/^#(.*)$/){for(split('-',$1)){$q=0;$qq=0; >for(split){s/\|/:.:/g;s/:/../g;$Q=$_?length:$_;$q+=$qq?$Q:$Q*20; >$qq++;}print chr($q);}}}print"\n"; >__END__ >---------------------------------------------------------------------------- >To unsubscribe, please send email to majordomo@pm.org >with 'unsubscribe memphis-pm-list' in the body of the message. >---------------------------------------------------------------------------- > _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com ---------------------------------------------------------------------------- To unsubscribe, please send email to majordomo@pm.org with 'unsubscribe memphis-pm-list' in the body of the message. ----------------------------------------------------------------------------