[ Avaa Bypassed ]




Upload:

Command:

www-data@3.148.202.164: ~ $
#!/usr/bin/perl
# link.cgi
# Forward the URL from path_info on to another webmin server

if ($ENV{'PATH_INFO'} =~ /^\/(\d+)\/([a-zA-Z0-9\-\/]+)\.(jar|class|gif|png)$/) {
	# Allow fetches of Java classes and images without a referer header,
	# as Java sometimes doesn't provide these
	$trust_unknown_referers = 1;
	}
use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
require './servers-lib.pl';
our (%text, %gconfig, %access, $module_name, %tconfig);
$ENV{'PATH_INFO'} =~ /^\/(\d+)(.*)$/ ||
	&error("Bad PATH_INFO : $ENV{'PATH_INFO'}");
my $id = $1;
my $path = $2 ? &urlize("$2") : '/';
$path =~ s/^%2F/\//;
if ($ENV{'QUERY_STRING'}) {
	$path .= '?'.$ENV{'QUERY_STRING'};
	}
elsif (@ARGV) {
	$path .= '?'.join('+', @ARGV);
	}
my $s = &get_server($id);
&can_use_server($s) || &error($text{'link_ecannot'});
$access{'links'} || &error($text{'link_ecannot'});
my $url = "@{[&get_webprefix()]}/$module_name/link.cgi/$s->{'id'}";
$| = 1;
my $meth = $ENV{'REQUEST_METHOD'};
my %miniserv;
&get_miniserv_config(\%miniserv);

my ($user, $pass);
if ($s->{'autouser'}) {
	# Login is variable .. check if we have it yet
	if ($ENV{'HTTP_COOKIE'} =~ /$id=(\S+)/) {
		# Yes - set the login and password to use
		($user, $pass) = split(/:/, &decode_base64("$1"));
		}
	else {
		# No - need to display a login form
		&ui_print_header(undef, $text{'login_title'}, "");

		print &text('login_desc', "<tt>$s->{'host'}</tt>"),"<p>\n";

		print &ui_form_start(
			"@{[&get_webprefix()]}/$module_name/login.cgi", "post");
		print &ui_hidden("id", $id);

		print &ui_table_start($text{'login_header'}, undef, 2);
		print &ui_table_row($text{'login_user'},
			&ui_textbox("user", undef, 20));
		print &ui_table_row($text{'login_pass'},
			&ui_password("pass", undef, 20));
		print &ui_table_end();

		print &ui_form_end([ [ undef, $text{'login_login'} ] ]);

		&ui_print_footer("", $text{'index_return'});
		exit;
		}
	}
elsif ($s->{'sameuser'}) {
	# Login comes from this server
	$user = $main::remote_user;
	defined($main::remote_pass) || &error($text{'login_esame'});
	$pass = $main::remote_pass;
	}
else {
	# Login is fixed
	$user = $s->{'user'};
	$pass = $s->{'pass'};
	}

# Connect to the server
my $con = &make_http_connection($s->{'ip'} || $s->{'host'}, $s->{'port'},
			        $s->{'ssl'}, $meth, $path, undef, undef,
				{ 'host' => $s->{'host'},
				  'nocheckhost' => !$s->{'checkssl'} });
&error($con) if (!ref($con));

# Send request headers
&write_http_connection($con, "Host: $s->{'host'}\r\n");
&write_http_connection($con, "User-agent: Webmin\r\n");
my $auth = &encode_base64("$user:$pass");
$auth =~ s/\n//g;
&write_http_connection($con, "Authorization: basic $auth\r\n");
my ($http_host, $http_port);
if ($ENV{'HTTP_HOST'} =~ /^(\S+):(\d+)$/) {
	# Browser supplies port
	$http_host = $1;
	$http_port = $2;
	}
elsif ($ENV{'HTTP_HOST'}) {
	# Browser only supplies host
	$http_host = $ENV{'HTTP_HOST'};
	$http_port = $ENV{'SERVER_PORT'} || $miniserv{'port'} || 80;
	}
else {
	# Web server supplies host and port
	$http_host = $ENV{'SERVER_NAME'};
	$http_port = $ENV{'SERVER_PORT'};
	}
my $http_prot = $ENV{'HTTPS'} eq "ON" ? "https" : "http";
&write_http_connection($con, sprintf(
			"Webmin-servers: %s://%s:%d%s/%s\n",
			$http_prot, $http_host, $http_port,
			@{[&get_webprefix()]},
			$tconfig{'inframe'} ? "" : "$module_name/"));
&write_http_connection($con, sprintf(
			"Webmin-path: %s://%s:%d%s/%s/link.cgi%s\n",
			$http_prot, $http_host, $http_port,
			@{[&get_webprefix()]}, $module_name,
			$ENV{'PATH_INFO'}));
if ($ENV{'HTTP_WEBMIN_PATH'}) {
	&write_http_connection($con, sprintf(
			"Complete-webmin-path: %s%s\n",
			$ENV{'HTTP_WEBMIN_PATH'}));
	}
else {
	&write_http_connection($con, sprintf(
			"Complete-webmin-path: %s://%s:%d%s/%s/link.cgi%s\n",
			$http_prot, $http_host, $http_port,
			@{[&get_webprefix()]}, $module_name,
			$ENV{'PATH_INFO'}));
	}
my $cl = $ENV{'CONTENT_LENGTH'};
&write_http_connection($con, "Content-length: $cl\r\n") if ($cl);
&write_http_connection($con, "Content-type: $ENV{'CONTENT_TYPE'}\r\n")
	if ($ENV{'CONTENT_TYPE'});
my $ref = $ENV{'HTTP_REFERER'};
if ($ref && $ref =~ /^.*\Q$url\E(.*)/) {
	my $rurl = ($s->{'ssl'} ? 'https' : 'http').'://'.$s->{'host'}.
		   ':'.$s->{'port'}.$1;
	&write_http_connection($con, "Referer: $rurl\r\n");
	}
&write_http_connection($con, "\r\n");
my $post;
if ($cl) {
	&read_fully(\*STDIN, \$post, $cl);
	&write_http_connection($con, $post);
	}

# read back the headers
my $dummy = &read_http_connection($con);
my (%header, $headers);
while(1) {
	my $headline;
	($headline = &read_http_connection($con)) =~ s/\r|\n//g;
	last if (!$headline);
	$headline =~ /^(\S+):\s+(.*)$/ || &error("Bad header");
	$header{lc($1)} = $2;
	$headers .= $headline."\n";
	}

my $defport = $s->{'ssl'} ? 443 : 80;
if ($header{'location'} &&
    ($header{'location'} =~ /^(http|https):\/\/$s->{'host'}:$s->{'port'}(.*)$/||
     $header{'location'} =~ /^(http|https):\/\/$s->{'host'}(.*)/ &&
     $s->{'port'} == $defport)) {
	# fix a redirect
	local $gconfig{'webprefixnoredir'} = 1;		# We've already added
							# webprefix, so no need
							# to add it again
	&redirect("$url$2");
	exit;
	}
elsif ($header{'www-authenticate'}) {
	# Invalid login
	if ($s->{'autouser'}) {
		print "Set-Cookie: $id=; path=/\n";
		&error(&text('link_eautologin', $s->{'host'},
		     "@{[&get_webprefix()]}/$module_name/link.cgi/$id/"));
		}
	else {
		&error(&text('link_elogin', $s->{'host'}, $user));
		}
	}
else {
	# just output the headers
	print $headers,"\n";
	}

# read back the rest of the page
if ($header{'content-type'} &&
    $header{'content-type'} =~ /text\/html/ &&
    !$header{'x-no-links'}) {
	# Fix up HTML
	while($_ = &read_http_connection($con)) {
		s/src='(\/[^']*)'/src='$url$1'/gi;
		s/src="(\/[^"]*)"/src="$url$1"/gi;
		s/src=(\/[^ "'>]*)/src=$url$1/gi;
		s/href='(\/[^']*)'/href='$url$1'/gi;
		s/href="(\/[^"]*)"/href="$url$1"/gi;
		s/href=(\/[^ >"']*)/href=$url$1/gi;
		s/action='(\/[^']*)'/action='$url$1'/gi;
		s/action="(\/[^"]*)"/action="$url$1"/gi;
		s/action=(\/[^ "'>]*)/action=$url$1/gi;
		s/\.location\s*=\s*'(\/[^']*)'/.location='$url$1'/gi;
		s/\.location\s*=\s*"(\/[^']*)"/.location="$url$1"/gi;
		s/window.open\("(\/[^"]*)"/window.open\("$url$1"/gi;
		s/name=return\s+value="(\/[^"]*)"/name=return value="$url$1"/gi;
		s/param\s+name=config\s+value='(\/[^']*)'/param name=config value='$url$1'/gi;
		s/param\s+name=config\s+value="(\/[^']*)"/param name=config value="$url$1"/gi;
		s/param\s+name=config\s+value=(\/[^']*)/param name=config value=$url$1/gi;
		print;
		if (/<applet.*archive=file.jar.*>/) {
			# Remote webmin file manager applet - give it the 
			# session ID on *this* system
			print "<param name=session value=\"$main::session_id\">\n";
			}
		}
	}
elsif ($header{'content-type'} &&
       $header{'content-type'} =~ /text\/css/ &&
       !$header{'x-no-links'}) {
	# Fix up CSS
	while($_ = &read_http_connection($con)) {
		s/url\("(\/[^"]*)"\)/url\("$url$1"\)/gi;
		print;
		}
	}
else {
	# Just pass through
	my $bs = &get_buffer_size();
	while(my $buf = &read_http_connection($con, $bs)) {
		print $buf;
		}
	}
&close_http_connection($con);


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
CHANGELOG File 1.63 KB 0644
acl_security.pl File 2.46 KB 0755
auto.pl File 2.9 KB 0755
backup_config.pl File 678 B 0755
cgi_args.pl File 313 B 0755
config File 140 B 0644
config-debian-linux File 174 B 0644
config-redhat-linux File 180 B 0644
config-syno-linux File 140 B 0644
config.info File 977 B 0644
config.info.ar File 1.5 KB 0644
config.info.ca File 1.17 KB 0644
config.info.cs File 421 B 0644
config.info.de File 1.14 KB 0644
config.info.es File 481 B 0644
config.info.fr File 489 B 0644
config.info.hu File 147 B 0644
config.info.it File 1.03 KB 0644
config.info.ja File 1.21 KB 0644
config.info.ko File 983 B 0644
config.info.ms File 934 B 0644
config.info.nl File 979 B 0644
config.info.no File 925 B 0644
config.info.pl File 1.02 KB 0644
config.info.pt_BR File 460 B 0644
config.info.ru File 1.48 KB 0644
config.info.sk File 445 B 0644
config.info.sv File 99 B 0644
config.info.tr File 487 B 0644
config.info.zh File 81 B 0644
config.info.zh_TW File 60 B 0644
config_info.pl File 264 B 0755
defaultacl File 88 B 0644
delete_servs.cgi File 836 B 0755
edit_auto.cgi File 2.32 KB 0755
edit_serv.cgi File 4.8 KB 0755
find.cgi File 1.46 KB 0755
index-json.cgi File 266 B 0755
index.cgi File 5.76 KB 0755
link.cgi File 7 KB 0755
log_parser.pl File 843 B 0755
login.cgi File 441 B 0755
logout.cgi File 340 B 0755
module.info File 178 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 124 B 0644
module.info.ar File 133 B 0644
module.info.ar.auto File 23 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 189 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 190 B 0644
module.info.ca File 120 B 0644
module.info.ca.auto File 18 B 0644
module.info.cs File 31 B 0644
module.info.cs.auto File 92 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 119 B 0644
module.info.de File 117 B 0644
module.info.de.auto File 15 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 194 B 0644
module.info.es File 37 B 0644
module.info.es.auto File 109 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 141 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 193 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 145 B 0644
module.info.fr File 34 B 0644
module.info.fr.auto File 102 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 141 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 141 B 0644
module.info.hu File 25 B 0644
module.info.hu.auto File 109 B 0644
module.info.it File 33 B 0644
module.info.it.auto File 99 B 0644
module.info.ja File 141 B 0644
module.info.ko File 32 B 0644
module.info.ko.auto File 109 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 151 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 131 B 0644
module.info.ms File 110 B 0644
module.info.ms.auto File 16 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 127 B 0644
module.info.nl File 29 B 0644
module.info.nl.auto File 97 B 0644
module.info.no File 23 B 0644
module.info.no.auto File 89 B 0644
module.info.pl File 24 B 0644
module.info.pl.auto File 95 B 0644
module.info.pt File 36 B 0644
module.info.pt.auto File 107 B 0644
module.info.pt_BR File 40 B 0644
module.info.pt_BR.auto File 113 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 125 B 0644
module.info.ru File 30 B 0644
module.info.ru.auto File 152 B 0644
module.info.sk File 31 B 0644
module.info.sk.auto File 91 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 133 B 0644
module.info.sv File 27 B 0644
module.info.sv.auto File 93 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 285 B 0644
module.info.tr File 36 B 0644
module.info.tr.auto File 111 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 192 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 188 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 163 B 0644
module.info.zh File 30 B 0644
module.info.zh.auto File 85 B 0644
module.info.zh_TW File 34 B 0644
module.info.zh_TW.auto File 91 B 0644
prefs.info File 63 B 0644
save_auto.cgi File 2.34 KB 0755
save_serv.cgi File 3.31 KB 0755
servers-lib.pl File 15.04 KB 0755
uninstall.pl File 262 B 0755