-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·43 lines (33 loc) · 1.05 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/php
<?php
/**
* its just small how to example
*/
require_once 'chunkFactory.php';
$fileHandler = fopen('mbr.bin', 'rb');
$chunkFactory = new chunkFactory($fileHandler);
$printablePartitions = [];
try {
$baseTemplate = include('templates/base.php');
$baseData = $chunkFactory->create($baseTemplate);
$partitionTemplate = include('templates/partition.php');
$partitions = [];
foreach (range(1, 4) as $i) {
$partitions[] = $chunkFactory->create($partitionTemplate, $baseTemplate['partition' . $i]['address']);
}
unset($i);
foreach ($partitions as $partition) {
$printablePartitions[] = [
'activity' => $partition->activity,
'type' => $partition->partitionType,
'start' => $partition->firstSectorBias,
'length' => $partition->sectorsCount
];
}
//file_put_contents('bootstrap_code.bin', $baseData->loaderCode);
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
} finally {
fclose($fileHandler);
print_r($printablePartitions);
}