-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
executable file
·45 lines (37 loc) · 928 Bytes
/
test
File metadata and controls
executable file
·45 lines (37 loc) · 928 Bytes
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
44
45
#!/usr/bin/php
<?php
function debug($message) {
fwrite(STDERR, $message."\n");
}
function debug_bytes($data, $start = 0, $max = null) {
$string = '';
if(!isset($max)) {
if(is_array($data))
$max = count($data);
else
$max = strlen($data);
}
for($i = $start; $i < $max; ++$i)
$string .= sprintf('0x%x ', $data[$i+1]);
return $string;
}
include 'OLE/OLEReader.class.php';
include 'OLE/OLEStream.class.php';
include 'Excel/ExcelSymbols.class.php';
include 'Excel/ExcelWorkbook.class.php';
include 'Excel/ExcelWorksheet.class.php';
if($argc > 1) {
$reader = new OLEReader($argv[1]);
$streams = $reader->getStreams();
foreach($streams as $stream) {
if($stream->getName() == 'Workbook') {
debug('Found workbook');
$workbook = new ExcelWorkbook($stream);
foreach($workbook->getWorksheets() as $sheet) {
/* do something with every sheet */
}
}
}
} else {
debug('Usage: parse [file]');
}