Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dump ps -ef ¦ grep acct on the web

Status
Not open for further replies.

ubstek

Programmer
Feb 2, 2001
9
US
Hello,

We have apache web server installed on AIX 5.1. We want to dump "ps -ef | grep userid" on a web page.

Can this be done.

Thank you very much in advance
 
you could use a simple perl script and dump it in cgi-bin. call it with
-----------------------------------------------------
use CGI qw:)standard);

$userid = param("userid");
$title = "Process listing for $userid";
@lines = `/usr/bin/ps -ef | grep $userid`;
print header, start_html($title), h1($title);
foreach(@lines) {
print p($_);
}
print end_html;
-------------------------------------------------------
 
I would not use this what if I entered that my user id was user01;cat /etc/passwd ?? Tony ... aka chgwhat

When in doubt,,, Power out...
 
after the '$userid = param("userid");' line you could add:
$userid =~ tr/A-Za-z0-9_-//cd;

or you could use:

@lines = `/usr/bin/ps -ef`;
foreach(@lines) {
if /$userid/ {
print p($_);
}
}

or an equivalent.
 
Thank you Lance73 and Jad.....You the "MAN"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top