|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
myps |
|
Posted: Sun Apr 10, 2005 4:36 am |
|
|
erg0t |
Valuable expert |
|
|
Joined: Apr 08, 2005 |
Posts: 55 |
Location: Uruguay |
|
|
|
|
|
|
#!/usr/bin/perl
# myps by erg0t http://saure.no-ip.org
#
# some admins think that changing execution privileges in programs like "ps" and intruder could not get info
# while they should changing the permisions on the procFS, this little script works as an simplificed version
# of ps, but a full implementation IS POSSIBLE!.
#
# Same principe colud be used to get other information, ej: uname, cat /proc/version cat /proc/cpuinfo, etc...
#
# mount point
$procFS = '/proc' ;
use File::Find ;
print "PID PPID State TTY GID SID CMD\n" ;
find (\&pid,$procFS) ;
sub pid
{
@pid = "$File::Find::name" ;
foreach $proc(@pid)
{
@dir = split("/",$proc) ;
if ($dir[2] =~ /[0-9]/ && $dir[3] =~ /stat$/)
{
if (open(status,"$proc"))
{
# Minimal info about the process, change it acording what you want to know
foreach $linea (<status>)
{
@estado = split(" ",$linea) ;
print "$estado[0] $estado[3] $estado[2] $estado[6] $estado[4] $estado[5] $estado[1]\n" ;
}
}
close(status) ;
}
}
} |
|
|
|
|
|
|
|
|
Posted: Sun Apr 10, 2005 12:18 pm |
|
|
y3dips |
Valuable expert |
|
|
Joined: Feb 25, 2005 |
Posts: 281 |
Location: Indonesia |
|
|
|
|
|
|
nice script
just imagine if the server has no perl installation
|
|
_________________ IO::y3dips->new(http://clog.ammar.web.id); |
|
|
|
Posted: Sun Apr 10, 2005 2:52 pm |
|
|
erg0t |
Valuable expert |
|
|
Joined: Apr 08, 2005 |
Posts: 55 |
Location: Uruguay |
|
|
|
|
|
|
In all my life I only saw one server in wich I can?t use perl, and not because it wasn?t installed, anyway a did it in perl for facility, can be made in other lang, but File::Find do lot of dirty work for one.
salu2 |
|
|
|
|
Posted: Mon Apr 11, 2005 2:04 am |
|
|
y3dips |
Valuable expert |
|
|
Joined: Feb 25, 2005 |
Posts: 281 |
Location: Indonesia |
|
|
|
|
|
|
sad for me, i still got freebsd machine with no perl install
thats oke bro, nice script you got there, anyway have some idea in using our own module ? beside some classic way ? |
|
_________________ IO::y3dips->new(http://clog.ammar.web.id); |
|
|
|
Posted: Mon Apr 11, 2005 2:23 pm |
|
|
erg0t |
Valuable expert |
|
|
Joined: Apr 08, 2005 |
Posts: 55 |
Location: Uruguay |
|
|
|
|
|
|
I used find file because is easier to work with it. But can be done manualy, and can be done in other languages too, even i think it can be done in bash |
|
|
|
|
Posted: Tue Apr 12, 2005 11:57 am |
|
|
shai-tan |
Valuable expert |
|
|
Joined: Feb 22, 2005 |
Posts: 477 |
|
|
|
|
|
|
|
Quote: | sad for me, i still got freebsd machine with no perl install
thats oke bro, nice script you got there, anyway have some idea in using our own module ? beside some classic way ? |
y3dips:
Have you got Net BSD 2.0 the new version yet? Its supposed to kick Free BSD's ass I'm not sure about it having Perl but I got the ISO in the UK Linux Format Magizine. |
|
_________________ Shai-tan
?In short: just say NO TO DRUGS, and maybe you won?t end up like the Hurd people.? -- Linus Torvalds |
|
|
|
Posted: Tue Apr 12, 2005 3:38 pm |
|
|
y3dips |
Valuable expert |
|
|
Joined: Feb 25, 2005 |
Posts: 281 |
Location: Indonesia |
|
|
|
|
|
|
shai-tan : its not my machine.. but some other "lazy admin" machine with freeBSD installed |
|
_________________ IO::y3dips->new(http://clog.ammar.web.id); |
|
|
|
Posted: Wed Apr 13, 2005 3:47 am |
|
|
shai-tan |
Valuable expert |
|
|
Joined: Feb 22, 2005 |
Posts: 477 |
|
|
|
|
|
|
|
Oh sorry the way I read it I thought you meant it was your server.
|
|
_________________ Shai-tan
?In short: just say NO TO DRUGS, and maybe you won?t end up like the Hurd people.? -- Linus Torvalds |
|
|
|
www.waraxe.us Forum Index -> Perl
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|