[ Avaa Bypassed ]




Upload:

Command:

www-data@52.15.174.159: ~ $
#!/usr/bin/perl
# edit_part.cgi
# Edit an existing partition, or create a new one

require './fdisk-lib.pl';
&ReadParse();
@dlist = &list_disks_partitions();
$dinfo = $dlist[$in{'disk'}];
&can_edit_disk($dinfo->{'device'}) ||
	&error($text{'edit_ecannot'});
if ($in{'new'}) {
	&ui_print_header($dinfo->{'desc'}, $text{'create_title'}, "");
	}
else {
	&ui_print_header($dinfo->{'desc'}, $text{'edit_title'}, "");
	}

print &ui_form_start("save_part.cgi");
print &ui_table_start($text{'edit_details'}, "width=100%", 4);
print &ui_hidden("disk", $in{'disk'});
print &ui_hidden("part", $in{'part'});
print &ui_hidden("new", $in{'new'});

# Work out the start and end for the new partition
@plist = @{$dinfo->{'parts'}};
if ($in{'new'}) {
	if ($in{'new'} == 1 || $in{'new'} == 3) {
		# Adding a new primary or extended partition
		$np = 1;
		for($i=0; $i<@plist; $i++) {
			if ($plist[$i]->{'number'} == $np) { $np++; }
			push(@start, $plist[$i]->{'start'});
			push(@end, $plist[$i]->{'end'});
			}
		$min = 1;
		$max = $dinfo->{'cylinders'};
		}
	else {
		# Adding a new logical partition (inside the extended partition)
		$np = 5;
		for($i=0; $i<@plist; $i++) {
			if ($plist[$i]->{'number'} == $np) { $np++; }
			if ($plist[$i]->{'extended'}) {
				$min = $plist[$i]->{'start'};
				$max = $plist[$i]->{'end'};
				}
			else {
				push(@start, $plist[$i]->{'start'});
				push(@end, $plist[$i]->{'end'});
				}
			}
		}
	print &ui_hidden("newpart", $np);
	print &ui_hidden("min", $min);
	print &ui_hidden("max", $max);

	# find a gap in the partition map
	for($start=$min; $start<=$max; $start++) {
		$found = 1;
		for($i=0; $i<@start; $i++) {
			if ($start >= $start[$i] && $start <= $end[$i]) {
				$found = 0;
				last;
				}
			}
		if ($found) { last; }
		}
	if ($found) {
		# starting place found.. find the end
		$found = 0;
		for($end=$start; $end<=$max; $end++) {
			for($i=0; $i<@start; $i++) {
				if ($end >= $start[$i] && $end <= $end[$i]) {
					$found = 1;
					last;
					}
				}
			if ($found) { last; }
			}
		$end--;
		}
	else {
		# no place for new partition!
		$start = $end = 0;
		}
	}
else { 
	# Just editing an existing partition
	$pinfo = $plist[$in{'part'}];
	$np = $pinfo->{'number'};
	}
print &ui_hidden("np", $np);

# Describe partition
print &ui_table_row($text{'edit_location'},
	     $dinfo->{'device'} =~ /^\/dev\/(s|h)d([a-z])$/ ?
		&text('select_part', $1 eq 's' ? 'SCSI' : 'IDE', uc($2), $np) :
	     $dinfo->{'device'} =~ /rd\/c(\d+)d(\d+)$/ ?
		&text('select_mpart', "$1", "$2", $np) :
	     $dinfo->{'device'} =~ /ida\/c(\d+)d(\d+)$/ ?
		&text('select_cpart', "$1", "$2", $np) :
	     $dinfo->{'device'} =~ /scsi\/host(\d+)\/bus(\d+)\/target(\d+)\/lun(\d+)\/disc/ ?
		&text('select_spart', "$1", "$2", "$3", "$4", $np) :
	     $dinfo->{'device'} =~ /ide\/host(\d+)\/bus(\d+)\/target(\d+)\/lun(\d+)\/disc/ ?
		&text('select_snewide', "$1", "$2", "$3", "$4", $np) :
		$dinfo->{'device'});

# Device name
$dev = $dinfo->{'prefix'} =~ /^\/dev\/mmcblk.*/ ?
	$dinfo->{'prefix'}.'p'.$np :
	$dinfo->{'prefix'}.$np;
print &ui_table_row($text{'edit_device'}, $dev);

if (!$in{'new'}) {
	@stat = &device_status($dev);
	$mounted = $stat[2];
	}

# Partition type
if ($pinfo->{'extended'} || $in{'new'} == 3) {
	# Extended, cannot change
	print &ui_table_row($text{'edit_type'}, $text{'extended'});
	}
elsif (($pinfo->{'edittype'} == 1 || $in{'new'}) && !$mounted) {
	# Can change
	print &ui_table_row($text{'edit_type'},
		&ui_select("type",
			   $in{'new'} ? &default_tag() : $pinfo->{'type'},
			   [ map { [ $_, &tag_name($_) ] }
				 (sort { &tag_name($a) cmp &tag_name($b) }
				       &list_tags($pinfo->{'dtable'})) ]));
	}
else {
	# Tool doesn't allow change
	print &ui_table_row($text{'edit_type'},
			    &tag_name($pinfo->{'type'}));
		
	}

# Extent and cylinders
if ($in{'new'}) {
	$ext = &ui_textbox("start", $start, 10)." - ".
	       &ui_textbox("end", $end, 10);
	}
else {
	$ext = "$pinfo->{'start'} - $pinfo->{'end'}";
	}
$ext .= " ".$text{'edit_of'}." ".$dinfo->{'cylinders'};
print &ui_table_row($text{'edit_extent'}, $ext);

# Current status
if ($pinfo->{'extended'}) {
	foreach $p (@plist) {
		$ecount++ if ($p->{'number'} > 4);
		}
	if ($ecount == 1) {
		$stat = $text{'edit_cont1'};
		}
	else {
		if ($ecount > 4) {
			$stat = &text('edit_cont5', $ecount);
			}
		else {
			$stat = &text('edit_cont234', $ecount);
			}
		}
	}
elsif (!$in{'new'}) {
	if (@stat) {
		$msg = $mounted ? 'edit_mount' : 'edit_umount';
		$msg .= 'vm' if ($stat[1] eq 'swap');
		$msg .= 'raid' if ($stat[1] eq 'raid');
		$msg .= 'lvm' if ($stat[1] eq 'lvm');
		$msg .= 'iscsi' if ($stat[1] eq 'iscsi');
		$stat = &text($msg, "<tt>$stat[0]</tt>",
				    "<tt>$stat[1]</tt>");
		}
	else {
		$stat = $text{'edit_notused'};
		}
	}
if ($stat) {
	print &ui_table_row($text{'edit_status'}, $stat);
	}

# Partition size
if (!$in{'new'}) {
	print &ui_table_row($text{'edit_size'},
		$pinfo->{'size'} ? &nice_size($pinfo->{'size'})
				 : &text('edit_blocks', $pinfo->{'blocks'}));
	}

# Show field for editing filesystem label
if (($has_e2label || $has_xfs_db) && &supports_label($pinfo) && !$in{'new'}) {
	local $label = $in{'new'} ? undef : &get_label($pinfo->{'device'});
	if (@stat) {
		print &ui_table_row($text{'edit_label'},
			$label ? "<tt>$label</tt>" : $text{'edit_none'});
		}
	else {
		print &ui_table_row($text{'edit_label'},
			&ui_textbox("label", $label, 16));
		}
	}

# Show field for partition name
if (&supports_name($dinfo) && !$mounted && $pinfo->{'edittype'} != 2) {
	print &ui_table_row($text{'edit_name'},
			&ui_textbox("name", $pinfo->{'name'}, 20));
	}

# Show current UUID
if ($has_volid && !$in{'new'}) {
	local $volid = &get_volid($pinfo->{'device'});
	print &ui_table_row($text{'edit_volid'}, "<tt>$volid</tt>", 3);
	}

print &ui_table_end();
if ($in{'new'}) {
	print &ui_form_end([ [ undef, $text{'create'} ] ]);
	}
elsif (@stat && $stat[2] &&
       $pinfo->{'edittype'} != 2) {
	print &ui_form_end();
	print "$text{'edit_inuse'}\n";
	}
elsif ($pinfo->{'edittype'} != 2) {
	print &ui_form_end([ $pinfo->{'extended'} ? ( ) :
				( [ undef, $text{'save'} ] ),
			     [ 'delete', $text{'delete'} ] ]);
	}

if (!$in{'new'} && !$pinfo->{'extended'} && $pinfo->{'edittype'} != 2) {
	my $ui_buttons_content = "";

	if (!@stat || $stat[2] == 0) {
		# Show form for creating filesystem
		local $rt = @stat ? $stat[1] : &conv_type($pinfo->{'type'});
		$ui_buttons_content .= &ui_buttons_row("mkfs_form.cgi",
			$text{'edit_mkfs2'}, $text{'edit_mkfsmsg2'},
			&ui_hidden("dev", $dev),
			&ui_select("type", $rt,
                                [ map { [ $_, $fdisk::text{"fs_".$_}." ($_)" ] }
                                      &fdisk::supported_filesystems() ]));
		}

	if (!$in{'new'} && @stat && $stat[2] == 0 && &can_fsck($stat[1])) {
		# Show form to fsck filesystem
		$ui_buttons_content .= &ui_buttons_row("fsck_form.cgi",
			$text{'edit_fsck'},&text('edit_fsckmsg', "<tt>fsck</tt>"),
			&ui_hidden("dev", $dev)." ".
			&ui_hidden("type", $stat[1]));
		}

	if (!$in{'new'} && @stat && $stat[2] == 0 && &can_tune($stat[1])) {
		# Show form to tune filesystem
		$ui_buttons_content .= &ui_buttons_row("tunefs_form.cgi",
			$text{'edit_tune'}, $text{'edit_tunemsg'},
			&ui_hidden("dev", $dev)." ".
			&ui_hidden("type", $stat[1]));
		}

	@types = &conv_type($pinfo->{'type'});
	if (!$in{'new'} && !@stat && @types) {
		# Show form to mount filesystem
		if ($types[0] eq "swap") {
			# Swap partition
			$ui_buttons_content .= &ui_buttons_row("../mount/edit_mount.cgi",
				$text{'edit_newmount2'},$text{'edit_mountmsg2'},
				&ui_hidden("type", $types[0]).
				&ui_hidden("newdev", $dev));
			}
		else {
			# For some filesystem
			$dirsel = &ui_textbox("newdir", undef, 20);
			if (@types > 1) {
				$dirsel .= $text{'edit_mountas'}." ".
					&ui_select("type", undef, \@types);
				}
			else {
				$dirsel .= &ui_hidden("type", $types[0]);
				}
			$ui_buttons_content .= &ui_buttons_row("../mount/edit_mount.cgi",
				$text{'edit_newmount'}, $text{'edit_mountmsg'},
				&ui_hidden("newdev", $dev),
				$dirsel);
			}
		}

	if ($ui_buttons_content) {
		print &ui_hr();
		print &ui_buttons_start();
		print $ui_buttons_content;
		print &ui_buttons_end();
		}
	}
elsif (!$mounted && $pinfo->{'edittype'} == 2) {
	my $label = $config{'mode'} eq 'fdisk' ? 'edit_eparted2' : 'edit_eparted';
	print $text{$label},"\n";
	}

&ui_print_footer("edit_disk.cgi?device=$dinfo->{'device'}",
		 $text{'disk_return'});


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 1.92 KB 0644
acl_security.pl File 958 B 0755
apply_hdparm.cgi File 1.17 KB 0755
blink.cgi File 384 B 0755
cgi_args.pl File 483 B 0755
config File 13 B 0644
config.info File 144 B 0644
config.info.bg File 235 B 0644
config.info.ca File 167 B 0644
config.info.de File 148 B 0644
config.info.fr File 167 B 0644
config.info.nl File 138 B 0644
config.info.no File 151 B 0644
defaultacl File 26 B 0644
edit_disk.cgi File 4.91 KB 0755
edit_hdparm.cgi File 4.36 KB 0755
edit_part.cgi File 8.26 KB 0755
edit_relabel.cgi File 1.32 KB 0755
fdisk-lib.pl File 48.16 KB 0755
feedback_files.pl File 115 B 0755
fsck.cgi File 604 B 0755
fsck_form.cgi File 700 B 0755
index.cgi File 2.41 KB 0755
log_parser.pl File 1.53 KB 0755
make_tags.pl File 210 B 0755
mkfs.cgi File 820 B 0755
mkfs_form.cgi File 832 B 0755
module.info File 238 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 153 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 209 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 249 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 236 B 0644
module.info.ca File 119 B 0644
module.info.ca.auto File 29 B 0644
module.info.cs File 40 B 0644
module.info.cs.auto File 130 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 149 B 0644
module.info.de File 131 B 0644
module.info.de.auto File 26 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 299 B 0644
module.info.es File 38 B 0644
module.info.es.auto File 112 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 146 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 233 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 149 B 0644
module.info.fr File 35 B 0644
module.info.fr.auto File 133 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 188 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 160 B 0644
module.info.hu File 79 B 0644
module.info.hu.auto File 26 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 152 B 0644
module.info.ja File 58 B 0644
module.info.ja.auto File 179 B 0644
module.info.ko File 36 B 0644
module.info.ko.auto File 137 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 163 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 167 B 0644
module.info.ms File 120 B 0644
module.info.ms.auto File 23 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 153 B 0644
module.info.nl File 39 B 0644
module.info.nl.auto File 111 B 0644
module.info.no File 38 B 0644
module.info.no.auto File 112 B 0644
module.info.pl File 38 B 0644
module.info.pl.auto File 120 B 0644
module.info.pt File 37 B 0644
module.info.pt.auto File 116 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 162 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 157 B 0644
module.info.ru File 60 B 0644
module.info.ru.auto File 185 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 166 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 155 B 0644
module.info.sv File 28 B 0644
module.info.sv.auto File 116 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 303 B 0644
module.info.tr File 34 B 0644
module.info.tr.auto File 123 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 245 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 266 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 187 B 0644
module.info.zh File 27 B 0644
module.info.zh.auto File 104 B 0644
module.info.zh_TW File 33 B 0644
module.info.zh_TW.auto File 110 B 0644
range.js File 4.7 KB 0644
reboot.cgi File 261 B 0755
relabel.cgi File 417 B 0755
save_part.cgi File 3.75 KB 0755
slider.js File 14.48 KB 0644
timer.js File 2.86 KB 0644
tunefs.cgi File 689 B 0755
tunefs_form.cgi File 722 B 0755
winclassic.css File 1.72 KB 0644