Hackfut Security File Manager
Current Path:
/usr/bin
usr
/
bin
/
📁
..
📄
.ssh.hmac
(65 B)
📄
GET
(14.18 KB)
📄
Mail
(369.84 KB)
📄
[
(32.63 KB)
📄
a2p
(104.29 KB)
📄
aclocal
(30.45 KB)
📄
aclocal-1.11
(30.45 KB)
📄
addftinfo
(22.94 KB)
📄
addr2line
(24.35 KB)
📄
animate
(5.71 KB)
📄
ar
(55.3 KB)
📄
as
(320.7 KB)
📄
aspell
(160.22 KB)
📄
at
(1.01 KB)
📄
atq
(1.01 KB)
📄
atrm
(1.02 KB)
📄
autoconf
(14.29 KB)
📄
autoheader
(8.29 KB)
📄
autom4te
(31.04 KB)
📄
automake
(251.04 KB)
📄
automake-1.11
(251.04 KB)
📄
autoreconf
(19.76 KB)
📄
autoscan
(16.67 KB)
📄
autoupdate
(32.97 KB)
📄
awk
(366.81 KB)
📄
base64
(28.55 KB)
📄
bashbug-64
(6.77 KB)
📄
batch
(137 B)
📄
bdftops
(292 B)
📄
bison
(292.83 KB)
📄
bunzip2
(32.16 KB)
📄
bzcat
(32.16 KB)
📄
bzcmp
(2.08 KB)
📄
bzdiff
(2.08 KB)
📄
bzgrep
(1.64 KB)
📄
bzip2
(32.16 KB)
📄
bzip2recover
(10.62 KB)
📄
bzless
(1.23 KB)
📄
bzmore
(1.23 KB)
📄
c++
(261.65 KB)
📄
c++filt
(23.01 KB)
📄
c2ph
(35.74 KB)
📄
c89
(224 B)
📄
c99
(215 B)
📄
cal
(16.39 KB)
📄
captoinfo
(48.66 KB)
📄
catchsegv
(3.3 KB)
📄
cc
(258.27 KB)
📄
chcon
(55.8 KB)
📄
chrt
(9.4 KB)
📄
cksum
(24.68 KB)
📄
cldetect
(10.43 KB)
📄
clear
(4.86 KB)
📄
cloudlinux-awp-user
(890 B)
📄
clwpos-user
(890 B)
📄
cmp
(18.8 KB)
📄
col
(10.65 KB)
📄
colcrt
(7.73 KB)
📄
colrm
(5.45 KB)
📄
column
(9.52 KB)
📄
comm
(27.79 KB)
📄
compare
(5.83 KB)
📄
composite
(5.71 KB)
📄
conjure
(5.71 KB)
📄
convert
(5.71 KB)
📄
cpan
(8.06 KB)
📄
cpp
(261.63 KB)
📄
crontab
(1.15 KB)
📄
crontab.cagefs
(300.83 KB)
📄
csplit
(103.68 KB)
📄
curl
(117.41 KB)
📄
cut
(40.73 KB)
📄
dbiprof
(6.15 KB)
📄
dbiproxy
(5.35 KB)
📄
ddate
(11.18 KB)
📄
diff
(79.18 KB)
📄
diff3
(22.93 KB)
📄
dig
(130.52 KB)
📄
dir
(106.65 KB)
📄
dircolors
(32.1 KB)
📄
dirname
(23.16 KB)
📄
display
(5.71 KB)
📄
dltest
(7.06 KB)
📄
dprofpp
(23.52 KB)
📄
du
(93.21 KB)
📄
dumphint
(554 B)
📄
dvipdf
(1.03 KB)
📄
enc2xs
(38.23 KB)
📄
enchant
(12.83 KB)
📄
enchant-lsmod
(7.16 KB)
📄
env
(23.27 KB)
📄
eps2eps
(632 B)
📄
eqn
(134.11 KB)
📄
eqn2graph
(2.19 KB)
📄
expand
(27.3 KB)
📄
expr
(95.4 KB)
📄
factor
(43.65 KB)
📄
fc-cache
(12.7 KB)
📄
fc-cat
(10.88 KB)
📄
fc-list
(8.63 KB)
📄
fc-match
(9.76 KB)
📄
fc-query
(7.39 KB)
📄
fc-scan
(7.69 KB)
📄
file
(15.31 KB)
📄
find
(229.02 KB)
📄
find2perl
(23.06 KB)
📄
flex
(324.66 KB)
📄
flex++
(324.66 KB)
📄
flock
(10.67 KB)
📄
floppy
(23.06 KB)
📄
fmt
(29.55 KB)
📄
fold
(27.37 KB)
📄
font2c
(300 B)
📄
free
(9.47 KB)
📄
freetype-config
(3.74 KB)
📄
funzip
(21.54 KB)
📄
g++
(261.65 KB)
📄
gawk
(366.81 KB)
📄
gcc
(258.27 KB)
📄
gcov
(38.91 KB)
📄
gencat
(22.51 KB)
📄
geoiplookup
(14.71 KB)
📄
geoiplookup6
(10.65 KB)
📄
geqn
(134.11 KB)
📄
getconf
(22.28 KB)
📄
getent
(27.13 KB)
📄
getopt
(11.76 KB)
📄
ghostscript
(6.6 KB)
📄
gindxbib
(27.17 KB)
📄
git
(1.09 MB)
📄
git-receive-pack
(1.09 MB)
📄
git-shell
(446.8 KB)
📄
git-upload-archive
(1.09 MB)
📄
git-upload-pack
(456.86 KB)
📄
glookbib
(32.54 KB)
📄
gm
(4.74 KB)
📄
gmake
(166.58 KB)
📄
gneqn
(255 B)
📄
gnroff
(2.34 KB)
📄
gpg
(743.84 KB)
📄
gpg-agent
(290.99 KB)
📄
gpg-error
(18.14 KB)
📄
gpg-zip
(3.23 KB)
📄
gpg2
(743.84 KB)
📄
gpgsplit
(47.4 KB)
📄
gpgv
(328.59 KB)
📄
gpgv2
(328.59 KB)
📄
gpic
(208.61 KB)
📄
gprof
(92.73 KB)
📄
grefer
(119.36 KB)
📄
grn
(63.88 KB)
📄
grodvi
(79.49 KB)
📄
groff
(63.89 KB)
📄
groffer
(7.59 KB)
📄
grolbp
(85.9 KB)
📄
grolj4
(75.65 KB)
📄
grops
(114.27 KB)
📄
grotty
(75.49 KB)
📄
groups
(23.84 KB)
📄
gs
(6.6 KB)
📄
gsbj
(337 B)
📄
gsdj
(339 B)
📄
gsdj500
(342 B)
📄
gslj
(340 B)
📄
gslp
(337 B)
📄
gsnd
(264 B)
📄
gsoelim
(22.96 KB)
📄
gtbl
(95.88 KB)
📄
gtroff
(346.55 KB)
📄
gunzip
(61 B)
📄
gzexe
(5.73 KB)
📄
gzip
(63.17 KB)
📄
h2ph
(27.38 KB)
📄
h2xs
(58.97 KB)
📄
head
(31.76 KB)
📄
hexdump
(21.07 KB)
📄
host
(117.12 KB)
📄
hostid
(21.54 KB)
📄
hpftodit
(19.91 KB)
📄
hunspell
(51.55 KB)
📄
iconv
(58.86 KB)
📄
id
(27.45 KB)
📄
identify
(5.83 KB)
📄
idn
(31.73 KB)
📄
ifnames
(3.95 KB)
📄
import
(5.71 KB)
📄
indxbib
(27.17 KB)
📄
infocmp
(49.77 KB)
📄
infotocap
(48.66 KB)
📄
install
(104.69 KB)
📄
instmodsh
(4.1 KB)
📄
ionice
(14.76 KB)
📄
ipcrm
(8.85 KB)
📄
ipcs
(19.26 KB)
📄
isosize
(7.15 KB)
📄
ispell
(988 B)
📄
isql
(26.97 KB)
📄
iusql
(21.07 KB)
📄
join
(39.41 KB)
📄
kill
(11.3 KB)
📄
ld
(574.42 KB)
📄
ldd
(5.2 KB)
📄
less
(146.43 KB)
📄
lessecho
(7.2 KB)
📄
lesskey
(15.88 KB)
📄
lesspipe.sh
(2.74 KB)
📄
lex
(324.66 KB)
📄
libnetcfg
(15.36 KB)
📄
libtool
(276.69 KB)
📄
libtoolize
(66.56 KB)
📄
lkbib
(32.76 KB)
📄
locale
(37.73 KB)
📄
localedef
(319.22 KB)
📄
logger
(11.34 KB)
📄
logname
(21.63 KB)
📄
look
(7.89 KB)
📄
lookbib
(32.54 KB)
📄
lprsetup.sh
(4.55 KB)
📄
lynx
(1.33 MB)
📄
m4
(203.63 KB)
📄
make
(166.58 KB)
📄
mcookie
(10.77 KB)
📄
md5sum
(31.71 KB)
📄
mesg
(6.59 KB)
📄
mkfifo
(24.68 KB)
📄
mogrify
(5.71 KB)
📄
montage
(5.71 KB)
📄
msql2mysql
(1.91 KB)
📄
my_print_defaults
(3.12 MB)
📄
mysql
(3.67 MB)
📄
mysql_config
(6.85 KB)
📄
mysql_find_rows
(3.7 KB)
📄
mysql_waitpid
(3.12 MB)
📄
mysqlaccess
(109.89 KB)
📄
mysqladmin
(3.37 MB)
📄
mysqlbinlog
(3.56 MB)
📄
mysqlcheck
(3.36 MB)
📄
mysqldump
(3.44 MB)
📄
mysqlimport
(3.36 MB)
📄
mysqlshow
(3.36 MB)
📄
namei
(12.41 KB)
📄
nano
(167.76 KB)
📄
neqn
(255 B)
📄
nl
(95.82 KB)
📄
nm
(40.16 KB)
📄
nohup
(25.57 KB)
📄
nproc
(23.7 KB)
📄
nroff
(2.34 KB)
📄
nslookup
(117.3 KB)
📄
nsupdate
(58.13 KB)
📄
objcopy
(207.13 KB)
📄
objdump
(274.1 KB)
📄
od
(56.79 KB)
📄
odbc_config
(6.65 KB)
📄
odbcinst
(22.78 KB)
📄
openssl
(513.28 KB)
📄
pango-querymodules-64
(9.94 KB)
📄
pango-view
(48.52 KB)
📄
passwd
(1.02 KB)
📄
paste
(24.95 KB)
📄
patch
(115.34 KB)
📄
pathchk
(23.2 KB)
📄
pdf2dsc
(696 B)
📄
pdf2ps
(901 B)
📄
pdfopt
(547 B)
📄
perl
(7.01 KB)
📄
perl5.10.1
(7.01 KB)
📄
perlbug
(43.68 KB)
📄
perldoc
(224 B)
📄
perlivp
(12.01 KB)
📄
perlml
(4.38 KB)
📄
perlthanks
(43.68 KB)
📄
pf2afm
(495 B)
📄
pfbtopfa
(511 B)
📄
pfbtops
(6.62 KB)
📄
pgrep
(15.77 KB)
📄
php
(937 B)
📄
pic
(208.61 KB)
📄
pic2graph
(2.5 KB)
📄
piconv
(7.17 KB)
📄
pinentry
(2.54 KB)
📄
pinentry-curses
(47.46 KB)
📄
pinky
(28.91 KB)
📄
pkg-config
(103.41 KB)
📄
pkill
(15.77 KB)
📄
pl2pm
(4.42 KB)
📄
pmap
(11.85 KB)
📄
pod2html
(2.28 KB)
📄
pod2latex
(10.01 KB)
📄
pod2man
(20.68 KB)
📄
pod2text
(8.87 KB)
📄
pod2usage
(3.26 KB)
📄
podchecker
(3.61 KB)
📄
podselect
(2.47 KB)
📄
post-grohtml
(128.52 KB)
📄
pr
(60.32 KB)
📄
pre-grohtml
(68.98 KB)
📄
precat
(5.52 KB)
📄
preunzip
(5.52 KB)
📄
prezip
(5.52 KB)
📄
prezip-bin
(6.98 KB)
📄
printafm
(386 B)
📄
printenv
(23.18 KB)
📄
printf
(45.26 KB)
📄
protoize
(67.05 KB)
📄
prove
(13.24 KB)
📄
ps2ascii
(786 B)
📄
ps2epsi
(2.71 KB)
📄
ps2pdf
(315 B)
📄
ps2pdf12
(260 B)
📄
ps2pdf13
(260 B)
📄
ps2pdf14
(260 B)
📄
ps2pdfwr
(1.06 KB)
📄
ps2ps
(634 B)
📄
ps2ps2
(704 B)
📄
psed
(52.08 KB)
📄
pstruct
(35.74 KB)
📄
ptx
(124.09 KB)
📄
pv.sh
(1.39 KB)
📄
pwdx
(6.59 KB)
📄
pydoc
(78 B)
📄
python
(4.75 KB)
📄
python2
(4.75 KB)
📄
python2.6
(4.75 KB)
📄
ranlib
(55.3 KB)
📄
readelf
(292.14 KB)
📄
readlink
(35.51 KB)
📄
recode
(39.23 KB)
📄
refer
(119.36 KB)
📄
rename
(6.59 KB)
📄
renice
(7.15 KB)
📄
reset
(17.48 KB)
📄
rev
(6.63 KB)
📄
rnano
(167.76 KB)
📄
rpcgen
(90.82 KB)
📄
run-with-aspell
(85 B)
📄
runcon
(27.45 KB)
📄
rvim
(2.18 MB)
📄
s2p
(52.08 KB)
📄
scl
(17.88 KB)
📄
scl_enabled
(258 B)
📄
scl_source
(1.83 KB)
📄
scp
(66.06 KB)
📄
screen
(374.12 KB)
📄
script
(12.33 KB)
📄
sdiff
(23.02 KB)
📄
selectorctl
(7.78 KB)
📄
seq
(39.34 KB)
📄
setsid
(5.41 KB)
📄
setterm
(20.3 KB)
📄
sftp
(102.07 KB)
📄
sha1sum
(35.43 KB)
📄
sha224sum
(41.15 KB)
📄
sha256sum
(41.15 KB)
📄
sha384sum
(47.43 KB)
📄
sha512sum
(47.43 KB)
📄
shred
(47.75 KB)
📄
shuf
(35.55 KB)
📄
size
(27.38 KB)
📄
skill
(14.75 KB)
📄
slabtop
(12.59 KB)
📄
slogin
(440.16 KB)
📄
snice
(14.75 KB)
📄
soelim
(22.96 KB)
📄
spell
(122 B)
📄
splain
(17.04 KB)
📄
split
(51.59 KB)
📄
sprof
(22.56 KB)
📄
sqlite3
(51.45 KB)
📄
ssh
(440.16 KB)
📄
ssh-add
(155.2 KB)
📄
ssh-agent
(138.07 KB)
📄
ssh-copy-id
(1.39 KB)
📄
ssh-keygen
(195.2 KB)
📄
ssh-keyscan
(247.8 KB)
📄
stat
(45.07 KB)
📄
stdbuf
(59.49 KB)
📄
strace
(423.4 KB)
📄
stream
(5.71 KB)
📄
strings
(27.38 KB)
📄
strip
(207.13 KB)
📄
sum
(31.34 KB)
📄
tabs
(10.93 KB)
📄
tac
(91.52 KB)
📄
tail
(56.34 KB)
📄
tailf
(8.32 KB)
📄
tbl
(95.88 KB)
📄
tclsh
(5.1 KB)
📄
tclsh8.5
(5.1 KB)
📄
tee
(23.62 KB)
📄
test
(29.54 KB)
📄
tfmtodit
(23.01 KB)
📄
tic
(48.66 KB)
📄
time
(13.8 KB)
📄
timeout
(45.63 KB)
📄
tload
(7.64 KB)
📄
tmpwatch
(17.38 KB)
📄
toe
(11.13 KB)
📄
top
(60.98 KB)
📄
tput
(11.23 KB)
📄
tr
(36.73 KB)
📄
troff
(346.55 KB)
📄
truncate
(47.48 KB)
📄
tset
(17.48 KB)
📄
tsort
(31.23 KB)
📄
tty
(21.41 KB)
📄
tzselect
(6.96 KB)
📄
uapi
(1.02 KB)
📄
ul
(13.1 KB)
📄
unexpand
(27.4 KB)
📄
uniq
(35.62 KB)
📄
unix-lpr.sh
(4.11 KB)
📄
unprotoize
(56.16 KB)
📄
unzip
(163.23 KB)
📄
unzipsfx
(75.16 KB)
📄
uptime
(4.73 KB)
📄
users
(23.54 KB)
📄
utmpdump
(10.68 KB)
📄
vdir
(106.65 KB)
📄
vim
(2.18 MB)
📄
vimdiff
(2.18 MB)
📄
vimtutor
(2.04 KB)
📄
vmstat
(19.84 KB)
📄
watch
(12.28 KB)
📄
wc
(31.85 KB)
📄
wftopfa
(284 B)
📄
wget
(349.02 KB)
📄
whereis
(11.19 KB)
📄
which
(20.28 KB)
📄
who
(43.96 KB)
📄
whoami
(23.18 KB)
📄
word-list-compress
(6.56 KB)
📄
x86_64-redhat-linux-c++
(261.65 KB)
📄
x86_64-redhat-linux-g++
(261.65 KB)
📄
x86_64-redhat-linux-gcc
(258.27 KB)
📄
xargs
(42.99 KB)
📄
xmlcatalog
(14.8 KB)
📄
xmllint
(57.38 KB)
📄
xmlwf
(21.89 KB)
📄
xsltproc
(22.98 KB)
📄
xsubpp
(4.96 KB)
📄
xxd
(14.8 KB)
📄
yes
(21.6 KB)
📄
zcmp
(67 B)
📄
zdiff
(4.34 KB)
📄
zegrep
(62 B)
📄
zfgrep
(62 B)
📄
zforce
(1.98 KB)
📄
zgrep
(4.86 KB)
📄
zip
(207.08 KB)
📄
zipcloak
(104.59 KB)
📄
zipgrep
(2.88 KB)
📄
zipinfo
(163.23 KB)
📄
zipnote
(96.27 KB)
📄
zipsplit
(100.27 KB)
📄
zless
(1.69 KB)
📄
zmore
(2.54 KB)
📄
znew
(5.12 KB)
📄
zsoelim
(22.96 KB)
Editing: find2perl
#!/usr/bin/perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; (my $perlpath = <<'/../') =~ s/\s*\z//; /usr/bin/perl /../ use strict; use vars qw/$statdone/; use File::Spec::Functions 'curdir'; my $startperl = "#! $perlpath -w"; sub tab (); sub n ($$); sub fileglob_to_re ($); sub quote ($); my @roots = (); while ($ARGV[0] =~ /^[^-!(]/) { push(@roots, shift); } @roots = (curdir()) unless @roots; for (@roots) { $_ = quote($_) } my $roots = join(', ', @roots); my $find = "find"; my $indent_depth = 1; my $stat = 'lstat'; my $decl = ''; my $flushall = ''; my $initfile = ''; my $initnewer = ''; my $out = ''; my $declaresubs = "sub wanted;\n"; my %init = (); my ($follow_in_effect,$Skip_And) = (0,0); my $print_needed = 1; while (@ARGV) { $_ = shift; s/^-// || /^[()!]/ || die "Unrecognized switch: $_\n"; if ($_ eq '(') { $out .= tab . "(\n"; $indent_depth++; next; } elsif ($_ eq ')') { --$indent_depth; $out .= tab . ")"; } elsif ($_ eq 'follow') { $follow_in_effect= 1; $stat = 'stat'; $Skip_And= 1; } elsif ($_ eq '!') { $out .= tab . "!"; next; } elsif (/^(i)?name$/) { $out .= tab . '/' . fileglob_to_re(shift) . "/s$1"; } elsif (/^(i)?path$/) { $out .= tab . '$File::Find::name =~ /' . fileglob_to_re(shift) . "/s$1"; } elsif ($_ eq 'perm') { my $onum = shift; $onum =~ /^-?[0-7]+$/ || die "Malformed -perm argument: $onum\n"; $out .= tab; if ($onum =~ s/^-//) { $onum = sprintf("0%o", oct($onum) & 07777); $out .= "((\$mode & $onum) == $onum)"; } else { $onum =~ s/^0*/0/; $out .= "((\$mode & 0777) == $onum)"; } } elsif ($_ eq 'type') { (my $filetest = shift) =~ tr/s/S/; $out .= tab . "-$filetest _"; } elsif ($_ eq 'print') { $out .= tab . 'print("$name\n")'; $print_needed = 0; } elsif ($_ eq 'print0') { $out .= tab . 'print("$name\0")'; $print_needed = 0; } elsif ($_ eq 'fstype') { my $type = shift; $out .= tab; if ($type eq 'nfs') { $out .= '($dev < 0)'; } else { $out .= '($dev >= 0)'; #XXX } } elsif ($_ eq 'user') { my $uname = shift; $out .= tab . "(\$uid == \$uid{'$uname'})"; $init{user} = 1; } elsif ($_ eq 'group') { my $gname = shift; $out .= tab . "(\$gid == \$gid{'$gname'})"; $init{group} = 1; } elsif ($_ eq 'nouser') { $out .= tab . '!exists $uid{$uid}'; $init{user} = 1; } elsif ($_ eq 'nogroup') { $out .= tab . '!exists $gid{$gid}'; $init{group} = 1; } elsif ($_ eq 'links') { $out .= tab . n('$nlink', shift); } elsif ($_ eq 'inum') { $out .= tab . n('$ino', shift); } elsif ($_ eq 'size') { $_ = shift; my $n = 'int(((-s _) + 511) / 512)'; if (s/c\z//) { $n = 'int(-s _)'; } elsif (s/k\z//) { $n = 'int(((-s _) + 1023) / 1024)'; } $out .= tab . n($n, $_); } elsif ($_ eq 'atime') { $out .= tab . n('int(-A _)', shift); } elsif ($_ eq 'mtime') { $out .= tab . n('int(-M _)', shift); } elsif ($_ eq 'ctime') { $out .= tab . n('int(-C _)', shift); } elsif ($_ eq 'exec') { my @cmd = (); while (@ARGV && $ARGV[0] ne ';') { push(@cmd, shift) } shift; $out .= tab; if ($cmd[0] =~m#^(?:(?:/usr)?/bin/)?rm$# && $cmd[$#cmd] eq '{}' && (@cmd == 2 || (@cmd == 3 && $cmd[1] eq '-f'))) { if (@cmd == 2) { $out .= '(unlink($_) || warn "$name: $!\n")'; } elsif (!@ARGV) { $out .= 'unlink($_)'; } else { $out .= '(unlink($_) || 1)'; } } else { for (@cmd) { s/'/\\'/g } { local $" = "','"; $out .= "doexec(0, '@cmd')"; } $declaresubs .= "sub doexec (\$\@);\n"; $init{doexec} = 1; } $print_needed = 0; } elsif ($_ eq 'ok') { my @cmd = (); while (@ARGV && $ARGV[0] ne ';') { push(@cmd, shift) } shift; $out .= tab; for (@cmd) { s/'/\\'/g } { local $" = "','"; $out .= "doexec(1, '@cmd')"; } $declaresubs .= "sub doexec (\$\@);\n"; $init{doexec} = 1; $print_needed = 0; } elsif ($_ eq 'prune') { $out .= tab . '($File::Find::prune = 1)'; } elsif ($_ eq 'xdev') { $out .= tab . '!($File::Find::prune |= ($dev != $File::Find::topdev))' ; } elsif ($_ eq 'newer') { my $file = shift; my $newername = 'AGE_OF' . $file; $newername =~ s/\W/_/g; $newername = '$' . $newername; $out .= tab . "(-M _ < $newername)"; $initnewer .= "my $newername = -M " . quote($file) . ";\n"; } elsif ($_ eq 'eval') { my $prog = shift; $prog =~ s/'/\\'/g; $out .= tab . "eval {$prog}"; $print_needed = 0; } elsif ($_ eq 'depth') { $find = 'finddepth'; next; } elsif ($_ eq 'ls') { $out .= tab . "ls"; $declaresubs .= "sub ls ();\n"; $init{ls} = 1; $print_needed = 0; } elsif ($_ eq 'tar') { die "-tar must have a filename argument\n" unless @ARGV; my $file = shift; my $fh = 'FH' . $file; $fh =~ s/\W/_/g; $out .= tab . "tar(*$fh, \$name)"; $flushall .= "tflushall;\n"; $declaresubs .= "sub tar;\nsub tflushall ();\n"; $initfile .= "open($fh, " . quote('> ' . $file) . qq{) || die "Can't open $fh: \$!\\n";\n}; $init{tar} = 1; } elsif (/^(n?)cpio\z/) { die "-$_ must have a filename argument\n" unless @ARGV; my $file = shift; my $fh = 'FH' . $file; $fh =~ s/\W/_/g; $out .= tab . "cpio(*$fh, \$name, '$1')"; $find = 'finddepth'; $flushall .= "cflushall;\n"; $declaresubs .= "sub cpio;\nsub cflushall ();\n"; $initfile .= "open($fh, " . quote('> ' . $file) . qq{) || die "Can't open $fh: \$!\\n";\n}; $init{cpio} = 1; } else { die "Unrecognized switch: -$_\n"; } if (@ARGV) { if ($ARGV[0] eq '-o') { { local($statdone) = 1; $out .= "\n" . tab . "||\n"; } $statdone = 0 if $indent_depth == 1 && exists $init{delayedstat}; $init{saw_or} = 1; shift; } else { $out .= " &&" unless $Skip_And || $ARGV[0] eq ')'; $out .= "\n"; shift if $ARGV[0] eq '-a'; } } } if ($print_needed) { my $t = tab; if ($t !~ /&&\s*$/) { $t .= '&& ' } $out .= "\n" . $t . 'print("$name\n")'; } print <<"END"; $startperl eval 'exec $perlpath -S \$0 \${1+"\$@"}' if 0; #\$running_under_some_shell use strict; use File::Find (); # Set the variable \$File::Find::dont_use_nlink if you're using AFS, # since AFS cheats. # for the convenience of &wanted calls, including -eval statements: use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; $declaresubs END if (exists $init{doexec}) { print <<'END'; use Cwd (); my $cwd = Cwd::cwd(); END } if (exists $init{ls}) { print <<'END'; my @rwx = qw(--- --x -w- -wx r-- r-x rw- rwx); my @moname = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); END } if (exists $init{user} || exists $init{ls} || exists $init{tar}) { print "my (%uid, %user);\n"; print "while (my (\$name, \$pw, \$uid) = getpwent) {\n"; print ' $uid{$name} = $uid{$uid} = $uid;', "\n" if exists $init{user}; print ' $user{$uid} = $name unless exists $user{$uid};', "\n" if exists $init{ls} || exists $init{tar}; print "}\n\n"; } if (exists $init{group} || exists $init{ls} || exists $init{tar}) { print "my (%gid, %group);\n"; print "while (my (\$name, \$pw, \$gid) = getgrent) {\n"; print ' $gid{$name} = $gid{$gid} = $gid;', "\n" if exists $init{group}; print ' $group{$gid} = $name unless exists $group{$gid};', "\n" if exists $init{ls} || exists $init{tar}; print "}\n\n"; } print $initnewer, "\n" if $initnewer ne ''; print $initfile, "\n" if $initfile ne ''; $flushall .= "exit;\n"; if (exists $init{declarestat}) { $out = <<'END' . $out; my ($dev,$ino,$mode,$nlink,$uid,$gid); END } if ( $follow_in_effect ) { $out =~ s/lstat\(\$_\)/lstat(_)/; print <<"END"; $decl # Traverse desired filesystems File::Find::$find( {wanted => \\&wanted, follow => 1}, $roots); $flushall sub wanted { $out; } END } else { print <<"END"; $decl # Traverse desired filesystems File::Find::$find({wanted => \\&wanted}, $roots); $flushall sub wanted { $out; } END } if (exists $init{doexec}) { print <<'END'; sub doexec ($@) { my $ok = shift; my @command = @_; # copy so we don't try to s/// aliases to constants for my $word (@command) { $word =~ s#{}#$name#g } if ($ok) { my $old = select(STDOUT); $| = 1; print "@command"; select($old); return 0 unless <STDIN> =~ /^y/; } chdir $cwd; #sigh system @command; chdir $File::Find::dir; return !$?; } END } if (exists $init{ls}) { print <<'INTRO', <<"SUB", <<'END'; sub sizemm { my $rdev = shift; sprintf("%3d, %3d", ($rdev >> 8) & 0xff, $rdev & 0xff); } sub ls () { my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, INTRO \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_); SUB my $pname = $name; $blocks or $blocks = int(($size + 1023) / 1024); my $perms = $rwx[$mode & 7]; $mode >>= 3; $perms = $rwx[$mode & 7] . $perms; $mode >>= 3; $perms = $rwx[$mode & 7] . $perms; substr($perms, 2, 1) =~ tr/-x/Ss/ if -u _; substr($perms, 5, 1) =~ tr/-x/Ss/ if -g _; substr($perms, 8, 1) =~ tr/-x/Tt/ if -k _; if (-f _) { $perms = '-' . $perms; } elsif (-d _) { $perms = 'd' . $perms; } elsif (-l _) { $perms = 'l' . $perms; $pname .= ' -> ' . readlink($_); } elsif (-c _) { $perms = 'c' . $perms; $size = sizemm($rdev); } elsif (-b _) { $perms = 'b' . $perms; $size = sizemm($rdev); } elsif (-p _) { $perms = 'p' . $perms; } elsif (-S _) { $perms = 's' . $perms; } else { $perms = '?' . $perms; } my $user = $user{$uid} || $uid; my $group = $group{$gid} || $gid; my ($sec,$min,$hour,$mday,$mon,$timeyear) = localtime($mtime); if (-M _ > 365.25 / 2) { $timeyear += 1900; } else { $timeyear = sprintf("%02d:%02d", $hour, $min); } printf "%5lu %4ld %-10s %3d %-8s %-8s %8s %s %2d %5s %s\n", $ino, $blocks, $perms, $nlink, $user, $group, $size, $moname[$mon], $mday, $timeyear, $pname; 1; } END } if (exists $init{cpio} || exists $init{tar}) { print <<'END'; my %blocks = (); sub flush { my ($fh, $varref, $blksz) = @_; while (length($$varref) >= $blksz) { no strict qw/refs/; syswrite($fh, $$varref, $blksz); substr($$varref, 0, $blksz) = ''; ++$blocks{$fh}; } } END } if (exists $init{cpio}) { print <<'INTRO', <<"SUB", <<'END'; my %cpout = (); my %nc = (); sub cpio { my ($fh, $fname, $nc) = @_; my $text = ''; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks); local (*IN); if ( ! defined $fname ) { $fname = 'TRAILER!!!'; ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = (0) x 13; } else { ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, INTRO \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_); SUB if (-f _) { open(IN, "./$_\0") || do { warn "Couldn't open $fname: $!\n"; return; } } else { $text = readlink($_); $size = 0 unless defined $text; } } $fname =~ s#^\./##; $nc{$fh} = $nc; if ($nc eq 'n') { $cpout{$fh} .= sprintf("%06o%06o%06o%06o%06o%06o%06o%06o%011lo%06o%011lo%s\0", 070707, $dev & 0777777, $ino & 0777777, $mode & 0777777, $uid & 0777777, $gid & 0777777, $nlink & 0777777, $rdev & 0177777, $mtime, length($fname)+1, $size, $fname); } else { $cpout{$fh} .= "\0" if length($cpout{$fh}) & 1; $cpout{$fh} .= pack("SSSSSSSSLSLa*", 070707, $dev, $ino, $mode, $uid, $gid, $nlink, $rdev, $mtime, length($fname)+1, $size, $fname . (length($fname) & 1 ? "\0" : "\0\0")); } if ($text ne '') { $cpout{$fh} .= $text; } elsif ($size) { my $l; flush($fh, \$cpout{$fh}, 5120) while ($l = length($cpout{$fh})) >= 5120; while (sysread(IN, $cpout{$fh}, 5120 - $l, $l)) { flush($fh, \$cpout{$fh}, 5120); $l = length($cpout{$fh}); } close IN; } } sub cflushall () { for my $fh (keys %cpout) { cpio($fh, undef, $nc{$fh}); $cpout{$fh} .= "0" x (5120 - length($cpout{$fh})); flush($fh, \$cpout{$fh}, 5120); print $blocks{$fh} * 10, " blocks\n"; } } END } if (exists $init{tar}) { print <<'INTRO', <<"SUB", <<'END'; my %tarout = (); my %linkseen = (); sub tar { my ($fh, $fname) = @_; my $prefix = ''; my $typeflag = '0'; my $linkname; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, INTRO \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_); SUB local (*IN); if ($nlink > 1) { if ($linkname = $linkseen{$fh, $dev, $ino}) { if (length($linkname) > 100) { warn "$0: omitting file with linkname ", "too long for tar output: $linkname\n"; return; } $typeflag = '1'; $size = 0; } else { $linkseen{$fh, $dev, $ino} = $fname; } } if ($typeflag eq '0') { if (-f _) { open(IN, "./$_\0") || do { warn "Couldn't open $fname: $!\n"; return; } } else { $linkname = readlink($_); if (defined $linkname) { $typeflag = '2' } elsif (-c _) { $typeflag = '3' } elsif (-b _) { $typeflag = '4' } elsif (-d _) { $typeflag = '5' } elsif (-p _) { $typeflag = '6' } } } if (length($fname) > 100) { ($prefix, $fname) = ($fname =~ m#\A(.*?)/(.{,100})\Z(?!\n)#); if (!defined($fname) || length($prefix) > 155) { warn "$0: omitting file with name too long for tar output: ", $fname, "\n"; return; } } $size = 0 if $typeflag ne '0'; my $header = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155", $fname, sprintf("%7o ", $mode & 0777), sprintf("%7o ", $uid & 0777777), sprintf("%7o ", $gid & 0777777), sprintf("%11o ", $size), sprintf("%11o ", $mtime), ' 'x8, $typeflag, defined $linkname ? $linkname : '', "ustar\0", "00", $user{$uid}, $group{$gid}, ($rdev >> 8) & 0xff, $rdev & 0xff, $prefix, ); substr($header, 148, 8) = sprintf("%7o ", unpack("%16C*", $header)); my $l = length($header) % 512; $tarout{$fh} .= $header; $tarout{$fh} .= "\0" x (512 - $l) if $l; if ($size) { flush($fh, \$tarout{$fh}, 10240) while ($l = length($tarout{$fh})) >= 10240; while (sysread(IN, $tarout{$fh}, 10240 - $l, $l)) { my $slop = length($tarout{$fh}) % 512; $tarout{$fh} .= "\0" x (512 - $slop) if $slop; flush($fh, \$tarout{$fh}, 10240); $l = length($tarout{$fh}); } close IN; } } sub tflushall () { my $len; for my $fh (keys %tarout) { $len = 10240 - length($tarout{$fh}); $len += 10240 if $len < 1024; $tarout{$fh} .= "\0" x $len; flush($fh, \$tarout{$fh}, 10240); } } END } exit; ############################################################################ sub tab () { my $tabstring; $tabstring = "\t" x ($indent_depth/2) . ' ' x ($indent_depth%2 * 4); if (!$statdone) { if ($_ =~ /^(?:name|print|prune|exec|ok|\(|\))/) { $init{delayedstat} = 1; } else { my $statcall = '(($dev,$ino,$mode,$nlink,$uid,$gid) = ' . $stat . '($_))'; if (exists $init{saw_or}) { $tabstring .= "(\$nlink || $statcall) &&\n" . $tabstring; } else { $tabstring .= "$statcall &&\n" . $tabstring; } $statdone = 1; $init{declarestat} = 1; } } $tabstring =~ s/^\s+/ / if $out =~ /!$/; $tabstring; } sub fileglob_to_re ($) { my $x = shift; $x =~ s#([./^\$()+])#\\$1#g; $x =~ s#\*#.*#g; $x =~ s#\?#.#g; "^$x\\z"; } sub n ($$) { my ($pre, $n) = @_; $n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /; $n =~ s/ 0*(\d)/ $1/; "($pre $n)"; } sub quote ($) { my $string = shift; $string =~ s/\\/\\\\/g; $string =~ s/'/\\'/g; "'$string'"; } __END__ =head1 NAME find2perl - translate find command lines to Perl code =head1 SYNOPSIS find2perl [paths] [predicates] | perl =head1 DESCRIPTION find2perl is a little translator to convert find command lines to equivalent Perl code. The resulting code is typically faster than running find itself. "paths" are a set of paths where find2perl will start its searches and "predicates" are taken from the following list. =over 4 =item C<! PREDICATE> Negate the sense of the following predicate. The C<!> must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using C<find(1)>). =item C<( PREDICATES )> Group the given PREDICATES. The parentheses must be passed as distinct arguments, so they may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using C<find(1)>). =item C<PREDICATE1 PREDICATE2> True if _both_ PREDICATE1 and PREDICATE2 are true; PREDICATE2 is not evaluated if PREDICATE1 is false. =item C<PREDICATE1 -o PREDICATE2> True if either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2 is not evaluated if PREDICATE1 is true. =item C<-follow> Follow (dereference) symlinks. The checking of file attributes depends on the position of the C<-follow> option. If it precedes the file check option, an C<stat> is done which means the file check applies to the file the symbolic link is pointing to. If C<-follow> option follows the file check option, this now applies to the symbolic link itself, i.e. an C<lstat> is done. =item C<-depth> Change directory traversal algorithm from breadth-first to depth-first. =item C<-prune> Do not descend into the directory currently matched. =item C<-xdev> Do not traverse mount points (prunes search at mount-point directories). =item C<-name GLOB> File name matches specified GLOB wildcard pattern. GLOB may need to be quoted to avoid interpretation by the shell (just as with using C<find(1)>). =item C<-iname GLOB> Like C<-name>, but the match is case insensitive. =item C<-path GLOB> Path name matches specified GLOB wildcard pattern. =item C<-ipath GLOB> Like C<-path>, but the match is case insensitive. =item C<-perm PERM> Low-order 9 bits of permission match octal value PERM. =item C<-perm -PERM> The bits specified in PERM are all set in file's permissions. =item C<-type X> The file's type matches perl's C<-X> operator. =item C<-fstype TYPE> Filesystem of current path is of type TYPE (only NFS/non-NFS distinction is implemented). =item C<-user USER> True if USER is owner of file. =item C<-group GROUP> True if file's group is GROUP. =item C<-nouser> True if file's owner is not in password database. =item C<-nogroup> True if file's group is not in group database. =item C<-inum INUM> True file's inode number is INUM. =item C<-links N> True if (hard) link count of file matches N (see below). =item C<-size N> True if file's size matches N (see below) N is normally counted in 512-byte blocks, but a suffix of "c" specifies that size should be counted in characters (bytes) and a suffix of "k" specifies that size should be counted in 1024-byte blocks. =item C<-atime N> True if last-access time of file matches N (measured in days) (see below). =item C<-ctime N> True if last-changed time of file's inode matches N (measured in days, see below). =item C<-mtime N> True if last-modified time of file matches N (measured in days, see below). =item C<-newer FILE> True if last-modified time of file matches N. =item C<-print> Print out path of file (always true). If none of C<-exec>, C<-ls>, C<-print0>, or C<-ok> is specified, then C<-print> will be added implicitly. =item C<-print0> Like -print, but terminates with \0 instead of \n. =item C<-exec OPTIONS ;> exec() the arguments in OPTIONS in a subprocess; any occurrence of {} in OPTIONS will first be substituted with the path of the current file. Note that the command "rm" has been special-cased to use perl's unlink() function instead (as an optimization). The C<;> must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using C<find(1)>). =item C<-ok OPTIONS ;> Like -exec, but first prompts user; if user's response does not begin with a y, skip the exec. The C<;> must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using C<find(1)>). =item C<-eval EXPR> Has the perl script eval() the EXPR. =item C<-ls> Simulates C<-exec ls -dils {} ;> =item C<-tar FILE> Adds current output to tar-format FILE. =item C<-cpio FILE> Adds current output to old-style cpio-format FILE. =item C<-ncpio FILE> Adds current output to "new"-style cpio-format FILE. =back Predicates which take a numeric argument N can come in three forms: * N is prefixed with a +: match values greater than N * N is prefixed with a -: match values less than N * N is not prefixed with either + or -: match only values equal to N =head1 SEE ALSO find, File::Find. =cut
Upload File
Create Folder