Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return super(File, self).__repr__()
### list of all records
## PowerPoint stream
class Document(RecordContainer):
recordtype = 1000
class OEPlaceholderAtom(pstruct.type, Record):
recordtype = 3011
_fields_ = [
(uint4, 'placementId'),
(ubyte1, 'placeholderId'),
(ubyte1, 'size')
]
class ExObjRefAtom(pstruct.type, Record):
recordtype = 3009
_fields_ = [
(uint4, 'exObjId')
]
class List(RecordContainer):
recordtype = 1016
class Slide(RecordContainer):
recordtype = 1006
class SSlideLayout(pstruct.type, Record):
recordtype = 1015
_fields_ = [
(sint4, 'geom'),
(dyn.array(ubyte1, 8), 'placeholderId'),
recordtype = 4086
_fields_ = [
(uint4, 'size'),
(dyn.block(4), 'headerToken'),
(dyn.pointer(RecordGeneral), 'offsetToCurrentEdit'),
(uint2, 'lenUserName'),
(uint2, 'docfileversion'),
(ubyte1, 'majorVersion'),
(ubyte1, 'minorVersion'),
(dyn.block(2), 'unused'),
(lambda s: dyn.clone(pstr.string,length=int(s['lenUserName'].l)), 'ansiUserName'),
(uint4, 'relVersion'),
# (lambda s: dyn.clone(pstr.wstring,length=int(s['lenUserName'].l)*2), 'unicodeUserName'),
]
class PSR_ColorSchemeAtom(parray.type, Record):
recordtype = 0x7f0
recordtype = 2032
length = 8
_object_ = uint4
class PSR_HashCodeAtom(pstruct.type, Record):
recordtype = 0x2b00
recordtype = 11008
_fields_ = [(uint4, 'hash')]
class PSR_SlideTimeAtom10(pstruct.type, Record):
recordtype = 0x2eeb
recordtype = 12011
_fields_ = [(uint4, 'dwHighDateTime'),(uint4, 'dwLowDateTime')]
class msofbtTimeNode(pstruct.type, Record):
(__info, 'info'),
(lambda s: dyn.array( dyn.pointer(RecordGeneral), s['info'].l['cPersist'] ), 'offsets')
]
def __repr__(self):
id = 'id:%x'% self['info']['persistId']
addresses = [hex(int(o)) for o in self['offsets']]
return ' '.join( (self.name(), id, 'offsets: [', ','.join(addresses), ']') )
def walk(self):
# heh
for n in self['offsets']:
yield n.d.l['data']
return
class PersistDirectoryAtom(parray.infinite, Record):
recordtype = 6002
recordtype = 0x1772
_object_ = PersistDirectoryEntry
currentsize = 0
def isTerminator(self, value):
s = value.size()
self.currentsize += s
l = self.parent['header']['recLength']
if self.currentsize < int(l):
return False
return True
class CString(ptype.type, Record):
class Handout(RecordContainer):
recordtype = 4041
recordtype = 0x0fc9
### office art
class msofbtExtTimeNodeContainer(RecordContainer):
recordtype = 0xf144
recordtype = 61764
class msofbtTimeConditionContainer(RecordContainer):
recordtype = 0xf125
recordtype = 61733
class msofbtTimeColorBehaviorContainer(RecordContainer):
recordtype = 0xf12c
recordtype = 61740
class msofbtTimeCondition(pstruct.type, Record):
recordtype = 0xf128
recordtype = 61736
class __triggerType(pint.enum, pint.uint32_t):
_fields_ = [
('totNone', 0),
('totVisualElement', 1),
('totTimeNode', 2),
('totRuntimeNodeRef', 3),
('TriggerObjectType_MaxEnumIDs', 4),
]
class __event(pint.enum, pint.uint32_t):
_fields_ = [
('totNone', 0),
('totOnBegin', 1),
recordtype = 6002
recordtype = 0x1772
_object_ = PersistDirectoryEntry
currentsize = 0
def isTerminator(self, value):
s = value.size()
self.currentsize += s
l = self.parent['header']['recLength']
if self.currentsize < int(l):
return False
return True
class CString(ptype.type, Record):
recordtype = 4026
class BinaryTagData(RecordContainer):
recordtype = 5003
class ProgBinaryTag(RecordContainer):
recordtype = 5002
class ProgTags(RecordContainer):
recordtype = 5000
class PST_Notes(RecordContainer):
recordtype = 1008
class PST_PPDrawing(RecordContainer):
recordtype = 1036
(ubyte1, 'size')
]
class ExObjRefAtom(pstruct.type, Record):
recordtype = 3009
_fields_ = [
(uint4, 'exObjId')
]
class List(RecordContainer):
recordtype = 1016
class Slide(RecordContainer):
recordtype = 1006
class SSlideLayout(pstruct.type, Record):
recordtype = 1015
_fields_ = [
(sint4, 'geom'),
(dyn.array(ubyte1, 8), 'placeholderId'),
]
class SlideAtom(pstruct.type, Record):
recordtype = 1007
_fields_ = [
(SSlideLayout, 'layout'),
(sint4, 'masterId'),
(sint4, 'notesId'),
(uint2, 'Flags')
]
class PersistDirectoryEntry(pstruct.type):
('totOnMouseOut', 8),
('totOnNext', 9),
('totOnPrev', 10),
('totOnStopAudio', 11),
('TriggerEventType_MaxEnumIDs', 12),
]
_fields_ = [
(__triggerType, 'triggerType'),
(__event, 'event'),
(pint.uint32_t, 'id'),
(pint.int32_t, 'delay'),
]
### Current User Stream
class PSR_UserEditAtom(pstruct.type, Record):
recordtype = 0x0ff5
recordtype = 4085
_fields_ = [
(sint4, 'lastSlideIDRef'),
(uint2, 'version'),
(ubyte1, 'minorVersion'),
(ubyte1, 'majorVersion'),
(lambda s: dyn.pointer(PSR_UserEditAtom), 'offsetLastEdit'),
(dyn.pointer(RecordGeneral), 'offsetPersistDirectory'),
(uint4, 'docPersistIdRef'),
(uint4, 'persistIdSeed'),
(sint2, 'lastView'),
(dyn.block(2), 'unused'),
]
class RT_CurrentUserAtom(pstruct.type, Record):
]
class List(RecordContainer):
recordtype = 1016
class Slide(RecordContainer):
recordtype = 1006
class SSlideLayout(pstruct.type, Record):
recordtype = 1015
_fields_ = [
(sint4, 'geom'),
(dyn.array(ubyte1, 8), 'placeholderId'),
]
class SlideAtom(pstruct.type, Record):
recordtype = 1007
_fields_ = [
(SSlideLayout, 'layout'),
(sint4, 'masterId'),
(sint4, 'notesId'),
(uint2, 'Flags')
]
class PersistDirectoryEntry(pstruct.type):
class __info(pbinary.littleendian(pbinary.struct)):
_fields_ = [(12, 'cPersist'), (20,'persistId')]
_fields_ = [
(__info, 'info'),
(lambda s: dyn.array( dyn.pointer(RecordGeneral), s['info'].l['cPersist'] ), 'offsets')
]
def lookup(self, type):
'''Return the first instance of specified record type'''
res = [x for x in self if int(x['header']['recType']) == type]
if not res:
raise KeyError(type)
assert len(res) == 1, repr(res)
return res[0]
def walk(self):
for x in self:
yield x['data']
return
class Record(object): pass
class RecordContainer(parray.terminated, Record, searchingcontainer):
_object_ = RecordGeneral
currentsize = maxsize = 0
def isTerminator(self, value):
s = value.size()
self.currentsize += s
if (self.currentsize < self.maxsize):
return False
return True
def __repr__(self):
if self.initialized:
records = []
for v in self.walk():
n = '%s[%x]'%(v.__class__.__name__,v.recordtype)
records.append(n)
(pint.uint8_t, 'Type'),
(__Value, 'Value'),
]
class msofbtTimeBehavior(pstruct.type, Record):
recordtype = 0xf133
recordtype = 61747
_fields_ = [
(pint.uint32_t, 'propertiesUsed'),
(pint.uint32_t, 'tbaddAdditive'),
(pint.uint32_t, 'tbaccAccmulate'),
(pint.uint32_t, 'tbbtTransformType'),
]
class PSR_VisualShapeAtom(pstruct.type, Record):
recordtype = 11003
recordtype = 0x2afb
_fields_ = [
(uint4, 'type'),
(uint4, 'refType'),
(uint4, 'id'),
(sint4, 'data0'),
(sint4, 'data1'),
]
### collect all classes
import inspect
for name,cls in globals().items():
try:
if inspect.isclass(cls) and issubclass(cls, Record) and cls is not Record: