[ Avaa Bypassed ]




Upload:

Command:

www-data@18.188.66.142: ~ $
#!/usr/bin/perl
# download.cgi
# Get a perl module from somewhere

require './cpan-lib.pl';

if ($ENV{REQUEST_METHOD} eq "POST") { &ReadParseMime(); }
else { &ReadParse(); $no_upload = 1; }
&error_setup($text{'download_err'});

if ($in{'source'} >= 2) {
	&ui_print_unbuffered_header(undef, $text{'download_title'}, "");
	}
else {
	&ui_print_header(undef, $text{'download_title'}, "");
	}

&tempname();
if ($in{'source'} == 0) {
	# installing from local file (or maybe directory)
	if (!$in{'local'})
		{ &install_error($text{'download_elocal'}); }
	if (!-r $in{'local'})
		{ &install_error(&text('download_elocal2', $in{'local'})); }
	$source = $in{'local'};
	@pfile = ( $in{'local'} );
	$need_unlink = 0;
	}
elsif ($in{'source'} == 1) {
	# installing from upload .. store file in temp location
	if ($no_upload) {
		&install_error($text{'download_eupload'});
		}
	$in{'upload_filename'} =~ /([^\/\\]+$)/;
	@pfile = ( &tempname("$1") );
	open(PFILE, ">$pfile[0]");
	print PFILE $in{'upload'};
	close(PFILE);
	$source = $in{'upload_filename'};
	$need_unlink = 1;
	}
elsif ($in{'source'} == 2) {
	# installing from URL.. store downloaded file in temp location
	$in{'url'} =~ /\/([^\/]+)\/*$/;
	@pfile = ( &tempname("$1") );
	$progress_callback_url = $in{'url'};
	if ($in{'url'} =~ /^(http|https):\/\/([^\/]+)(\/.*)$/) {
		# Make a HTTP request
		$ssl = $1 eq 'https';
		$host = $2; $page = $3; $port = $ssl ? 443 : 80;
		if ($host =~ /^(.*):(\d+)$/) { $host = $1; $port = $2; }
		&http_download($host, $port, $page, $pfile[0], \$error,
			       \&progress_callback, $ssl);
		}
	elsif ($in{'url'} =~ /^ftp:\/\/([^\/]+)(:21)?(\/.*)$/) {
		$host = $1; $file = $3;
		&ftp_download($host, $file, $pfile[0], \$error,
			      \&progress_callback);
		}
	else { &install_error(&text('download_eurl', $in{'url'})); }
	&install_error($error) if ($error);
	$source = $in{'url'};
	$need_unlink = 1;
	}
elsif ($in{'source'} == 3) {
	# installing from CPAN.. find the module, and then install it
	$in{'cpan'} || &error($text{'download_emodname'});
	$in{'cpan'} =~ s/^\s+//;
	$in{'cpan'} =~ s/\s+$//;
	$in{'cpan'} =~ s/\/+/::/g;
	@cpan = split(/\s+|\0/, $in{'cpan'});

	# First check if YUM or APT can install this module for us
	if ($config{'incyum'} && !$in{'forcecpan'}) {
		@yum = &list_packaged_modules();
		foreach $c (@cpan) {
			($yum) = grep { lc($_->{'mod'}) eq lc($c) } @yum;
			if ($yum) {
				# Module name is known
				push(@cpanyum, $yum);
				}
			elsif ($software::config{'package_system'} eq "rpm") {
				# Try to install from perl dependency
				push(@cpanyum, { 'package' => "perl($c)" });
				}
			}
		}
	if (scalar(@cpan) == scalar(@cpanyum) &&
	    defined(&software::update_system_install)) {
		# Can install from YUM or APT .. do it!
		$i = 0;
		@fallback = ( );
		foreach $yum (@cpanyum) {
			print &text('download_yum', "<tt>$cpan[$i]</tt>",
				    "<tt>$yum->{'package'}</tt>"),"<br>\n";
			print "<ul>\n";
			@got = &software::update_system_install(
				$yum->{'package'});
			print "</ul>\n";
			if (!@got) {
				# Failed, so fall back to direct install (but
				# only if not installed yet)
				eval "use $cpan[$i]";
				if ($@) {
					push(@fallback, $cpan[$i]);
					}
				}
			$i++;
			}
		if (@fallback) {
			print "<b>$text{'download_fallback'}</b><p>\n";
			@cpan = @fallback;
			}
		else {
			&ui_print_footer($in{'return'},
				 $in{'returndesc'} || $text{'index_return'});
			exit;
			}
		}

	$progress_callback_url = $config{'packages'};
	if (!-r $packages_file || $in{'refresh'}) {
		# Need to download the modules list from CPAN first
		&download_packages_file(\&progress_callback);
		print "<p>\n";

		# Make sure it is valid
		open(PFILE, "<$packages_file");
		read(PFILE, $two, 2);
		close(PFILE);
		if ($two ne "\037\213") {
			&install_error(&text('download_ecpangz',
					 "<tt>$config{'packages'}</tt>"));
			}
		}

	# Find each module in the modules list
	open(LIST, "gunzip -c $packages_file |");
	while(<LIST>) {
		s/\r|\n//g;
		if ($_ eq '') { $found_blank++; }
		elsif ($found_blank && /^(\S+)\s+(\S+)\s+(.*)/) {
			local $i = &indexof($1, @cpan);
			if ($i >= 0 && !$source[$i]) {
				$source[$i] = "$config{'cpan'}/$3";
				$source[$i] =~ /\/perl-[0-9\.]+\.tar\.gz$/ &&
				    &install_error(&text('download_eisperl',
						"<tt>$in{'cpan'}</tt>"));
				$sourcec++;
				}
			}
		}
	close(LIST);

	# Fail if any modules are missing from CPAN
	for($i=0; $i<@cpan; $i++) {
		push(@missing, "<tt>$cpan[$i]</tt>") if (!$source[$i]);
		}

	if ($in{'missingok'}) {
		# If missing modules are OK, exclude them from the sources list
		for($i=0; $i<@cpan; $i++) {
			if (!$source[$i]) {
				splice(@source, $i, 1);
				splice(@cpan, $i, 1);
				$i--;
				}
			}
		@cpan || &install_error(&text('download_ecpan',
					      join(" ", @missing)));
		}
	elsif (@missing) {
		# Fail due to missing modules
		&install_error(&text('download_ecpan', join(" ", @missing)));
		}
	$source = join("<br>", @source);

	# Download the actual modules
	foreach $m (@source) {
		$m =~ /\/([^\/]+)\/*$/;
		$pfile = &tempname("$1");
		$progress_callback_url = $m;
		if ($m =~ /^http:\/\/([^\/]+)(\/.*)$/) {
			# Make a HTTP request
			$host = $1; $page = $2; $port = 80;
			if ($host =~ /^(.*):(\d+)$/) { $host = $1; $port = $2; }
			&http_download($host, $port, $page, $pfile, \$error,
				       \&progress_callback);
			}
		elsif ($m =~ /^ftp:\/\/([^\/]+)(:21)?(\/.*)$/) {
			$host = $1; $file = $3;
			&ftp_download($host, $file, $pfile, \$error,
				      \&progress_callback);
			}
		else { &install_error(&text('download_eurl', $m)); }
		&install_error($error) if ($error);
		push(@pfile, $pfile);
		}
	$need_unlink = 1;
	}
else {
	&error("Unknown source mode $in{'source'}");
	}

# Check if the file looks like a perl module
foreach $pfile (@pfile) {
	open(TAR, "( gunzip -c ".quotemeta($pfile)." | tar tf - ) 2>&1 |");
	while($line = <TAR>) {
		if ($line =~ /^\.\/([^\/]+)\/(.*)$/ ||
		    $line =~ /^([^\/]+)\/(.*)$/) {
			if (!$dirs{$1}) {
				$dirs{$1} = $pfile;
				push(@dirs, $1);
				}
			$file{$2}++;
			}
		$tar .= $line;
		}
	close(TAR);
	if ($?) {
		unlink(@pfile) if ($need_unlink);
		&install_error(&text('download_etar',
			"<tt>".&html_escape($tar)."</tt>"));
		}
	}
if (@dirs == 0 || $file{'Makefile.PL'}+$file{'Build.PL'} < @dirs) {
	# Not all files were Perl modules
	unlink(@pfile) if ($need_unlink);
	&install_error($text{'download_emod'});
	}
if ($file{'Build.PL'} && $file{'Makefile.PL'} < @dirs) {
	# Make sure we have Module::Build if using Build.PL
	eval "use Module::Build";
	if ($@) {
		unlink(@pfile) if ($need_unlink);
		&install_error(&text('download_ebuild',
				     "<tt>Module::Build</tt>"));
		}
	}
foreach $d (@dirs) {
	if ($d =~ /^(\S+)\-v?([0-9\.ab]+)$/) {
		push(@mods, $1);
		push(@vers, $2);
		}
	else {
		push(@mods, $m);
		push(@vers, undef);
		}
	$mods[$#mods] =~ s/-/::/g;
	}

# Extract all module files to look for depends
$mtemp = &tempname();
mkdir($mtemp, 0755);
foreach $d (@dirs) {
	system("cd $mtemp ; gunzip -c $dirs{$d} | tar xf - >/dev/null");
	local $testargs;
	if ($d =~ /^Net_SSLeay/) {
		$testargs = &has_command("openssl");
		$testargs =~ s/\/bin\/openssl$//;
		}
	local $cmd = "cd $mtemp/$d ; $perl_path Makefile.PL $testargs --skip";
	if (&foreign_check("proc")) {
		# Run in a PTY, to handle CPAN prompting
		&foreign_require("proc", "proc-lib.pl");
		local ($fh, $fpid) = &proc::pty_process_exec($cmd);
		&sysprint($fh, "no\n");    # For CPAN manual config question
		while(<$fh>) {
			# Wait till it completes
			}
		close($fh);
		}
	else {
		system("$cmd >/dev/null 2>&1 </dev/null");
		}
	local @prereqs;
	open(MAKEFILE, "<$mtemp/$d/Makefile");
	while(<MAKEFILE>) {
		last if /MakeMaker post_initialize section/;
		if (/^#\s+PREREQ_PM\s+=>\s+(.+)/) {
			local $prereq = $1;
			while($prereq =~ m/(?:\s)([\w\:]+)=>q\[.*?\],?/g) {
				push(@prereqs, $1);
				}
			}
		}
	close(MAKEFILE);
	push(@allreqs, @prereqs);
	}
system("rm -rf $mtemp");

# Work out which pre-requesites are missing
@allreqs = &unique(@allreqs);
%needreqs = map { eval "use $_"; $@ ? ($_, 1) : ($_, 0) } @allreqs;
foreach $m (@mods) {
	# Don't need modules in tar files
	delete($needreqs{$m});
	}
foreach $c (@cpan) {
	# Don't need modules we are getting from CPAN
	delete($needreqs{$c});
	}

# Display install options
print "<p>\n";
print &ui_form_start("install.cgi");
print &ui_hidden("source", $in{'source'});
print &ui_hidden("need_unlink", $need_unlink);
foreach $pfile (@pfile) {
	print &ui_hidden("pfile", $pfile);
	}
foreach $m (@mods) {
	print &ui_hidden("mod", $m);
	}
foreach $v (@vers) {
	print &ui_hidden("ver", $v);
	}
foreach $d (@dirs) {
	print &ui_hidden("dir", $d);
	}
print &ui_hidden("return", $in{'return'});
print &ui_hidden("returndesc", $in{'returndesc'});
print &ui_table_start($text{'download_header'}, undef, 2);

# Modules being installed
for($i=0; $i<@mods; $i++) {
	$modmsg .= &html_escape($mods[$i])." ".&html_escape($vers[$i])."<br>\n";
	}
print &ui_table_row(@mods > 1 ? $text{'download_mods'} : $text{'download_mod'},
		    $modmsg);

# Missing modules
if (@missing) {
	print &ui_table_row($text{'download_missingok'},
			    join(" ", @missing));
	}

# Source
print &ui_table_row($text{'download_src'}, $source);

if (@allreqs) {
	# Pre-requisited
	@needreqs = grep { $needreqs{$_} } @allreqs;
	foreach $n (@needreqs) {
		print &ui_hidden("needreq", $n);
		}
	if (@needreqs) {
		$nmsg = " (".&text('download_missing', scalar(@needreqs)).")";
		}
	else {
		$nmsg = " ($text{'download_nomissing'})";
		}
	print &ui_table_row($text{'download_pres'},
	      join(" ", map { $needreqs{$_} ? "<i>$_</i>" : "<tt>$_</tt>" }
			    @allreqs).$nmsg);
	}

# Install mode
$in{'mode'} = 3 if ($in{'mode'} eq '');
print &ui_table_row($text{'download_act'},
	&ui_select("act", $in{'mode'},
		   [ [ 0, $text{'download_m'} ],
		     [ 1, $text{'download_mt'} ],
		     [ 2, $text{'download_mi'} ],
		     [ 3, $text{'download_mti'} ] ]));

# Command-line args to Makefile.PL
print &ui_table_row($text{'download_args'},
	&ui_textbox("args", $config{'def_args'}, 40));

# Table of environment variables
$etable = &ui_columns_start([ $text{'download_name'},
			      $text{'download_value'} ]);
for($i=0; $i<4; $i++) {
	$etable .= &ui_columns_row([ &ui_textbox("name_$i", undef, 15),
				     &ui_textbox("value_$i", undef, 30) ]);
	}
$etable .= &ui_columns_end();
print &ui_table_row($text{'download_envs'}, $etable);

print &ui_table_end();
print &ui_form_end([ [ undef, $text{'download_cont'} ],
		     @needreqs && $in{'source'} == 3 ?
			( [ "need", $text{'download_need'} ] ) : ( )
		   ]);

&ui_print_footer($in{'return'},
		 $in{'returndesc'} || $text{'index_return'});

sub install_error
{
print "<br><b>$main::whatfailed : $_[0]</b> <p>\n";
&ui_print_footer($in{'return'},
		 $in{'returndesc'} || $text{'index_return'});
exit;
}


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
CHANGELOG File 1.88 KB 0644
cgi_args.pl File 124 B 0755
config File 153 B 0644
config-solaris File 202 B 0644
config.info File 442 B 0644
config.info.ca File 539 B 0644
config.info.cs File 494 B 0644
config.info.de File 544 B 0644
config.info.es File 351 B 0644
config.info.fr File 504 B 0644
config.info.hr File 0 B 0644
config.info.hu File 72 B 0644
config.info.it File 517 B 0644
config.info.ja File 611 B 0644
config.info.ko File 457 B 0644
config.info.ms File 473 B 0644
config.info.nl File 476 B 0644
config.info.no File 459 B 0644
config.info.pl File 505 B 0644
config.info.ru File 292 B 0644
config.info.sv File 76 B 0644
config.info.uk File 305 B 0644
config.info.zh File 244 B 0644
config.info.zh_TW File 224 B 0644
cpan-lib.pl File 11.04 KB 0755
cpan.cgi File 3.36 KB 0755
delete_file.cgi File 312 B 0755
download.cgi File 10.56 KB 0755
edit_mod.cgi File 2.35 KB 0755
index.cgi File 4.28 KB 0755
install.cgi File 3.61 KB 0755
module.info File 160 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 127 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 178 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 185 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 201 B 0644
module.info.ca File 124 B 0644
module.info.ca.auto File 13 B 0644
module.info.cs File 21 B 0644
module.info.cs.auto File 122 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 129 B 0644
module.info.de File 126 B 0644
module.info.de.auto File 13 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 216 B 0644
module.info.es File 32 B 0644
module.info.es.auto File 104 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 134 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 224 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 114 B 0644
module.info.fr File 28 B 0644
module.info.fr.auto File 115 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 155 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 134 B 0644
module.info.hu File 21 B 0644
module.info.hu.auto File 121 B 0644
module.info.it File 20 B 0644
module.info.it.auto File 107 B 0644
module.info.ja File 29 B 0644
module.info.ja.auto File 171 B 0644
module.info.ko File 20 B 0644
module.info.ko.auto File 110 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 140 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 121 B 0644
module.info.ms File 109 B 0644
module.info.ms.auto File 13 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 126 B 0644
module.info.nl File 28 B 0644
module.info.nl.auto File 114 B 0644
module.info.no File 21 B 0644
module.info.no.auto File 109 B 0644
module.info.pl File 111 B 0644
module.info.pl.auto File 13 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 132 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 141 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 127 B 0644
module.info.ru File 26 B 0644
module.info.ru.auto File 165 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 149 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 112 B 0644
module.info.sv File 21 B 0644
module.info.sv.auto File 101 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 226 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 139 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 185 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 214 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 164 B 0644
module.info.zh File 20 B 0644
module.info.zh.auto File 93 B 0644
module.info.zh_TW File 22 B 0644
module.info.zh_TW.auto File 99 B 0644
postinstall.pl File 239 B 0755
uninstall.cgi File 1.16 KB 0755
uninstall_mods.cgi File 1.33 KB 0755