MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/usr/libexec/webmin/file/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/usr/libexec/webmin/file/size.cgi
#!/usr/bin/perl
# size.cgi
# Returns the size in bytes, number of files and number of dirs in a directory

require './file-lib.pl';
&ReadParse();
&switch_acl_uid_and_chroot();
print "Content-type: text/plain\n\n";
if (!&can_list($in{'dir'})) {
	print $text{'list_eaccess'},"\n";
	}
($size, $files, $dirs) = &recursive_dir_info($in{'dir'});
print "\n";
print $size," ",$files," ",$dirs," ",&nice_size($size),"\n";

# recursive_dir_info(directory)
sub recursive_dir_info
{
local $dir = &translate_filename($_[0]);
if (-l $dir) {
	# Symlink
	return (0, 1, 0);
	}
elsif (-f $dir) {
	local @st = stat($dir);
	return ($st[7], 1, 0);
	}
elsif (-d $dir) {
	local @st = stat($dir);
	local ($size, $files, $dirs) = ($st[7], 0, 1);
	opendir(DIR, $dir);
	local @files = readdir(DIR);
	closedir(DIR);
	foreach my $f (@files) {
		next if ($f eq "." || $f eq "..");
		local @r = &recursive_dir_info("$dir/$f");
		$size += $r[0];
		$files += $r[1];
		$dirs += $r[2];
		}
	return ($size, $files, $dirs);
	}
else {
	# Special file ..
	return (0, 1, 0);
	}
}



Anon7 - 2021