OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
doc
/
lsof
/
examples
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/21/2019 03:49:18 PM
rwxr-xr-x
📄
00MANIFEST
1.76 KB
06/14/2004 02:32:48 PM
rw-r--r--
📄
00README
2 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
big_brother.perl5.gz
2.03 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
count_pf.perl
1.81 KB
10/28/2015 04:57:17 PM
rwxr-xr-x
📄
count_pf.perl5
1.97 KB
10/28/2015 04:57:17 PM
rwxr-xr-x
📄
identd.perl5
3.23 KB
10/28/2015 04:57:17 PM
rwxr-xr-x
📄
idrlogin.perl.gz
2.17 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
idrlogin.perl5.gz
2.22 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
list_NULf.perl5.gz
1.79 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
list_fields.awk.gz
1.72 KB
09/23/1997 02:32:42 PM
rw-r--r--
📄
list_fields.perl.gz
1.71 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
shared.perl5.gz
3.49 KB
10/28/2015 04:57:17 PM
rw-r--r--
📄
sort_res.perl5
3.63 KB
10/28/2015 04:57:17 PM
rwxr-xr-x
📄
watch_a_file.perl
2.18 KB
10/28/2015 04:57:17 PM
rwxr-xr-x
📄
xusers.awk
3.88 KB
03/10/1997 08:10:01 PM
rwxr-xr-x
Editing: count_pf.perl
Close
#!/usr/bin/perl # # count_pf.perl-- run lsof in repeat mode and count processes and # files sub interrupt { print "\n"; exit 0; } $RPT = 15; # lsof repeat time # Set path to lsof. if (($LSOF = &isexec("../lsof")) eq "") { # Try .. first if (($LSOF = &isexec("lsof")) eq "") { # Then try . and $PATH print "can't execute $LSOF\n"; exit 1 } } # Read lsof -nPF output repeatedly from a pipe. $| = 1; # unbuffer output $SIG{'INT'} = 'interrupt'; # catch interrupt $proc = $files = $proto{'TCP'} = $proto{'UDP'} = 0; $progress="/"; # used to show "progress" open(P, "$LSOF -nPF -r $RPT|") || die "can't open pipe to $LSOF\n"; while (<P>) { chop; if (/^m/) { # A marker line signals the end of an lsof repetition. printf "%s Processes: %5d, Files: %6d, TCP: %6d, UDP: %6d\r", $progress, $proc, $files, $proto{'TCP'}, $proto{'UDP'}; $proc = $files = $proto{'TCP'} = $proto{'UDP'} = 0; if ($progress eq "/") { $progress = "\\"; } else { $progress = "/"; } next; } if (/^p/) { $proc++; next; } # Count processes. if (/^f/) { $files++; next; } # Count files. if (/^P(.*)/) { $proto{$1}++; next; } # Count protocols. } ## isexec($path) -- is $path executable # # $path = absolute or relative path to file to test for executabiity. # Paths that begin with neither '/' nor '.' that arent't found as # simple references are also tested with the path prefixes of the # PATH environment variable. sub isexec { my ($path) = @_; my ($i, @P, $PATH); $path =~ s/^\s+|\s+$//g; if ($path eq "") { return(""); } if (($path =~ m#^[\/\.]#)) { if (-x $path) { return($path); } return(""); } $PATH = $ENV{PATH}; @P = split(":", $PATH); for ($i = 0; $i <= $#P; $i++) { if (-x "$P[$i]/$path") { return("$P[$i]/$path"); } } return(""); }