[ Avaa Bypassed ]




Upload:

Command:

www-data@3.148.237.97: ~ $
#!/usr/bin/perl
# save.cgi
# Create, update or delete a PPTP tunnel

require './pptp-client-lib.pl';
&ReadParse();
@tunnels = &list_tunnels();
@secs = &list_secrets();
if (!$in{'new'}) {
	($tunnel) = grep { $_->{'name'} eq $in{'old'} } @tunnels;
	&parse_comments($tunnel);
	$name = &find("name", $tunnel->{'opts'});
	$remote = &find("remotename", $tunnel->{'opts'});
	$sec = &find_secret($name ? $name->{'value'} : &get_system_hostname(1),
			    $remote ? $remote->{'value'} : undef);
	&lock_file($tunnel->{'file'});
	}
else {
	$tunnel = { 'opts' => [ ] };
	}
&error_setup($text{'save_err'});
&lock_file($config{'pap_file'});

if ($in{'delete'}) {
	# Just delete this tunnel and it's secret (if not used by any other)
	unlink($tunnel->{'file'});
	}
else {
	# Validate inputs
	$in{'tunnel'} =~ /\S/ || &error($text{'save_ename'});
	&to_ipaddress($in{'server'}) || &error($text{'save_eserver'});
	$in{'login_def'} || $in{'login'} =~ /^\S+$/ ||
		&error($text{'save_elogin'});
	$in{'remote_def'} || $in{'remote'} =~ /^\S+$/ ||
		&error($text{'save_eremote'});
	$in{'file_def'} < 2 || -r $in{'file'} ||
		&error($text{'save_efile'});

	# Add default route changes
	if ($in{'deldef'}) {
		push(@routes, "delete default");
		}
	if ($in{'adddef'} == 1) {
		push(@routes, "add default dev TUNNEL_DEV");
		}
	elsif ($in{'adddef'} == 2) {
		&to_ipaddress($in{'def'}) || &error($text{'save_edef'});
		push(@routes, "add default gw ".$in{'def'});
		}

	# Parse and add extra route commands
	$in{'unknown'} =~ s/\r//g;
	push(@routes, grep { /\S/ } split(/\n/, $in{'unknown'}));

	# Parse and add static routes
	for($i=0; defined($t = $in{"type_$i"}); $i++) {
		next if (!$t);
		if ($t == 1) {
			&check_ipaddress($in{"net_$i"}) ||
				&error(&text('save_enet', $i+1));
			&check_ipaddress($in{"mask_$i"}) ||
				&error(&text('save_emask', $i+1));
			$in{"gw_def_$i"} || &check_ipaddress($in{"gw_$i"}) ||
				&error(&text('save_egw', $i+1));
			if ($in{"gw_def_$i"}) {
				push(@routes,
				    sprintf("add -net %s dev %s netmask %s",
					$in{"net_$i"}, 'TUNNEL_DEV',
					$in{"mask_$i"}));
				}
			else {
				push(@routes,
				    sprintf("add -net %s gw %s netmask %s",
					$in{"net_$i"}, $in{"gw_$i"},
					$in{"mask_$i"}));
				}
			}
		else {
			&check_ipaddress($in{"net_$i"}) ||
				&error(&text('save_ehost', $i+1));
			$in{"mask_$i"} && &error(&text('save_emask2', $i+1));
			$in{"gw_def_$i"} || &check_ipaddress($in{"gw_$i"}) ||
				&error(&text('save_egw2', $i+1));
			if ($in{"gw_def_$i"}) {
				push(@routes,
				    sprintf("add -host %s dev %s",
					$in{"net_$i"}, 'TUNNEL_DEV'));
				}
			else {
				push(@routes,
				    sprintf("add -host %s gw %s",
					$in{"net_$i"}, $in{"gw_$i"}));
				}
			}
		}


	mkdir($config{'peers_dir'}, 0755);
	if ($in{'new'}) {
		&check_clash();

		# Create file and set default options
		$tunnel->{'name'} = $in{'tunnel'};
		$tunnel->{'file'} = "$config{'peers_dir'}/$in{'tunnel'}";
		&lock_file($tunnel->{'file'});
		&save_ppp_option($tunnel->{'opts'}, $tunnel->{'file'}, undef,
				 { 'comment' => "PPTP Tunnel configuration for tunnel $in{'tunnel'}" });
		}
	else {
		# Check for a re-name
		if ($in{'tunnel'} ne $tunnel->{'name'}) {
			&check_clash();
			$tunnel->{'name'} = $in{'tunnel'};
			$nf = "$config{'peers_dir'}/$in{'tunnel'}";
			rename($tunnel->{'file'}, $nf) ||
				&error($text{'save_erename'});
			$tunnel->{'file'} = $nf;
			}
		}

	# Save server IP
	&save_ppp_option($tunnel->{'opts'}, $tunnel->{'file'},
			 $tunnel->{'server_c'},
			 { 'comment' => "Server IP: $in{'server'}" } );

	# Save all routes
	@or = @{$tunnel->{'routes_c'}};
	for($i=0; $i<@routes || $i<@or; $i++) {
		&save_ppp_option($tunnel->{'opts'}, $tunnel->{'file'},
				 $or[$i], $routes[$i] ?
					{ 'comment' => "Route: $routes[$i]" } : undef);
		}

	# Save PPP options
	&save_ppp_option($tunnel->{'opts'}, $tunnel->{'file'}, "name",
			 $in{'login_def'} ? undef :
			 { 'name' => 'name', 'value' => $in{'login'} } );
	&save_ppp_option($tunnel->{'opts'}, $tunnel->{'file'}, "remotename",
			 $in{'remote_def'} ? undef :
			 { 'name' => 'remotename','value' => $in{'remote'} } );
	&save_ppp_option($tunnel->{'opts'}, $tunnel->{'file'}, "file",
			 $in{'file_def'} == 0 ? undef :
			 $in{'file_def'} == 1 ? 
				{ 'name' => 'file',
				  'value' => $config{'pptp_options'} } :
				{ 'name' => 'file',
				  'value' => $in{'file'} });
	&parse_mppe_options($tunnel->{'opts'}, $tunnel->{'file'});

	# Update or add to the secrets file
	$newname = $in{'login_def'} ? &get_system_hostname(1) : $in{'login'};
	$newremote = $in{'remote_def'} ? "*" : $in{'remote'};
	if (!$sec) {
		# No old secret was found, so look for one matching the new
		# details
		$sec = &find_secret($newname, $newremote);
		}
	if ($sec) {
		# Just update the secret for our login name with the new login
		# and password. This can happen when re-naming, or if a secret
		# for the name already exists
		$sec->{'client'} = $newname;
		if ($sec->{'server'} ne '*' && $newremote ne '*') {
			$sec->{'server'} = $newremote;
			}
		$sec->{'secret'} = $in{'spass'};
		&change_secret($sec);
		}
	else {
		# Need to create a new secret
		$sec = { 'client' => $newname,
			 'secret' => $in{'spass'},
			 'server' => $newremote };
		&create_secret($sec);
		}

	&flush_file_lines();
	}
&unlock_file($tunnel->{'file'});
&unlock_file($config{'pap_file'});

&webmin_log($in{'new'} ? "create" : $in{'delete'} ? "delete" : "update",
	    "tunnel", $tunnel->{'name'});
&redirect("");

sub check_clash
{
-r "$config{'peers_dir'}/$in{'tunnel'}" && &error($text{'save_eclash'});
}

# find_secret(client, server)
# Returns the best matching secret with the given details
sub find_secret
{
local ($exact) = grep { $_->{'client'} eq $_[0] &&
			$_->{'server'} eq $_[1] } @secs;
return $exact if ($exact);
local ($client) = grep { $_->{'client'} eq $_[0] } @secs;
return $client;
}


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 448 B 0644
backup_config.pl File 702 B 0755
bootup.cgi File 863 B 0755
config File 112 B 0644
config.info File 274 B 0644
config.info.ca File 310 B 0644
config.info.de File 306 B 0644
config.info.fr File 0 B 0644
config.info.nl File 297 B 0644
config.info.no File 292 B 0644
config.info.pt_BR File 320 B 0644
conn.cgi File 2.32 KB 0755
disc.cgi File 543 B 0755
edit.cgi File 6.59 KB 0755
edit_opts.cgi File 1.43 KB 0755
index.cgi File 2.69 KB 0755
install_check.pl File 385 B 0755
log_parser.pl File 733 B 0755
module.info File 193 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 139 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 150 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 192 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 194 B 0644
module.info.ca File 116 B 0644
module.info.ca.auto File 13 B 0644
module.info.cs File 24 B 0644
module.info.cs.auto File 102 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 134 B 0644
module.info.de File 121 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 0 B 0644
module.info.es.auto File 132 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 132 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 175 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 123 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 137 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 134 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 130 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 151 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 133 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 161 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 156 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 133 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 136 B 0644
module.info.ms File 118 B 0644
module.info.ms.auto File 13 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 138 B 0644
module.info.nl File 24 B 0644
module.info.nl.auto File 111 B 0644
module.info.no File 24 B 0644
module.info.no.auto File 109 B 0644
module.info.pl File 0 B 0644
module.info.pl.auto File 128 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 129 B 0644
module.info.pt_BR File 28 B 0644
module.info.pt_BR.auto File 110 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 130 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 198 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 124 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 128 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 129 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 246 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 194 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 244 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 150 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 110 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 119 B 0644
pptp-client-lib.pl File 8.62 KB 0755
save.cgi File 5.72 KB 0755
save_opts.cgi File 910 B 0755
secrets-lib.pl File 1.64 KB 0755
start.pl File 779 B 0755
stop.pl File 355 B 0755