[ Avaa Bypassed ]




Upload:

Command:

www-data@3.14.251.87: ~ $
# Functions for searching the webmin docs and UI

=head2 search_webmin(phrase, [callback-function], [&modules])

Searches all Webmin help pages, UI text, module names and config.info files
for entries matching the given phrase or word. Returns them sorted by relevance
order, each as a hash ref with the following keys :

=item mod - A module hash reference for the module the search result was in

=item rank - A result ranking, higher being better

=item type - One of mod (for module name), dir (for module directory), config (configuration setting), help (help page) or text (UI text)

=item text - The text that matched

=items cgis - An array ref of pages on which the text appears, each formatted like module/script.cgi

=cut
sub search_webmin
{
my ($re, $cbfunc, $onlymods) = @_;

# Work out this Webmin's URL base
my $urlhost = $ENV{'HTTP_HOST'};
if ($urlhost !~ /:/) {
	$urlhost .= ":".$ENV{'SERVER_PORT'};
	}
my $urlbase = ($ENV{'HTTPS'} eq 'ON' ? 'https://' : 'http://').$urlhost;

# Search module names and add to results list
my @rv = ( );
my $pn = &get_product_name();
my @mods;
if ($onlymods) {
	# Modules specified by caller
	@mods = grep { &foreign_available($_->{'dir'}) } @$onlymods;
	}
else {
	# All reasonable modules
	@mods = &get_available_module_infos();
	}
@mods = grep { !$_->{'clone'} && !$_->{'hidden'} }
	  grep { !$_->{'noui'} && !$_->{$pn.'_noui'} } @mods;
@mods = sort { $b->{'longdesc'} cmp $a->{'longdesc'} } @mods;
foreach my $m (@mods) {
	if ($m->{'desc'} =~ /\Q$re\E/i) {
		# Module description match
		push(@rv, { 'mod' => $m,
			    'rank' => 10,
			    'type' => 'mod',
			    'link' => $m->{'dir'}.'/',
			    'text' => $m->{'desc'} });
		}
	elsif ($m->{'longdesc'} =~ /\Q$re\E/i) {
		# Module long description match
		push(@rv, { 'mod' => $m,
			    'rank' => 9.5,
			    'type' => 'mod',
			    'link' => $m->{'dir'}.'/',
			    'text' => $m->{'longdesc'} });
		}
	elsif ($m->{'dir'} =~ /\Q$re\E/i) {
		# Module directory match
		push(@rv, { 'mod' => $m,
			    'rank' => 9,
			    'type' => 'dir',
			    'link' => $m->{'dir'}.'/',
			    'text' => $urlbase."/".$m->{'dir'}."/" });
		}
	&$cbfunc() if ($cbfunc);
	}

# Extract zipped help files to temp dir
my $helpbase = &transname();
&make_dir($helpbase, 0700);
my %helpmap;
foreach my $m (@mods) {
	my $helpzip = &module_root_directory($m)."/help/help.zip";
	if (-r $helpzip) {
		my $helpdir = $helpbase."/".$m->{'dir'};
		&make_dir($helpdir, 0700);
		&execute_command("cd ".quotemeta($helpdir)." && unzip ".quotemeta($helpzip));
		if (!$?) {
			$helpmap{$m->{'dir'}} = $helpdir;
			}
		}
	}

# Search module configs and their help pages
foreach my $m (@mods) {
	my %access = &get_module_acl(undef, $m);
	next if ($access{'noconfig'});
	my $file = $prod eq 'webmin' ? "$m->{'dir'}/config.info"
				     : "$m->{'dir'}/uconfig.info";
	my %info = ( );
	my @info_order = ( );
	&read_file($file, \%info, \@info_order);
	foreach my $o (@lang_order_list) {
		&read_file("$file.$o", \%info);
		}
	my $section = undef;
	my $helpdir = $helpmap{$m->{'dir'}};
	foreach my $c (@info_order) {
		my @p = split(/,/, $info{$c});
		if ($p[1] == 11) {
			$section = $c;
			}
		if ($p[0] =~ /\Q$re\E/i) {
			# Config description matches
			push(@rv, { 'mod' => $m,
				    'rank' => 8,
				    'type' => 'config',
				    'link' => "/config.cgi?module=$m->{'dir'}&".
					     "section=".&urlize($section)."#$c",
				    'text' => $p[0],
				  });
			}
		my $hfl = &help_file($mod->{'dir'}, "config_".$c, $helpdir);
		my ($title, $help) = &help_file_match($hfl);
		if ($help) {
			# Config help matches
			push(@rv, { 'mod' => $m,
                                    'rank' => 6,
				    'type' => 'help',
				    'link' => "/help.cgi/$m->{'dir'}/config_".$c,
				    'desc' => &text('wsearch_helpfor', $p[0]),
				    'text' => $help,
				    'cgis' => [ "/config.cgi?".
					        "module=$m->{'dir'}&section=".
						&urlize($section)."#$c" ],
				   });
			}
		}
	&$cbfunc() if ($cbfunc);
	}

# Search other help pages
my %lang_order_list = map { $_, 1 } @lang_order_list;
foreach my $m (@mods) {
	my $helpdir = $helpmap{$m->{'dir'}} ||
		      &module_root_directory($m)."/help";
	my %donepage = ( );
	opendir(DIR, $helpdir);
	foreach my $f (sort { length($b) <=> length($a) } readdir(DIR)) {
		next if ($f =~ /^config_/);	# For config help, already done

		# Work out if we should grep this help page - don't do the same
		# page twice for different languages
		my $grep = 0;
		my ($page, $lang);
		if ($f =~ /^(\S+)\.([^\.]+)\.html$/) {
			($page, $lang) = ($1, $2);
			if ($lang_order_list{$lang} && !$donepage{$page}++) {
				$grep = 1;
				}
			}
		elsif ($f =~ /^(\S+)\.html$/) {
			$page = $1;
			if (!$donepage{$page}++) {
				$grep = 1;
				}
			}

		# If yes, search it
		if ($grep) {
			my ($title, $help) = &help_file_match("$helpdir/$f");
			if ($title) {
				my @cgis = &find_cgi_text(
					[ "hlink\\(.*'$page'",
					  "hlink\\(.*\"$page\"",
					  "header\\([^,]+,[^,]+,[^,]+,\\s*\"$page\"",
					  "header\\([^,]+,[^,]+,[^,]+,\\s*'$page'",
					], $m, 1);
				push(@rv, { 'mod' => $m,
					    'rank' => 6,
					    'type' => 'help',
					    'link' => "/help.cgi/$m->{'dir'}/$page",
					    'desc' => $title,
					    'text' => $help,
					    'cgis' => \@cgis });
				}
			}
		&$cbfunc() if ($cbfunc);
		}
	closedir(DIR);
	}

# Then do text strings
my %gtext = &load_language("");
MODULE: foreach my $m (@mods) {
	my %mtext = &load_language($m->{'dir'});
	foreach my $k (keys %mtext) {
		next if ($gtext{$k});	# Skip repeated global strings
		$mtext{$k} =~ s/\$[0-9]//g;
		if ($mtext{$k} =~ /\Q$re\E/i) {
			# Find CGIs that use this text
			my @cgis = &find_cgi_text(
				[ "\$text{'$k'}",
				  "\$text{\"$k\"}",
				  "\$text{$k}",
				  "&text('$k'",
				  "&text(\"$k\"" ], $m);
			if (@cgis) {
				push(@rv, { 'mod' => $m,
					    'rank' => 4,
					    'type' => 'text',
					    'text' => $mtext{$k},
					    'cgis' => \@cgis });
				}
			}
		}
	&$cbfunc() if ($cbfunc);
	}

# Sort results by relevancy
# XXX can do better?
@rv = sort { $b->{'rank'} <=> $a->{'rank'} ||
	     lc($a->{'mod'}->{'desc'}) cmp lc($b->{'mod'}->{'desc'}) } @rv;
return @rv;
}

# highlight_text(text, [length])
# Returns text with the search term bolded, and truncated to 50 characters
sub highlight_text
{
local ($str, $len) = @_;
$len ||= 50;
local $hlen = $len / 2;
$str =~ s/<[^>]*>//g;
if ($str =~ /(.*)(\Q$re\E)(.*)/i) {
	local ($before, $match, $after) = ($1, $2, $3);
	if (length($before) > $hlen) {
		$before = "...".substr($before, length($before)-$hlen);
		}
	if (length($after) > $hlen) {
		$after = substr($after, 0, $hlen)."...";
		}
	$str = $before."<b>".&html_escape($match)."</b>".$after;
	}
return $str;
}

# find_cgi_text(&regexps, module, re-mode)
# Returns the relative URLs of CGIs that matches some regexps, in the given
# module. Does not include those that don't call some header function, as
# they cannot be linked to normally
sub find_cgi_text
{
local ($res, $m, $remode) = @_;
local $mdir = &module_root_directory($m);
local @rv;
foreach my $f (glob("$mdir/*.cgi")) {
	local $found = 0;
	local $header = 0;
	open(CGI, "<".$f);
	LINE: while(my $line = <CGI>) {
		if ($line =~ /(header|ui_print_header|ui_print_unbuffered_header)\(/) {
			$header++;
			}
		foreach my $r (@$res) {
			if (!$remode && index($line, $r) >= 0 ||
			    $remode && $line =~ /$r/) {
				$found++;
				last LINE;
				}
			}
		}
	close(CGI);
	if ($found && $header) {
		local $url = $f;
		$url =~ s/^\Q$root_directory\E\///;
		push(@rv, $url);
		}
	}
return @rv;
}

# help_file_match(file)
# Returns the title if some help file matches the current search
sub help_file_match
{
local ($f) = @_;
local $data = &read_file_contents($f);
local $title;
if ($data =~ /<header>([^<]*)<\/header>/) {
	$title = $1;
	}
$data =~ s/\s+/ /g;
$data =~ s/<p>/\n\n/gi;
$data =~ s/<br>/\n/gi;
$data =~ s/<[^>]+>//g;
if ($data =~ /\Q$re\E/i) {
	return ($title, $data);
	}
return ( );
}

# cgi_page_title(module, cgi)
# Given a CGI, return the text for its page title, if possible
sub cgi_page_title
{
local ($m, $cgi) = @_;
local $data = &read_file_contents(&module_root_directory($m)."/".$cgi);
local $rv;
if ($data =~ /(ui_print_header|ui_print_unbuffered_header)\([^,]+,[^,]*(\$text\{'([^']+)'|\$text\{"([^"]+)"|\&text\('([^']+)'|\&text\("([^"]+)")/) {
	# New header function, with arg before title
	local $msg = $3 || $4 || $5 || $6;
	local %mtext = &load_language($m);
	$rv = $mtext{$msg};
	}
elsif ($data =~ /(^|\s|mail_page_)header\(\s*(\$text\{'([^']+)'|\$text\{"([^"]+)"|\&text\('([^']+)'|\&text\("([^"]+)")/) {
	# Old header function
	local $msg = $3 || $4 || $5 || $6;
	local %mtext = &load_language($m);
	$rv = $mtext{$msg};
	}
if ($cgi eq "index.cgi" && !$rv) {
	# If no title was found for an index.cgi, use module title
	local %minfo = &get_module_info($m);
	$rv = $minfo{'desc'};
	}
return $rv;
}

# cgi_page_args(module, cgi)
# Given a module and CGI name, returns a string of URL parameters that can be
# used for linking to it. Returns "none" if parameters are needed, but cannot
# be determined.
sub cgi_page_args
{
local ($m, $cgi) = @_;
local $mroot = &module_root_directory($m);
if (-r "$mroot/cgi_args.pl") {
	# Module can tell us what args to use
	&foreign_require($m, "cgi_args.pl");
	$args = &foreign_call($m, "cgi_args", $cgi);
	if (defined($args)) {
		return $args;
		}
	}
if ($cgi eq "index.cgi") {
	# Index page is always safe to link to
	return undef;
	}
# Otherwise check if it appears to parse any args
local $data = &read_file_contents($mroot."/".$cgi);
if ($data =~ /(ReadParse|ReadParseMime)\(/) {
	return "none";
	}
return undef;
}

1;


Filemanager

Name Type Size Permission Actions
acl Folder 0755
adsl-client Folder 0755
apache Folder 0755
at Folder 0755
authentic-theme Folder 0755
backup-config Folder 0755
bacula-backup Folder 0755
bandwidth Folder 0755
bin Folder 0755
bind8 Folder 0755
blue-theme Folder 0755
change-user Folder 0755
cluster-copy Folder 0755
cluster-cron Folder 0755
cluster-passwd Folder 0755
cluster-shell Folder 0755
cluster-software Folder 0755
cluster-useradmin Folder 0755
cluster-usermin Folder 0755
cluster-webmin Folder 0755
cpan Folder 0755
cron Folder 0755
custom Folder 0755
dfsadmin Folder 0755
dhcpd Folder 0755
dovecot Folder 0755
exim Folder 0755
exports Folder 0755
fail2ban Folder 0755
fdisk Folder 0755
fetchmail Folder 0755
filemin Folder 0755
filter Folder 0755
firewall Folder 0755
firewall6 Folder 0755
firewalld Folder 0755
fsdump Folder 0755
gray-theme Folder 0755
grub Folder 0755
heartbeat Folder 0755
htaccess-htpasswd Folder 0755
idmapd Folder 0755
images Folder 0755
inetd Folder 0755
init Folder 0755
inittab Folder 0755
ipfilter Folder 0755
ipfw Folder 0755
ipsec Folder 0755
iscsi-client Folder 0755
iscsi-server Folder 0755
iscsi-target Folder 0755
iscsi-tgtd Folder 0755
jabber Folder 0755
krb5 Folder 0755
lang Folder 0755
ldap-client Folder 0755
ldap-server Folder 0755
ldap-useradmin Folder 0755
logrotate Folder 0755
logviewer Folder 0755
lpadmin Folder 0755
lvm Folder 0755
mailboxes Folder 0755
mailcap Folder 0755
man Folder 0755
mon Folder 0755
mount Folder 0755
mysql Folder 0755
net Folder 0755
nis Folder 0755
openslp Folder 0755
package-updates Folder 0755
pam Folder 0755
pap Folder 0755
passwd Folder 0755
phpini Folder 0755
postfix Folder 0755
postgresql Folder 0755
ppp-client Folder 0755
pptp-client Folder 0755
pptp-server Folder 0755
proc Folder 0755
procmail Folder 0755
proftpd Folder 0755
qmailadmin Folder 0755
quota Folder 0755
raid Folder 0755
samba Folder 0755
sarg Folder 0755
sendmail Folder 0755
servers Folder 0755
shell Folder 0755
shorewall Folder 0755
shorewall6 Folder 0755
smart-status Folder 0755
smf Folder 0755
software Folder 0755
spam Folder 0755
squid Folder 0755
sshd Folder 0755
status Folder 0755
stunnel Folder 0755
syslog Folder 0755
syslog-ng Folder 0755
system-status Folder 0755
tcpwrappers Folder 0755
time Folder 0755
tunnel Folder 0755
unauthenticated Folder 0755
updown Folder 0755
useradmin Folder 0755
usermin Folder 0755
vendor_perl Folder 0755
vgetty Folder 0755
webalizer Folder 0755
webmin Folder 0755
webmincron Folder 0755
webminlog Folder 0755
wuftpd Folder 0755
xinetd Folder 0755
xterm Folder 0755
LICENCE File 1.48 KB 0644
LICENCE.ja File 1.62 KB 0644
README.md File 4.25 KB 0644
WebminCore.pm File 7.85 KB 0644
acl_security.pl File 4.51 KB 0755
changepass.pl File 868 B 0755
chooser.cgi File 7.21 KB 0755
config-aix File 227 B 0644
config-cobalt-linux File 264 B 0644
config-coherent-linux File 264 B 0644
config-corel-linux File 264 B 0644
config-debian-linux File 264 B 0644
config-freebsd File 256 B 0644
config-generic-linux File 264 B 0644
config-gentoo-linux File 264 B 0644
config-hpux File 243 B 0644
config-irix File 284 B 0644
config-lib.pl File 10.82 KB 0755
config-macos File 260 B 0644
config-mandrake-linux File 278 B 0644
config-msc-linux File 264 B 0644
config-netbsd File 283 B 0644
config-open-linux File 264 B 0644
config-openbsd File 241 B 0644
config-openmamba-linux File 264 B 0644
config-openserver File 236 B 0644
config-osf1 File 266 B 0644
config-pardus-linux File 264 B 0644
config-redhat-linux File 264 B 0644
config-slackware-linux File 280 B 0644
config-sol-linux File 264 B 0644
config-solaris File 417 B 0644
config-suse-linux File 264 B 0644
config-syno-linux File 364 B 0644
config-trustix-linux File 264 B 0644
config-turbo-linux File 264 B 0644
config-united-linux File 264 B 0644
config-unixware File 286 B 0644
config-windows File 88 B 0644
config.cgi File 1.55 KB 0755
config_save.cgi File 1.64 KB 0755
copyconfig.pl File 4.33 KB 0755
create-module.pl File 3.82 KB 0755
date_chooser.cgi File 2.19 KB 0755
deb-name File 7 B 0644
defaultacl File 98 B 0644
defaulttheme File 16 B 0644
entities_map.txt File 1.47 KB 0644
fastrpc.cgi File 10.18 KB 0755
favicon.ico File 14.73 KB 0644
feedback.cgi File 6.37 KB 0755
feedback_form.cgi File 3.45 KB 0755
group_chooser.cgi File 7.36 KB 0755
help.cgi File 2.94 KB 0755
index.cgi File 5.61 KB 0755
install-module.pl File 1.54 KB 0755
install-type File 4 B 0644
javascript-lib.pl File 14.69 KB 0755
lang_list.txt File 3.41 KB 0644
maketemp.pl File 424 B 0755
mime.types File 12.42 KB 0644
miniserv.pem File 2.9 KB 0644
miniserv.pl File 179.71 KB 0755
module_chooser.cgi File 4.14 KB 0755
newmods.pl File 1.25 KB 0755
os_list.txt File 34.18 KB 0644
oschooser.pl File 4.55 KB 0755
pam_login.cgi File 2.83 KB 0755
password_change.cgi File 7 KB 0755
password_form.cgi File 1.3 KB 0755
perlpath.pl File 571 B 0755
record-failed.pl File 503 B 0755
record-login.pl File 513 B 0755
record-logout.pl File 516 B 0755
robots.txt File 26 B 0644
rpc.cgi File 4 KB 0755
run-postinstalls.pl File 1 KB 0755
run-uninstalls.pl File 1004 B 0755
safeacl File 44 B 0644
session_login.cgi File 3.55 KB 0755
setup-repos.sh File 4.66 KB 0755
setup.bat File 3.09 KB 0644
setup.pl File 30.33 KB 0755
setup.sh File 32.06 KB 0755
switch_skill.cgi File 293 B 0755
switch_user.cgi File 404 B 0755
thirdparty.pl File 1.73 KB 0755
ui-lib.pl File 82.8 KB 0755
update-from-repo.sh File 14.8 KB 0755
uptracker.cgi File 2.88 KB 0755
user_chooser.cgi File 7.29 KB 0755
version File 6 B 0644
web-lib-funcs.pl File 356.13 KB 0755
web-lib.pl File 907 B 0755
webmin-daemon File 80 B 0644
webmin-init File 1.93 KB 0755
webmin-pam File 101 B 0644
webmin-search-lib.pl File 9.42 KB 0755
webmin-systemd File 371 B 0644
webmin_search.cgi File 2.63 KB 0755
xmlrpc.cgi File 7.53 KB 0755