| Server IP : 189.126.111.107 / Your IP : 216.73.217.69 Web Server : Apache System : Linux www.gadotticar.com.br 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 User : gadotticar ( 1000) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/usermin/file/ |
Upload File : |
#!/usr/bin/perl
# search.cgi
# Find files under some directory
require './file-lib.pl';
$disallowed_buttons{'search'} && &error($text{'ebutton'});
&ReadParse();
&switch_acl_uid();
print "Content-type: text/plain\n\n";
if (!&can_access($in{'dir'})) {
print $text{'search_eaccess'},"\n";
}
$in{'dir'} =~ s/^\/+/\//g;
if ($in{'dir'} ne '/') {
$in{'dir'} =~ s/\/$//;
}
$cmd = "find ".quotemeta(&unmake_chroot($in{'dir'}))." -name ".quotemeta($in{'match'});
if ($in{'type'}) {
$cmd .= " -type ".quotemeta($in{'type'});
}
if ($in{'user'}) {
$cmd .= " -user ".quotemeta($in{'user'});
}
if ($in{'group'}) {
$cmd .= " -group ".quotemeta($in{'group'});
}
if ($in{'size'}) {
$cmd .= " -size ".quotemeta($in{'size'});
}
if ($in{'xdev'}) {
$cmd .= " -mount";
}
print "\n";
open(CMD, "$cmd 2>/dev/null |");
while($f = <CMD>) {
chop($f);
if (defined($in{'cont'})) {
# Check the file contents for the given pattern
$found = 0;
if ($f =~ /\.pdf$/i && &has_command("pdftotext")) {
# Convert PDF to text
open(FILE, "pdftotext -raw ".quotemeta($f)." - |");
}
else {
open(FILE, $f);
}
while(<FILE>) {
if (/\Q$in{'cont'}\E/i) {
$found = 1;
last;
}
}
close(FILE);
next if (!$found);
}
local $rf = &make_chroot($f);
local $fil = &file_info_line($f, $rf);
print $fil,"\n" if (defined($fil));
}
close(CMD);