Menu

[4954d9]: / addons / dumpcdi11702.py  Maximize  Restore  History

Download this file

56 lines (38 with data), 1.5 kB

 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
46
47
48
49
50
51
52
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
dumpcdi11702, GDITools or CDITools?
Uses gditools to extract a 11702 CDI file.
Should work for most 11702 CDI file, but wasn't tested much.
It should be possible to extract most CDI by tweaking the offset and
wormhole parameters. The proof is left as an exercise to the reader.
FamilyGuy 2020
dumpcdi11702.py is released under the GNU General Public License
(version 3), a copy of which (GNU_GPL_v3.txt) is provided in the
license folder.
"""
import os,sys
sys.path.append('..')
from gditools import ISO9660
def main(filename):
a = [dict(
filename=os.path.abspath(filename),
mode=2336,
offset=11702*2048 - 1239040,
wormhole=[0, 11702*2048, 32*2048],
manualRawOffset=224,
lba=45000, # Required to trick ISO9660 class, isn't actually used.
tnum=0 # Idem
),] # List to trick ISO9660 class, need to fix for clean CDI support.
b = ISO9660(a, verbose=True)
for i in b._sorted_records('EX_LOC'):
if not i['name'] in ['/0.0', '/DUMMY.DAT']:
b.dump_file_by_record(i, './data')
#b.dump_file_by_record(i, './'+b.get_pvd()['volume_identifier'])
b.dump_sorttxt()
b.dump_bootsector(lba=11702)
if __name__ == '__main__':
if len(sys.argv) == 2:
main(sys.argv[1])
else:
print('dumpcdi11702.py - Based on gditools\n\nError: Bad syntax\n\nUsage: dumpcdi11702.py image.cdi')