Re: PGP: Environment protection for UNIX
I wrote:
main (int argn, char **argv, char **envv) { for ( ; *envv ; ++envv) { if (!strncmp(*envv,"PGP",3)) { char *c=*envv; while (*c) *c++=' '; } /* end of if */ } /* end of for */ system("printenv"); sleep(10); }
And I should've enclosed it in #ifdef STUPID ... #endif. I misread the putenv(3) man page and didn't realize that you could just use putenv("PGPPATH="); putenv("PGPPASS="); To wipe those variables out of your environment... They still might get caught by a 'ps -eaxuww' but chances are slim. Is it posible to alter your arguments so they're not visible to 'ps -auxww'? Well as a matter of fact, it does seems to work on my sparcstation: main (int argn, char **argv, char **envv) { system("ps -uww"); for (;*argv;++argv) { while (**argv) { *(*argv)++ = ' '; } /* end of while */ } /* end of for */ puts("--------------------------------"); system("ps -uww"); } Not elegant, but that's what makes it a GLP (grungy little program). So, is there a more elegant way to do this? How portable is it? Finally, of how much use is it? Stig /* Jonathan Stigelman, Stig@netcom.com, PGP public key on request */ /* fingerprint = 32 DF B9 19 AE 28 D1 7A A3 9D 0B 1A 33 13 4D 7F */
main (int argn, char **argv, char **envv) { for ( ; *envv ; ++envv) { if (!strncmp(*envv,"PGP",3)) { char *c=*envv; while (*c) *c++=' '; } /* end of if */ } /* end of for */ system("printenv"); sleep(10); } And I should've enclosed it in #ifdef STUPID ... #endif. I misread
I wrote: the putenv(3) man page and didn't realize that you could just use
putenv("PGPPATH="); putenv("PGPPASS=");
To wipe those variables out of your environment... They still might get caught by a 'ps -eaxuww' but chances are slim. Is it posible to alter your arguments so they're not visible to 'ps -auxww'?
Well, I like this one. It lets you put little messages in place of argv[0]. #include <stdio.h> char buff[100]; int esc = 27; void main(int argc, char *argv[]) { puts("Enter message.\n"); scanf("%s", buff); execl("/nfs/dorado/unsup/bin/ftp", buff, NULL); } +-----------------------+-----------------------------+---------+ | J. Michael Diehl ;-) | I thought I was wrong once. | PGP KEY | | mdiehl@triton.unm.edu | But, I was mistaken. |available| | mike.diehl@fido.org | | Ask Me! | | (505) 299-2282 +-----------------------------+---------+ | | +------"I'm just looking for the opportunity to be -------------+ | Politically Incorrect!" <Me> | +-----If codes are outlawed, only criminals wil have codes.-----+ +----Is Big Brother in your phone? If you don't know, ask me---+
Stig says: [More on environment wiper] The environment wiper seems silly to me. If the enclosing shell still has the environment in question, ps will still reveal it. If the enclosing shell does not have the environment variables in question, then what was the point? .pm
participants (3)
-
J. Michael Diehl
-
Perry E. Metzger
-
stig@netcom.com