[ Avaa Bypassed ]




Upload:

Command:

www-data@3.148.237.97: ~ $
#!/usr/bin/perl
# Actually execute the restore

require './bacula-backup-lib.pl';
&ReadParse();
&error_setup($text{'restore_err'});
$dbh = &connect_to_database();

# Validate inputs
@files = split(/\r?\n/, $in{'files'});
@files || &error($text{'restore_efiles'});
$in{'where'} =~ s/\\/\//g;
$in{'where_def'} || $in{'where'} =~ /^([a-zA-Z]:)?\// ||
	&error($text{'restore_ewhere'});
$in{'client'} || &error($text{'restore_eclient'});
if ($in{'job'} =~ /^nj_(.*)_(\d+)_(\d+)$/) {
	# Node group job restore ..
	$in{'client'} eq "*" || &error($text{'restore_eall1'});
	$name = $1;
	$time = $2;
	}
else {
	# Single job restore
	$in{'client'} eq "*" && &error($text{'restore_eall2'});

	# Get the job name
	$cmd = $dbh->prepare("select Name from Job where JobId = ?");
	$cmd->execute($in{'job'});
	($name) = $cmd->fetchrow();
	$cmd->finish();
	}

# Work out clients to restore to
if ($in{'client'} eq "*") {
	# Clients that were originally backed up
	$cmd = $dbh->prepare("select Job.JobId,Job.Name,Job.SchedTime,Client.Name from Job,Client where Job.Name not like 'Restore%' and Job.ClientId = Client.ClientId order by SchedTime desc");
	$cmd->execute();
	while(my ($jid, $jname, $jwhen, $jclient) = $cmd->fetchrow()) {
		($j, $c) = &is_oc_object($jname);
		$stime = &date_to_unix($jwhen);
		if ($j && $c && $j eq $name) {
			if (abs($stime - $time) < 30) {
				# Found a member of the group
				push(@clients, [ $jclient, $jid ]);
				}
			}
		}
	$cmd->finish();
	@clients || &error($text{'restore_eclients'});
	&ui_print_unbuffered_header(undef,  $text{'restore_title3'}, "", "restore");
	}
elsif ($g = &is_oc_object($in{'client'})) {
	# All clients in a node group
	($group) = grep { $_->{'name'} eq $g } &list_node_groups();
	$group || &error($text{'restore_egroup'});
	@clients = map { [ "occlient_${g}_".$_, $in{'job'} ] } @{$group->{'members'}};
	&ui_print_unbuffered_header(undef,  $text{'restore_title2'}, "", "restore");
	}
else {
	# Just one
	&ui_print_unbuffered_header(undef,  $text{'restore_title'}, "", "restore");
	@clients = ( [ $in{'client'}, $in{'job'} ] );
	}

$dbh->disconnect();

foreach $clientjob (@clients) {
	$client = $clientjob->[0];
	$job = $clientjob->[1];
	($g, $c) = &is_oc_object($name);
	($gc, $cc) = &is_oc_object($client);
	print "<b>",&text('restore_run', $c ? "<tt>$c</tt>" : "<tt>$name</tt>", $cc ? "<tt>$cc</tt>" : "<tt>$client</tt>", "<tt>$in{'storage'}</tt>"),"</b>\n";
	print "<pre>";
	$h = &open_console();

	# Clear messages
	&console_cmd($h, "messages");

	# Start the restore process
	&sysprint($h->{'infh'}, "restore client=$client jobid=$job storage=$in{'storage'}".($in{'where_def'} ? "" : " where=\"$in{'where'}\"")."\n");
	&wait_for($h->{'outfh'}, 'restore.*\n');
	print $wait_for_input;
	$rv = &wait_for($h->{'outfh'}, 'Enter\s+"done".*\n',
				       'Unable to get Job record',
				       'all the files');
	print $wait_for_input;
	if ($rv == 1) {
		&job_error($text{'restore_ejob'});
		}
	elsif ($rv == 2) {
		&job_error($text{'restore_ejobfiles'});
		}

	# Select the files
	&wait_for($h->{'outfh'}, "\\\$");	# Wait for first prompt
	print $wait_for_input;
	foreach $f (@files) {
		$f = &unix_to_dos($f);
		if ($f eq "/") {
			&sysprint($h->{'infh'}, "cd /\n");
			&wait_for($h->{'outfh'}, "\\\$");
			print $wait_for_input;

			&sysprint($h->{'infh'}, "mark *\n");
			&wait_for($h->{'outfh'}, "\\\$");
			print $wait_for_input;
			}
		elsif ($f =~ /^(.*)\/([^\/]+)\/?$/) {
			local ($fd, $ff) = ($1, $2);
			$fd ||= "/";
			&sysprint($h->{'infh'}, "cd \"$fd\"\n");
			&wait_for($h->{'outfh'}, "\\\$");
			print $wait_for_input;

			&sysprint($h->{'infh'}, "mark \"$ff\"\n");
			&wait_for($h->{'outfh'}, "\\\$");
			print $wait_for_input;
			}
		}
	&sysprint($h->{'infh'}, "done\n");
	$rv = &wait_for($h->{'outfh'}, 'OK to run.*:', 'no files selected',
				       'Select Restore Job.*:');
	print $wait_for_input;
	if ($rv == 0) {
		&sysprint($h->{'infh'}, "yes\n");
		}
	elsif ($rv == 1) {
		&job_error($text{'restore_enofiles'});
		}
	elsif ($rv == 2) {
		&sysprint($h->{'infh'}, "1\n");
		&wait_for($h->{'outfh'}, 'OK to run.*:');
		&sysprint($h->{'infh'}, "yes\n");
		}
	else {
		&job_error($text{'backup_eok'});
		}
	print "</pre>\n";

	if ($in{'wait'}) {
		# Wait till we have a status
		print "</pre>\n";
		print "<b>",$text{'restore_running'},"</b>\n";
		print "<pre>";
		while(1) {
			$out = &console_cmd($h, "messages");
			if ($out !~ /You\s+have\s+no\s+messages/i) {
				print $out;
				}
			if ($out =~ /Termination:\s+(.*)/) {
				$status = $1;
				last;
				}
			sleep(1);
			}
		print "</pre>\n";
		if ($status =~ /Restore\s+OK/i && $status !~ /warning/i) {
			print "<b>",$text{'restore_done'},"</b><p>\n";
			}
		else {
			print "<b>",$text{'restore_failed'},"</b><p>\n";
			}
		}
	else {
		# Let it fly
		print "<b>",$text{'restore_running2'},"</b><p>\n";
		}

	&close_console($h);
	}

&webmin_log("restore", $in{'job'});

&ui_print_footer("restore_form.cgi", $text{'restore_return'});

sub job_error
{
&close_console($h);
print "</pre>\n";
print "<b>",@_,"</b><p>\n";
&ui_print_footer("backup_form.cgi", $text{'backup_return'});
exit;
}


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
jstree Folder 0755
lang Folder 0755
CHANGELOG File 1.06 KB 0644
Makefile File 130 B 0644
apply.cgi File 214 B 0755
backup.cgi File 1.76 KB 0755
backup_config.pl File 600 B 0644
backup_form.cgi File 806 B 0755
bacula-backup-lib.pl File 43.51 KB 0755
bootup.cgi File 363 B 0755
cancel_jobs.cgi File 674 B 0755
clientstatus_form.cgi File 2.51 KB 0755
config File 138 B 0644
config-syno-linux File 136 B 0644
config-windows File 151 B 0644
config.info File 871 B 0644
config.info.ca File 1.02 KB 0644
config.info.de File 947 B 0644
config.info.fr File 0 B 0644
config.info.ms File 1019 B 0644
config.info.nl File 872 B 0644
config.info.no File 951 B 0644
config.info.pl File 998 B 0644
config.info.pt_BR File 0 B 0644
config.info.ru File 1.17 KB 0644
delete_clients.cgi File 749 B 0755
delete_devices.cgi File 650 B 0755
delete_fdirectors.cgi File 653 B 0755
delete_filesets.cgi File 761 B 0755
delete_gjobs.cgi File 830 B 0755
delete_groups.cgi File 917 B 0755
delete_jobs.cgi File 735 B 0755
delete_pools.cgi File 732 B 0755
delete_schedules.cgi File 773 B 0755
delete_sdirectors.cgi File 666 B 0755
delete_storages.cgi File 768 B 0755
delete_volumes.cgi File 566 B 0755
dirstatus_form.cgi File 2.3 KB 0755
edit_client.cgi File 2.51 KB 0755
edit_device.cgi File 2.2 KB 0755
edit_director.cgi File 1.46 KB 0755
edit_fdirector.cgi File 1.4 KB 0755
edit_file.cgi File 1.11 KB 0755
edit_fileset.cgi File 2.31 KB 0755
edit_gjob.cgi File 4.41 KB 0755
edit_group.cgi File 2.56 KB 0755
edit_job.cgi File 5.34 KB 0755
edit_pool.cgi File 2.62 KB 0755
edit_schedule.cgi File 2.08 KB 0755
edit_sdirector.cgi File 1.4 KB 0755
edit_storage.cgi File 2.86 KB 0755
edit_storagec.cgi File 1.25 KB 0755
fixaddr.cgi File 481 B 0755
fixpass.cgi File 513 B 0755
gbackup.cgi File 1.59 KB 0755
index.cgi File 6.13 KB 0755
install_check.pl File 450 B 0755
label.cgi File 1.49 KB 0755
label_form.cgi File 974 B 0755
list.cgi File 3.21 KB 0755
list_clients.cgi File 1.29 KB 0755
list_devices.cgi File 1.27 KB 0755
list_fdirectors.cgi File 1.34 KB 0755
list_filesets.cgi File 1.31 KB 0755
list_gbackup.cgi File 814 B 0755
list_gjobs.cgi File 1.52 KB 0755
list_grestore.cgi File 1.62 KB 0755
list_groups.cgi File 1.78 KB 0755
list_jobs.cgi File 1.68 KB 0755
list_pools.cgi File 1.23 KB 0755
list_schedules.cgi File 1.26 KB 0755
list_sdirectors.cgi File 1.34 KB 0755
list_storages.cgi File 1.39 KB 0755
list_sync.cgi File 795 B 0755
log_parser.pl File 1000 B 0755
manual.sxw File 24.8 KB 0644
module.info File 194 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 146 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 279 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 291 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 236 B 0644
module.info.ca File 193 B 0644
module.info.cs File 0 B 0644
module.info.cs.auto File 173 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 171 B 0644
module.info.de File 167 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 338 B 0644
module.info.es File 0 B 0644
module.info.es.auto File 173 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 161 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 271 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 196 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 186 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 205 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 164 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 202 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 155 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 230 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 182 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 194 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 161 B 0644
module.info.ms File 172 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 156 B 0644
module.info.nl File 30 B 0644
module.info.nl.auto File 127 B 0644
module.info.no File 28 B 0644
module.info.no.auto File 136 B 0644
module.info.pl File 186 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 165 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 171 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 175 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 336 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 183 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 154 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 171 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 361 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 201 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 289 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 269 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 200 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 127 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 133 B 0644
mount.cgi File 916 B 0755
mount_form.cgi File 885 B 0755
poolstatus_form.cgi File 1.96 KB 0755
restart.cgi File 196 B 0755
restore.cgi File 4.99 KB 0755
restore_form.cgi File 3.53 KB 0755
save_client.cgi File 2.42 KB 0755
save_device.cgi File 2.04 KB 0755
save_director.cgi File 1.15 KB 0755
save_fdirector.cgi File 1.57 KB 0755
save_file.cgi File 1.01 KB 0755
save_fileset.cgi File 2.7 KB 0755
save_gjob.cgi File 2.93 KB 0755
save_group.cgi File 2.33 KB 0755
save_job.cgi File 2.91 KB 0755
save_pool.cgi File 2.36 KB 0755
save_schedule.cgi File 1.76 KB 0755
save_sdirector.cgi File 1.57 KB 0755
save_storage.cgi File 2.43 KB 0755
save_storagec.cgi File 1.07 KB 0755
save_sync.cgi File 737 B 0755
schedule_chooser.cgi File 2.89 KB 0755
schedule_select.cgi File 928 B 0755
start.cgi File 187 B 0755
stop.cgi File 183 B 0755
storagestatus_form.cgi File 2.57 KB 0755
sync.pl File 408 B 0755
treechooser.cgi File 2.03 KB 0755