mount

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<?php
$text = shell_exec("fdisk -l ".$argv[1]." 2>/dev/null");
$c = preg_match_all("/([^\n]+)\s+(\d+)\s+(\d+)\s+(\d+)\+?\s+(\d+)\s+([^\n]+)/sui", $text, $m);
for ($i = 0; $i < $c; ++$i) {
$path = "/tmp/mnt/".$argv[2]."/".$i;
echo "\n\n\n";
system("mkdir -p ".$path);
system("mount -o ro,loop,noload,offset=".($m[2][$i] * 512)." ".$argv[1]." ".$path."");
}
# mount -v -t ext3 /path/to/disk.img /mount/point -o loop,offset=2155023360,size-limit=403581587968