__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

8je����SrSSKJr SrSrSr/SQrSSKrSSKrSSK	r	SSK
r
SSKrSSK
r
SSKrSSKrSSKr\\La\r\r\
R"S5R2S	:XaSrON\
R"S
5R2S	:XaS
rO+\
R"S5R2S	:XaSrO\"S5e\ \R<SS
:aSrOSr\R@S-4Sjr!\!"S5r"Sr#Sr$Sr%Sr&Sr'Sr(Sr)Sr*Sr+Sr,Sr-Sr.S
r/S	r0Sr1Sr2Sr3Sr4Sr5S
r6S	r7Sr8Sr9Sr:Sr;Sr<S r=S!r>S"r?S#r@S$rAS%rBS&rCS'rDS(rES)rFS*rGS+rHS,rIS-rJS.rKS/rLS0rMS1rNS2rOS3rPS4rQS5rRS6rSS7rTS8rUS9rVS:rWS;rXS<rYS=rZS>r[0r\\]"\^"5R�55Hur`ra\`SS
S?:XdM\`\\\a'M S@rbS rcS)rdS3reSArfSBrgSZSCjrh\\LaSDriOSEriS[SFjrjS[SGjrkSHrlSIrm"SJSK\n5ro"SLSM\o5rp"SNSO5rq"SPSQ\r5rs"SRSS\R�5ru"STSU5rv"SVSW5rwSXrx\ySY:Xa\x"5 gg!\a \rGN�f=f!\a \rGN�f=f)\a:
olefile (formerly OleFileIO_PL)

Module to read/write Microsoft OLE2 files (also called Structured Storage or
Microsoft Compound Document File Format), such as Microsoft Office 97-2003
documents, Image Composer and FlashPix files, Outlook messages, ...
This version is compatible with Python 2.7 and 3.5+

Project website: https://www.decalage.info/olefile

olefile is copyright (c) 2005-2023 Philippe Lagadec
(https://www.decalage.info)

olefile is based on the OleFileIO module from the PIL library v1.1.7
See: http://www.pythonware.com/products/pil/index.htm
and http://svn.effbot.org/public/tags/pil-1.1.7/PIL/OleFileIO.py

The Python Imaging Library (PIL) is
Copyright (c) 1997-2009 by Secret Labs AB
Copyright (c) 1995-2009 by Fredrik Lundh

See source code and LICENSE.txt for information on usage and redistribution.
�)�print_functionz
2023-12-01z0.47zPhilippe Lagadec)�	isOleFile�	OleFileIO�OleMetadata�enable_logging�MAGIC�STGTY_EMPTY�STGTY_STREAM�
STGTY_STORAGE�
STGTY_ROOT�STGTY_PROPERTY�STGTY_LOCKBYTES�MINIMAL_OLEFILE_SIZE�
DEFECT_UNSURE�DEFECT_POTENTIAL�DEFECT_INCORRECT�DEFECT_FATAL�DEFAULT_PATH_ENCODING�
MAXREGSECT�DIFSECT�FATSECT�
ENDOFCHAIN�FREESECT�	MAXREGSID�NOSTREAM�UNKNOWN_SIZE�
WORD_CLSID�OleFileIONotClosedN�L��I�iz>Need to fix a bug with 32 bit arrays, please contact author...�zutf-8�c�>�U[RRR;a)[R"U5nURU5 U$[R"U5nUR
[R"55 URU5 U$)aR
Create a suitable logger object for this module.
The goal is not to change settings of the root logger, to avoid getting
other modules' logs on the screen.
If a logger exists with same name, reuse it. (Else it would have duplicate
handlers and messages would be doubled.)
The level is set to CRITICAL+1 by default, to avoid any logging.
)�logging�Logger�manager�
loggerDict�	getLogger�setLevel�
addHandler�NullHandler)�name�level�loggers   �1/usr/lib/python3/dist-packages/olefile/olefile.py�
get_loggerr2�sy���w�~�~�%�%�0�0�0��"�"�4�(��������
�
�
�
�t�
$�F����g�)�)�+�,�
�O�O�E���M��olefilec�J�[R[R5 g)z�
Enable logging for this module (disabled by default).
This will set the module-specific logger level to NOTSET, which
means the main application controls the actual logging level.
N)�logr+r&�NOTSET�r3r1rr�s���L�L���� r3s��ࡱ�l��l��l��l�������i�������	�
���
������������������@�A�B�C�D�E�F�G�H��VT_z$00020900-0000-0000-C000-000000000046�(ic��SnUb'[U5[:�aUS[[5nO�g[US5(aA[US5(a0UR	[[55nURS5 On[
U[5(a&[U5[:�aUS[[5nO3[US5nUR	[[55nSSS5 U[:Xagg!,(df   N=f)a�
Test if a file is an OLE container (according to the magic bytes in its header).

.. note::
    This function only checks the first 8 bytes of the file, not the
    rest of the OLE structure.
    If data is provided, it also checks if the file size is above
    the minimal size of an OLE file (1536 bytes).
    If filename is provided with the path of the file on disk, the file is
    open only to read the first 8 bytes, then closed.

.. versionadded:: 0.16

:param filename: filename, contents or file-like object of the OLE file (string-like or file-like object)

    - if data is provided, filename is ignored.
    - if filename is a unicode string, it is used as path of the file to open on disk.
    - if filename is a bytes string smaller than 1536 bytes, it is used as path
      of the file to open on disk.
    - [deprecated] if filename is a bytes string longer than 1535 bytes, it is parsed
      as the content of an OLE file in memory. (bytes type only)
      Note that this use case is deprecated and should be replaced by the new data parameter
    - if filename is a file-like object (with read and seek methods),
      it is parsed as-is.
:type filename: bytes, str, unicode or file-like object

:param data: bytes string with the contents of the file to be checked, when the file is in memory
             (added in olefile 0.47)
:type data: bytes

:returns: True if OLE, False otherwise.
:rtype: bool
NF�read�seekr�rbT)	�lenrr�hasattrrbrc�
isinstance�bytes�open)�filename�data�header�fps    r1rrs���D�F����t�9�,�,��+�3�u�:�&�F��	��6�	"�	"�w�x��'@�'@����s�5�z�*���
�
�a��	�H�e�	$�	$��X��:N�)N��+�3�u�:�&���(�D�
!�R��W�W�S��Z�(�F�"�
�����"�
!�s�C9�9
Dc��[U5$�N)�ord��cs r1�i8rsOs���1�v�
r3c�6�UR[LaU$US$)Nr)�	__class__�intrqs r1rsrsSs���K�K�3�&�q�0�A�a�D�0r3c�@�[R"SXUS-5S$)z�
Converts a 2-bytes (16 bits) string to an integer.

:param c: string containing bytes to convert
:param o: offset of bytes to convert in string
z<Hr:r��struct�unpack�rr�os  r1�i16r}W�"���=�=��q�1�Q�3�x�(��+�+r3c�@�[R"SXUS-5S$)z�
Converts a 4-bytes (32 bits) string to an integer.

:param c: string containing bytes to convert
:param o: offset of bytes to convert in string
z<Ir rrxr{s  r1�i32r�ar~r3c
���[U5S:XdeURS5(dgS[US5[US5[US54[	[[USS55--$)	zR
Converts a CLSID to a human-readable string.

:param clsid: string of length 16.
rE��z0%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02Xrr r<r>)re�stripr�r}�tuple�maprs)�clsids r1�_clsidr�ksm���u�:������;�;�u����
4��%��m�S���]�C��q�M�
:��#�b�%��"�+�&�'�(�
)�*r3c�l�[R"SSSSSS5nU[R"US-S9-$)z<
convert FILETIME (64 bits int) to Python datetime.datetime
�Ar$rr@��microseconds)�datetime�	timedelta)�filetime�_FILETIME_null_dates  r1�filetime2datetimer�|s9��#�+�+�D�!�Q��1�a�@����!3�!3��2��!N�N�Nr3c��\rSrSrSrSrg)�OleFileErrori�z%
Generic base error for this module.
r8N��__name__�
__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r8r3r1r�r������	r3r�c��\rSrSrSrSrg)�NotOleFileErrori�z7
Error raised when the opened file is not an OLE file.
r8Nr�r8r3r1r�r��r�r3r�c�:�\rSrSrSr/SQr/SQrSrSrSr	Sr
g	)
ri�a�
Class to parse and store metadata from standard properties of OLE files.

Available attributes:
codepage, title, subject, author, keywords, comments, template,
last_saved_by, revision_number, total_edit_time, last_printed, create_time,
last_saved_time, num_pages, num_words, num_chars, thumbnail,
creating_application, security, codepage_doc, category, presentation_target,
bytes, lines, paragraphs, slides, notes, hidden_slides, mm_clips,
scale_crop, heading_pairs, titles_of_parts, manager, company, links_dirty,
chars_with_spaces, unused, shared_doc, link_base, hlinks, hlinks_changed,
version, dig_sig, content_type, content_status, language, doc_version

Note: an attribute is set to None when not present in the properties of the
OLE file.

References for SummaryInformation stream:

- https://msdn.microsoft.com/en-us/library/dd942545.aspx
- https://msdn.microsoft.com/en-us/library/dd925819%28v=office.12%29.aspx
- https://msdn.microsoft.com/en-us/library/windows/desktop/aa380376%28v=vs.85%29.aspx
- https://msdn.microsoft.com/en-us/library/aa372045.aspx
- http://sedna-soft.de/articles/summary-information-stream/
- https://poi.apache.org/apidocs/org/apache/poi/hpsf/SummaryInformation.html

References for DocumentSummaryInformation stream:

- https://msdn.microsoft.com/en-us/library/dd945671%28v=office.12%29.aspx
- https://msdn.microsoft.com/en-us/library/windows/desktop/aa380374%28v=vs.85%29.aspx
- https://poi.apache.org/apidocs/org/apache/poi/hpsf/DocumentSummaryInformation.html

New in version 0.25
)�codepage�title�subject�author�keywords�comments�template�
last_saved_by�revision_number�total_edit_time�last_printed�create_time�last_saved_time�	num_pages�	num_words�	num_chars�	thumbnail�creating_application�security)�codepage_doc�category�presentation_targetrh�lines�
paragraphs�slides�notes�
hidden_slides�mm_clips�
scale_crop�
heading_pairs�titles_of_partsr(�company�links_dirty�chars_with_spaces�unused�
shared_doc�	link_base�hlinks�hlinks_changed�version�dig_sig�content_type�content_status�language�doc_versionc��SUlSUlSUlSUlSUlSUlSUlSUlSUlSUl	SUl
SUlSUlSUl
SUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUl SUl!SUl"SUl#SUl$SUl%SUl&SUl'SUl(SUl)SUl*SUl+SUl,SUl-SUl.g)zG
Constructor for OleMetadata
All attributes are set to None by default
N)/r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rhr�r�r�r�r�r�r�r�r�r(r�r�r�r�r�r�r�r�r�r�r�r�r�r���selfs r1�__init__�OleMetadata.__init__�s_����
���
���������
���
���
�!���#���#��� ������#���������������$(��!���
� �����
�#'�� ���
���
���������
�!�����
����!���#������������!%���������������"��������� ���"�����
���r3c�F�URUR-Hn[XS5 M URS5(aeUR	SSS/S9n[[
UR55H1nURUS-S5n[XRUU5 M3 URS5(adUR	SSS9n[[
UR55H1nURUS-S5n[XRUU5 M3 gg)	aO
Parse standard properties of an OLE file, from the streams
``\x05SummaryInformation`` and ``\x05DocumentSummaryInformation``,
if present.
Properties are converted to strings, integers or python datetime objects.
If a property is not present, its value is set to None.

:param ole_file: OleFileIO object from which to parse properties
NzSummaryInformationTr@)�convert_time�
no_conversionr$zDocumentSummaryInformation�r�)�SUMMARY_ATTRIBS�DOCSUM_ATTRIBS�setattr�exists�
getproperties�rangere�get)r��ole_file�attrib�propsr"�values      r1�parse_properties�OleMetadata.parse_propertiess���+�+�d�.A�.A�A�F��D�$�'�B��?�?�3�4�4��*�*�+C�8<�R�D�+�R�E��3�t�3�3�4�5���	�	�!�A�#�t�,����2�2�1�5�u�=�6��?�?�;�<�<��*�*�+K�8<�+�>�E��3�t�2�2�3�4���	�	�!�A�#�t�,����1�1�!�4�e�<�5�=r3c	�8�[S5 URH2n[X5n[SRU[	U555 M4 [S5 UR
H2n[X5n[SRU[	U555 M4 g)z,
Dump all metadata, for debugging purposes.
z*Properties from SummaryInformation stream:�- {}: {}z2Properties from DocumentSummaryInformation stream:N)�printr��getattr�format�reprr�)r��propr�s   r1�dump�OleMetadata.dump#s~��	�:�;��(�(�D��D�'�E��*�#�#�D�$�u�+�6�7�)�	�B�C��'�'�D��D�'�E��*�#�#�D�$�u�+�6�7�(r3)/r�rhr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r(r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�N)r�r�r�r�r�r�r�r�r�r�r�r8r3r1rr�s(�� �H�O�E�N�5 �n =�D8r3rc�6^�\rSrSrSrSU4SjjrSrSrU=r$)ri0zJ
Warning type used when OleFileIO is destructed but has open file handle.
c�6>�[[U]5 Xlgro)�superrr��
stack_of_open)r�r�rus  �r1r��OleFileIONotClosed.__init__4s���
� �$�0�2�*�r3c��SnUR(a/SRUSS/URR5-5$U$)Nz�Deleting OleFileIO instance with open file handle. You should ensure that OleFileIO is never deleted without calling close() first. Consider using "with OleFileIO(...) as ole: ...".r��
zStacktrace of open() call:
)r��joinr�)r��msgs  r1�__str__�OleFileIONotClosed.__str__8sM��3������7�7�C��'E�F��-�-�4�4�6�7�8�
8��Jr3)r�ro)	r�r�r�r�r�r�r�r��
__classcell__)rus@r1rr0s����+�	�	r3rc��\rSrSrSrSrSrg)�	OleStreamiFa�
OLE2 Stream

Returns a read-only file object which can be used to read
the contents of a OLE stream (instance of the BytesIO class).
To open a stream, use the openstream method in the OleFileIO class.

This function can be used with either ordinary streams,
or ministreams, depending on the offset, sectorsize, and
fat table arguments.

Attributes:

    - size: actual size of data stream, after it was opened.
c	�B	�[RS5 [RSX"X4U[U5[U54-5 X�lURR
R(a[S5eSn	U[:Xa%[U5U-nSn	[RS5 X5S-
-U-n
[RSU
-5 U
[U5:�a URR[S	5 /nUS
:Xa?U[:wa5[RS5 URR[S5 [U
5GH�n[RS
X�4-5 U[:XaTU	(a[RS5  GO�[RS5 URR[S5 US
:dU[U5:�a^[RSX"[U54-5 [RSX�4-5 URR[S5  O�URXEU--5 URU5n
[U
5U:wa�U[U5S-
:wa}[RSU[U5XEU--U[U
54-5 [RSXEU--[U
5--5 URR[S5 UR!U
5 XbS-nGM� SR%U5n[U5U:�a/[RS[U5U4-5 USUnX0lO�U	(a2[RS[U5-5 [U5UlOS[RS[U5U4-5 [U5UlURR[S5 [(R*R-X5 g![aE [RSX$XR--U4-5 URR[S5  GMIf=f!["a& URR[S5  GM|f=f) a
Constructor for OleStream class.

:param fp: file object, the OLE container or the MiniFAT stream
:param sect: sector index of first sector in the stream
:param size: total size of the stream
:param offset: offset in bytes for the first FAT or MiniFAT sector
:param sectorsize: size of one sector
:param fat: array/list of sector indexes (FAT or MiniFAT)
:param filesize: size of OLE file (for debugging)
:param olefileio: OleFileIO object containing this stream
:returns: a BytesIO instance containing the OLE stream
zOleStream.__init__:zE  sect=%d (%X), size=%d, offset=%d, sectorsize=%d, len(fat)=%d, fp=%sz2Attempting to open a stream from a closed OLE FileFTz  stream with UNKNOWN SIZEr$�nb_sectors = %dz(malformed OLE document, stream too largerz!size == 0 and sect != ENDOFCHAIN:z+incorrect OLE sector index for empty streamzReading stream sector[%d] = %Xhz6Reached ENDOFCHAIN sector for stream with unknown sizez$sect=ENDOFCHAIN before expected sizezincomplete OLE streamzsect=%d (%X) / len(fat)=%dzi=%d / nb_sectors=%d�,incorrect OLE FAT, sector index out of rangezsect=%d, seek=%d, filesize=%d�OLE sector index out of rangez9sect=%d / len(fat)=%d, seek=%d / filesize=%d, len read=%dzseek+len(read)=%d�incomplete OLE sectorr9r3z3Read data of length %d, truncated to stream size %dNz3Read data of length %d, the stream size was unknownz9Read data of length %d, less than expected stream size %dz%OLE stream size is less than declared)r6�debugrer��olerm�closed�OSErrorr�
_raise_defectrrr�rc�	Exceptionrb�append�
IndexErrorr��size�io�BytesIOr�)r�rm�sectr�offset�
sectorsize�fat�filesize�	olefileio�unknown_size�
nb_sectorsrkr"�sector_datas              r1r��OleStream.__init__Zs���	�	�	�'�(��	�	�Y���J�s�3�x��b��
B�C�	D����8�8�;�;����N�O�O����<���s�8�J�&�D��L��I�I�2�3���l�+�
�:�
��	�	�#�j�0�1���C�� ��H�H�"�"�#3�5_�`����1�9���+��I�I�9�:��H�H�"�"�#3�5b�c��z�"�A��I�I�7�1�)�C�D��z�!���I�I�V�W���I�I�D�E��H�H�*�*�+;�=T�U��A�v��s�3�x���	�	�6�$�c�#�h�9O�O�P��	�	�0�1�/�A�B����&�&�'7�9g�h��
�����d�!2�2�3��'�'�*�-�K�
�;���+��s�3�x��z�0B��	�	�U��3�s�8�V�t�O�%;�X�s�;�GW�X�Y�Z��	�	�-��4��1G��K�HX�1X�Y�Z����&�&�'7�9P�Q��K�K��$�
��y�:�-��]#�n�x�x��~���t�9����I�I�K�s�SW�y�Z^�N_�_�`����;�D��I�
�
�I�I�K�c�RV�i�W�X��D�	�D�I�
�I�I�Q�UX�Y]�U^�`d�Te�e�f��D�	�D�I��H�H�"�"�#3�5\�]�
�
�
���D�'��_�
��	�	�9��*�/�1�8�<�=�>����&�&�'7�9X�Y��
��(�
����&�&�'7�9g�h��	
�s%�>P�Q.�A	Q+�*Q+�.*R�R)r�rN)r�r�r�r�r�r�r�r8r3r1r�r�Fs
���&|(r3r�c��\rSrSrSrSrSr\R"\5\:XdeSr	Sr
SrSrS	r
S
rSrSrSS
jrSrSrSrg)�OleDirectoryEntryi�z8
OLE2 Directory Entry pointing to a stream or a storage
z<64sHBBIII16sIQQIII�c�p�X lX0l/Ul0UlSUl[
R"[RU5uUl	Ul
UlUlUl
UlUlnUlUlUlUlUlUlUR[,[.[0[24;aUR5[6S5 UR[,:XaUS:waUR5[6S5 US:Xa*UR[,:waUR5[6S5 URS:�aUR5[6S5 SUl
URSURS	-
UlUR;UR85Ul[>RAS
UR[CUR<54-5 [>RASUR-5 [>RASUR&-5 [>RAS
URURUR4-5 URDS:Xa�UR*S:wajUR*S:waZ[>RASURDUR(UR*UR*4-5 UR5[FS5 UR(Ul$O*UR([KUR*5S--Ul$[>RASURHUR(UR*4-5 [MU5Ul'UR[.:Xa&URHS:waUR5[PS5 SUl)UR[,[04;asURHS:�acURHURT:aUR[0:XaSUl)OSUl)URWUR&URR5 SUl,g)a5
Constructor for an OleDirectoryEntry object.
Parses a 128-bytes entry from the OLE Directory stream.

:param bytes entry: bytes string (must be 128 bytes long)
:param int sid: index of this directory entry in the OLE file directory
:param OleFileIO ole_file: OleFileIO object containing this directory entry
Fzunhandled OLE storage typerzduplicate OLE root entryzincorrect OLE root entryrUz(incorrect DirEntry name length >64 bytesNr:zDirEntry SID=%d: %sz - type: %dz - sect: %Xhz% - SID left: %d, right: %d, child: %d�r9z+sectorsize=%d, sizeLow=%d, sizeHigh=%d (%X)zincorrect OLE stream size� z% - size: %d (sizeLow=%d, sizeHigh=%d)zOLE storage with size>0T)-�sidr4�kids�	kids_dict�usedryrzr�STRUCT_DIRENTRY�name_raw�
namelength�
entry_type�color�sid_left�	sid_right�	sid_child�dwUserFlags�
createTime�
modifyTime�
isectStart�sizeLow�sizeHighrrr
r	rr�
name_utf16�_decode_utf16_strr.r6r�r�rrr�longr�r�r�
is_minifat�minisectorcutoff�_check_duplicate_stream�
sect_chain)r��entryrr�r�s     r1r��OleDirectoryEntry.__init__�s,��������	������	�"
�M�M�+�;�;�U�C�	
��M��O��O��J��M��N��N�����O��O��O��L��M��?�?�:�}�l�K�"X�X��"�"�#3�5Q�R��?�?�j�(�S�A�X��"�"�#3�5O�P��!�8����:�5��"�"�#3�5O�P��?�?�R���"�"�#3�5_�`� �D�O��-�-�(<�$�/�/�!�*;�=���
�.�.�t���?��	��	�	�'�4�8�8�T�$�)�)�_�*E�E�F��	�	�-�$�/�/�1�2��	�	�.�4�?�?�2�3��	�	�9�T�]�]��N�N�D�N�N�=,�,�	-����#�%��}�}��!�d�m�m�z�&A��	�	�G�#�.�.����d�m�m�T�]�]�[�\�]��&�&�}�6Q�R����D�I�����T�]�]�(;�R�(?�@�D�I��	�	�9�T�Y�Y����VZ�Vc�Vc�<d�d�e��E�]��
��?�?�m�+��	�	�Q���"�"�#3�5N�O�����?�?�z�<�8�8�T�Y�Y�q�[��y�y�8�4�4�4�����-�"&���"'����,�,�T�_�_�d�o�o�N���r3c���UR(agUR[[4;dURS:Xag[5UlUR(a!UR(dUR5 URnU[:waXURRU5 UR(aURUnOURUnU[:waMWgg)z�
Build the sector chain for a stream (from the FAT or the MiniFAT)

:param OleFileIO ole_file: OleFileIO object containing this directory entry
:return: nothing
Nr)
r1r rr
r�listr.�minifat�loadminifatr(rrr)r�r��	next_sects   r1�build_sect_chain�"OleDirectoryEntry.build_sect_chainXs����?�?���?�?�:�|�"<�<��	�	�Q����&����?�?�8�#3�#3�� � �"��O�O�	��:�%��O�O�"�"�9�-����$�,�,�Y�7�	�$�L�L��3�	��:�%r3c��[RSUR[UR5UR
4-5 UR
[:wa6URUR
5 URR5 gg)z�
Read and build the red-black tree attached to this OleDirectoryEntry
object, if it is a storage.
Note that this method builds a tree of all subentries, so it should
only be called for the root object once.
z.build_storage_tree: SID=%d - %s - sid_child=%dN)
r6r�rr�r.r$r�append_kidsr�sortr�s r1�build_storage_tree�$OleDirectoryEntry.build_storage_treessg��	�	�	�B��x�x��d�i�i��$�.�.�9�:�	;��>�>�X�%�
���T�^�^�,�
�I�I�N�N��&r3c��[RSU-5 U[:XagUS:d#U[URR
5:�a!URR
[S5 gURRU5n[RSUR[UR5URURUR4-5 UR(a!URR
[S5 gSUlUR!UR5 URR#5nX0R$;a URR
[S5 UR&R)U5 X R$U'UR!UR5 UR+5 g)	a
Walk through red-black tree of children of this directory entry to add
all of them to the kids list. (recursive method)

:param child_sid: index of child directory entry to use, or None when called
    first time for the root. (only used during recursion)
zappend_kids: child_sid=%dNrzOLE DirEntry index out of rangezHappend_kids: child_sid=%d - %s - sid_left=%d, sid_right=%d, sid_child=%dz#OLE Entry referenced more than onceTz!Duplicate filename in OLE storage)r6r�rrer4�
direntriesrr�_load_direntryrr�r.r"r#r$rr<�lowerrrrr>)r��	child_sid�child�
name_lowers    r1r<�OleDirectoryEntry.append_kids�s]��	�	�	�-�	�9�:��� ���Q�;�)�S����)@�)@�%A�A��L�L�&�&�'7�9Z�[��L�L�/�/�	�:�E��I�I�`��9�9�d�5�:�:�.�������QV�Q`�Q`�a�b�
c��z�z����*�*�+;�9�;���E�J�
���U�^�^�,����)�)�+�J��^�^�+����*�*�+;�7�9�
�I�I���U�#�).�N�N�:�&����U�_�_�-��$�$�&r3c�4�URUR:H$�zCompare entries by name�r.�r��others  r1�__eq__�OleDirectoryEntry.__eq__�s���y�y�E�J�J�&�&r3c�4�URUR:$rIrJrKs  r1�__lt__�OleDirectoryEntry.__lt__�s���y�y�5�:�:�%�%r3c�.�URU5(+$ro)rMrKs  r1�__ne__�OleDirectoryEntry.__ne__�s���;�;�u�%�%�%r3c�T�URU5=(d URU5$ro)rMrPrKs  r1�__le__�OleDirectoryEntry.__le__�s���{�{�5�!�7�T�[�[��%7�7r3c���/SQnX Rn[SU-[UR5-USS9 UR[
[4;a[URSSS9 [5 UR[[4;a/UR(a[SU-SUR--5 URHnURUS-5 M g![a SnN�f=f)	zADump this entry, and all its subentries (for debug purposes only))z	(invalid)z	(storage)z(stream)z(lockbytes)z
(property)z(root)z	(UNKNOWN)� ��endrhz{%s}r:N)r rr�r�r.r
rrrr�rr�)r��tab�TYPES�	type_name�kids     r1r��OleDirectoryEntry.dump�s���)��	$��o�o�.�I�	�c�#�g��T�Y�Y��'���<��?�?�|�Z�8�8��$�)�)�W�#�.�
���?�?�}�j�9�9�d�j�j��#�c�'�F�T�Z�Z�/�/�0��9�9�C��H�H�S�1�W�����	$�#�I�	$�s�C"�"C1�0C1c�N�URS:Xag[UR5$)z�
Return modification time of a directory entry.

:returns: None if modification time is null, a python datetime object
    otherwise (UTC timezone)

new in version 0.26
rN)r'r�r�s r1�getmtime�OleDirectoryEntry.getmtime��"���?�?�a��� ����1�1r3c�N�URS:Xag[UR5$)z�
Return creation time of a directory entry.

:returns: None if modification time is null, a python datetime object
    otherwise (UTC timezone)

new in version 0.26
rN)r&r�r�s r1�getctime�OleDirectoryEntry.getctime�rdr3)r�r!r&r%r r.r(rrr'r.rr+rr4r1rr$r"r#rr*r)rN�r)r�r�r�r�r�r�
DIRENTRY_SIZEry�calcsizer�r9r>r<rMrPrSrVr�rbrfr�r8r3r1rr�sd���*,�O��M��?�?�?�+�}�<�<�<�_�B4�6�.,'�\'�&�&�8��$2�2r3rc�Z�\rSrSrSrS\SS\4SjrSrSr	Sr
\4S	jrS/S
jr
S0SjrSrS0S
jrS0SjrS1SjrS1SjrSrSrSrSrSrS2SjrS2SjrSrSrSr\S4SjrS3Sjr S3Sjr!Sr"Sr#S r$S!r%S"r&S#r'S$r(S%r)S&r*S'r+S(r,S4S)jr-S*r.S+r/S,r0S4S-jr1S.r2g)5ri�a�
OLE container object

This class encapsulates the interface to an OLE 2 structured
storage file.  Use the listdir and openstream methods to
access the contents of this file.

Object names are given as a list of strings, one for each subentry
level.  The root entry should be omitted.  For example, the following
code extracts all image streams from a Microsoft Image Composer file::

    with OleFileIO("fan.mic") as ole:

        for entry in ole.listdir():
            if entry[1:2] == "Image":
                fin = ole.openstream(entry)
                fout = open(entry[0:1], "wb")
                while True:
                    s = fin.read(8192)
                    if not s:
                        break
                    fout.write(s)

You can use the viewer application provided with the Python Imaging
Library to view the resulting files (which happens to be standard
TIFF files).
NFc���X l/UlX0lXPlSUlSUl/Ul/UlSUlSUl	SUl
SUlSUlSUl
SUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUlSUl SUl!SUl"SUl#SUl$SUl%SUl&SUl'SUl(SUl)U(aURUXS9 gg![Va URYSS9 ef=f)ad
Constructor for the OleFileIO class.

:param filename: file to open.

    - if filename is a string smaller than 1536 bytes, it is the path
      of the file to open. (bytes or unicode string)
    - if filename is a string longer than 1535 bytes, it is parsed
      as the content of an OLE file in memory. (bytes type only)
    - if filename is a file-like object (with read, seek and tell methods),
      it is parsed as-is. The caller is responsible for closing it when done.

:param raise_defects: minimal level for defects to be raised as exceptions.
    (use DEFECT_FATAL for a typical application, DEFECT_INCORRECT for a
    security-oriented application, see source code for details)

:param write_mode: bool, if True the file is opened in read/write mode instead
    of read-only by default.

:param debug: bool, set debug mode (deprecated, not used anymore)

:param path_encoding: None or str, name of the codec to use for path
    names (streams and storages), or None for Unicode.
    Unicode by default on Python 3+, UTF-8 on Python 2.x.
    (new in olefile 0.42, was hardcoded to Latin-1 until olefile v0.41)
NF)�
write_mode��warn)-�_raise_defects_level�parsing_issuesrm�
path_encoding�	_filesize�
ministream�_used_streams_fat�_used_streams_minifat�
byte_order�directory_fprA�dll_versionr�first_difat_sector�first_dir_sector�first_mini_fat_sectorrm�header_clsid�header_signature�metadata�mini_sector_shift�mini_sector_size�mini_stream_cutoff_sizer6�minifatsectr/�minisectorsize�
minor_version�nb_sect�num_difat_sectors�num_dir_sectors�num_fat_sectors�num_mini_fat_sectors�	reserved1�	reserved2�root�sector_shift�sector_size�transaction_signature_number�warn_if_not_closed�
_we_opened_fp�_open_stackrir�_close)r�rj�
raise_defectsrmr�rrs      r1r��OleFileIO.__init__s���:%2�!�!���$��*��������!#���%'��"���� ������������"&��� $���%)��"���� ��� $�����
�!%��� $���'+��$������� $���"������!������!%���#���#���$(��!���������	� ������,0��)�"'���"�������
��	�	�(�	�:����
������'��
�s�3E�Ec�"�URSS9 g)z?Destructor, ensures all file handles are closed that we opened.TrnN�r�r�s r1�__del__�OleFileIO.__del__ms�������r3c��U$ror8r�s r1�	__enter__�OleFileIO.__enter__ss���r3c�"�URSS9 g)NFrnr�)r��argss  r1�__exit__�OleFileIO.__exit__ws�������r3c��XR:�a[RU5 U"U5eURR	X245 [RU5 g)a�
This method should be called for any defect found during file parsing.
It may raise an OleFileError exception according to the minimal level chosen
for the OleFileIO object.

:param defect_level: defect level, possible values are:

    - DEFECT_UNSURE    : a case which looks weird, but not sure it's a defect
    - DEFECT_POTENTIAL : a potential defect
    - DEFECT_INCORRECT : an error according to specifications, but parsing can go on
    - DEFECT_FATAL     : an error which cannot be ignored, parsing is impossible

:param message: string describing the defect, used with raised exception.
:param exception_type: exception class to be raised, OleFileError by default
N)rpr6�errorrqr�warning)r��defect_level�message�exception_types    r1r�OleFileIO._raise_defect{sL��"�4�4�4��I�I�g�� ��)�)�
���&�&��'@�A��K�K�� r3c��URSU5nUR(aURURU5$U$)a�
Decode a string encoded in UTF-16 LE format, as found in the OLE
directory or in property streams. Return a string encoded
according to the path_encoding specified for the OleFileIO object.

:param bytes utf16_str: bytes string encoded in UTF-16 LE format
:param str errors: str, see python documentation for str.decode()
:return: str, encoded according to path_encoding
:rtype: str
zUTF-16LE)�decoderr�encode)r��	utf16_str�errors�unicode_strs    r1r,�OleFileIO._decode_utf16_str�s@�� �&�&�z�6�:������%�%�d�&8�&8�&�A�A��r3c��X l[US5(aXlO�[U[5(a/[U5[:�a[R"U5UlOGUR(aSnOSn[X5UlSUl
[R"5Ul
SnURRS[R 5 URR#5nURRS5 X@l[&R)SUR$UR$4-5 /Ul/UlURR/S5n[U5S:wd
USS	[0:waG[&R)S
R3USS	[055 UR5[6S[85 Sn[:R<"U5n[&R)S
XwS-4-5 USUn[:R>"Xh5uUl Ul!Ul"Ul#Ul$Ul%Ul&Ul'Ul(Ul)Ul*Ul+Ul,Ul-Ul.Ul/Ul0Ul1[&R)[:R>"Xh55 UR@[0:waUR5[6S5 URB[eS5:waUR5[fS5 [&R)SURD-5 [&R)SURF-5 URFS;aUR5[fS5 [&R)SURH-5 URHS:waUR5[fS5 SURJ-Ul4[&R)SURh-5 URhS;aUR5[fS5 URFS:XaURhS:wd URFS:Xa&URhS:waUR5[fS 5 SURL-Ul5[&R)S!URj-5 URjS";aUR5[fS#5 URNS:wdURPS:waUR5[fS$5 [&R)S%URR-5 URhS:Xa&URRS:waUR5[fS&5 [&R)S'URT-5 [&R)S(URV-5 [&R)S)URX-5 URXS:waUR5[lS*5 [&R)S+URZ-5 URZS:wa?UR5[fS,5 [&RoS-URZ-5 SUl-[&R)S.UR\-5 [&R)S/UR^-5 [&R)S0UR`-5 [&R)S1URb-5 X@Rh-S2-
URh-S2-
Ul8[&R)S3URpURp4-5 [sUS	S45Ul!URhUl:URjUl;URZUl<UR{URV5 UR^(aUR{UR\5 URb(aUR{UR`5 UR}U5 URURV5 UR\Ul@g!URRS5 f=f)5a�
Open an OLE2 file in read-only or read/write mode.
Read and parse the header, FAT and directory.

:param filename: string-like or file-like object, OLE file to parse

    - if filename is a string smaller than 1536 bytes, it is the path
      of the file to open. (bytes or unicode string)
    - if filename is a string longer than 1535 bytes, it is parsed
      as the content of an OLE file in memory. (bytes type only)
    - if filename is a file-like object (with read, seek and tell methods),
      it is parsed as-is. The caller is responsible for closing it when done

:param write_mode: bool, if True the file is opened in read/write mode instead
    of read-only by default. (ignored if filename is not a path)
rbzr+brdTrzFile size: %d bytes (%Xh)rNr>zMagic = {!r} instead of {!r}z#not an OLE2 structured storage filez<8s16sHHHHHHLLLLLLLLLLzfmt_header size = %d, +FAT = %di�zincorrect OLE signaturerEzincorrect CLSID in OLE headerzMinor Version = %dz%DLL Version   = %d (expected: 3 or 4))r#r z"incorrect DllVersion in OLE headerz#Byte Order    = %X (expected: FFFE)i��z!incorrect ByteOrder in OLE headerr:z0Sector Size   = %d bytes (expected: 512 or 4096))rr^z#incorrect sector_size in OLE headerr#r r^z3sector_size does not match DllVersion in OLE headerz/MiniFAT Sector Size   = %d bytes (expected: 64))rUz(incorrect mini_sector_size in OLE headerz.incorrect OLE header (non-null reserved bytes)z Number of Directory sectors = %dz3incorrect number of directory sectors in OLE headerzNumber of FAT sectors = %dzFirst Directory sector  = %Xhz$Transaction Signature Number    = %dz5incorrect OLE header (transaction_signature_number>0)z/Mini Stream cutoff size = %Xh (expected: 1000h)z/incorrect mini_stream_cutoff_size in OLE headerzJFixing the mini_stream_cutoff_size to 4096 (mandatory value) instead of %dzFirst MiniFAT sector      = %XhzNumber of MiniFAT sectors = %dzFirst DIFAT sector        = %XhzNumber of DIFAT sectors   = %dr$z/Maximum number of sectors in the file: %d (%Xh)rM)Armrfrmrgrhrerrrrir��	traceback�
extract_stackr�rc�os�SEEK_END�tellrsr6r�rurvrbrr�rrr�ryrjrzr~r}r�ryrwr�r�r�r�r�r�r{r�r�r|r�rzr��	bytearrayrr�r�rr�r�r�rr�r/r0�loadfat�
loaddirectoryr�)	r�rjrm�moder
rl�
fmt_header�header_size�header1s	         r1ri�OleFileIO.open�s���"%���8�V�$�$��G�
��%�
(�
(�S��]�>R�-R��j�j��*�D�G���������8�*�D�G�!%�D��(�6�6�8�D��
�������Q����$�	��w�w�|�|�~�H��G�G�L�L��O�!���	�	�-�������0P�P�Q�"$���%'��"������c�"���v�;�#������u�!4��I�I�4�;�;�F�2�A�J��N�O����|�-R�Tc�d�N.�
��o�o�j�1���	�	�4��SX�EX�7Y�Y�[���+�&��(
�M�M�*�.�'	
��!��������O����"��N��N�� �� ��!��-��(��&��%��#��"��	�	�6�=�=��8�9�� � �E�)����|�-F�G����	�"�
�-����/�1P�Q��	�	�'�$�*<�*<�<�>��	�	�:�T�=M�=M�M�O����6�)�
���/�1U�V��	�	�8�4�?�?�J�L��?�?�f�$����/�1T�U��d�/�/�/����	�	�E��HX�HX�X�Z����;�.����/�1V�W����a��D�$4�$4�c�$9����a��D�$4�$4�d�$:����/�1f�g� !�4�#9�#9� 9����	�	�D�t�G\�G\�\�^�� � ��,����/�1[�\��>�>�Q��$�.�.�A�"5����/�1a�b��	�	�5��8L�8L�L�N����S� �T�%9�%9�1�%<����/�1f�g��	�	�/�$�2F�2F�F�H��	�	�2�T�5J�5J�J�L��	�	�9�D�<]�<]�]�_�
�,�,��1����/�1h�i��	�	�D�t�Gc�Gc�c�e��'�'�6�1����/�1b�c��K�K�d��4�4�5�
6�+1�D�(��	�	�4�t�7Q�7Q�Q�S��	�	�3�d�6O�6O�O�Q��	�	�4�t�7N�7N�N�P��	�	�3�d�6L�6L�L�N�#�%5�%5�5�a�7�D�<L�<L�L�PQ�Q����	�	�D����VZ�Vb�Vb�Gc�c�d�
#�6�!�B�<�0����*�*���"�3�3��� $� <� <���	
�$�$�T�%:�%:�;��$�$��(�(��)C�)C�D��!�!��(�(��)@�)@�A�	
���V��	
���4�0�0�1��5�5����[
�G�G�L�L��O�s�`(�(ac�"�URSS9 g)z�
close the OLE file, release the file object if we created it ourselves.

Leaves the file handle open if it was provided by the caller.
FrnNr�r�s r1�close�OleFileIO.close�s��	
�����r3c���UR(acU(a:UR(a)[R"[	UR
55 URR5 SUlgg)z3Implementation of close() with internal arg `warn`.FN)r�r��warningsrorr�rmr�)r�ros  r1r��OleFileIO._close�sJ�������/�/��
�
�0��1A�1A�B�C��G�G�M�M�O�!&�D��
r3c�4�U(a%[RSU-5 URnO?[RSU-5 U[[[
[4;agURnX;aUR[S5 gURU5 g)a7
Checks if a stream has not been already referenced elsewhere.
This method should only be called once for each known stream, and only
if stream size is not null.

:param first_sect: int, index of first sector of the stream in FAT
:param minifat: bool, if True, stream is located in the MiniFAT, else in the FAT
z,_check_duplicate_stream: sect=%Xh in MiniFATz(_check_duplicate_stream: sect=%Xh in FATNzStream referenced twice)r6r�rvrrrrrurrr)r��
first_sectr6�used_streamss    r1r0�!OleFileIO._check_duplicate_stream�s}����I�I�D�z�Q�R��5�5�L��I�I�@�:�M�N��g�g�j��B�B���1�1�L��%����/�1J�K����
�+r3c��Sn[S[S[S[S0n[	U5nXS-S-
U-n[SSS	9 [
U5Hn[S
U-SS	9 M [5 [
U5HinX�-n	[SX)--SS	9 [
X�U-5H7nXu:�a O1Xn
U
S-nX�;aXKnOX�S-:XaS
nOS
U
-n[USS	9 M9 [5 Mk g)zE
Display a part of FAT in human-readable form for debugging purposes
r>z..free..z[ END. ]zFATSECT zDIFSECT r$�indexrYrZ�%8X�%6X:r9z    --->N)rrrrrer�r�)
r�r�
firstindex�VPL�fatnames�nbsect�nlinesr"�lr�r	�auxr.s
             r1�dumpfat�OleFileIO.dumpfat�s���
���
��
��
��
�	���S����*�Q�,��$��
�g�3���s��A��%�!�)��%��
���v��A��E�E��&�J�,�-�3�7��5��)�,���9���v���Z�'���?�#�=�D���s�{�)��$�t�|���d��$�-�
�G�!r3c���Sn[R"[U5n[RS:XaUR	5 [U5nXS-S-
U-n[
SSS9 [U5Hn[
SU-SS9 M [
5 [U5HOnX�-n	[
SX)--SS9 [X�U-5HnXu:�a OXGn
SU
-n[
USS9 M [
5 MQ g	)
zC
Display a sector in a human-readable form, for debugging purposes
r>�bigr$r�rYrZr�r�N)�array�UINT32�sys�	byteorder�byteswaprer�r�)r��sectorr�r�r\r�r�r"r�r�r	r.s            r1�dumpsect�OleFileIO.dumpsect�s���
���k�k�&�&�)���=�=�E�!��L�L�N��S����*�Q�,��$��
�g�3���s��A��%�!�)��%��
���v��A��E�E��&�J�,�-�3�7��5��)�,���9���v���t�|���d��$�-�
�G�r3c��[R"[U5n[RS:XaUR	5 U$)zy
convert a sector to an array of 32 bits unsigned integers,
swapping bytes on big endian CPUs such as PowerPC (old Macs)
r�)r�r�r�r�r�)r�r	�as   r1�
sect2array�OleFileIO.sect2array�s.��
�K�K���%���=�=�E�!�
�J�J�L��r3c���[U[R5(aUnOJURU5n[R	[
R5(aURU5 SnUH�nUS-n[RSU-5 U[:Xd
U[:Xa[RS5  U$URU5nURU5nURU-UlM� U$)z�
Adds the indexes of the given sector to the FAT

:param sect: string containing the first FAT sector, or array of long integers
:returns: index of last FAT sector.
Nr9z
isect = %Xzfound end of sector chain)
rgr�r�r6�isEnabledForr&�DEBUGr�r�rr�getsectr)r�r	�fat1�isect�s�nextfats      r1�loadfat_sect�OleFileIO.loadfat_sect�s����d�E�K�K�(�(��D��?�?�4�(�D�����
�
�.�.��
�
�d�#����E��J�&�E��I�I�l�U�*�+��
�"�e�x�&7��	�	�5�6�������U�#�A��o�o�a�(�G��x�x�'�)�D�H���r3c���[RS5 USSn[RS[U5[U5S-4-5 [R"[5UlUR
U5 URS:wGa�[RS5 URS::aUR[S	5 URUR:�aUR[S
5 [RS5 URS-S-
nURS-
U-S-
U-n[RS
U-5 URU:wa[S5eURn[!U5H�n[RSXe4-5 UR#U5nUR%U5n[R'[(R*5(aUR-U5 UR
USU5 X�n[RSU-5 M� U[.[04;a[S5eO[RS5 [UR
5UR:�aU[RS[UR
5UR4-5 UR
SURUl[RS[UR
5UR4-5 [R'[(R*5(a1[RS5 UR3UR
5 gg)z
Load the FAT table.
zDLoading the FAT table, starting with the 1st sector after the header�Lrzlen(sect)=%d, so %d integersr rz)DIFAT is used, because file size > 6.8MB.�mz#incorrect DIFAT, not enough sectorsz)incorrect DIFAT, first index out of rangezDIFAT analysis...r$z
nb_difat = %dzincorrect DIFATzDIFAT block %d, sector %XNznext DIFAT sector: %Xzincorrect end of DIFATz$No DIFAT, because file size < 6.8MB.z!len(fat)=%d, shrunk to nb_sect=%dz6FAT references %d sectors / Maximum %d sectors in filez
FAT:)r6r�rer�r�rr�r�r�rrrzr�rr�IOError�	iterranger�r�r�r&r�r�rrr�)	r�rlr	�nb_difat_sectors�nb_difat�isect_difatr"�sector_difat�difats	         r1r��OleFileIO.loadfat!s���	�	�	�X�Y��b��~���	�	�1�S��Y��D�	�1��4M�M�O�
�;�;�v�&������$���!�!�Q�&��I�I�A�B��#�#�s�*��"�"�#3�5Z�[��&�&�$�,�,�6��"�"�<�1\�]��I�I�*�,�!%���� 2�A�5���,�,�S�0�3C�C�A�E�HX�X�H��I�I���1�3��%�%��1��/�0�0��1�1�K��x�(���	�	�6�!�9I�I�K�#�|�|�K�8������5���#�#�G�M�M�2�2��M�M�,�/��!�!�%�(9�)9�":�;�#�5���	�	�2�[�@�B�)��:�x�"8�8��6�7�7�9�
�I�I�<�=��t�x�x�=�4�<�<�'��I�I�9�S����]�D�L�L�<Y�Y�Z��x�x�
����.�D�H��	�	�J�c�RV�RZ�RZ�m�]a�]i�]i�Mj�j�k����G�M�M�*�*��I�I�h���L�L����"�+r3c�D�URUR-nURRUR-S-
UR-nUS-n[
R
SURURX1U4-5 X1:�aUR[S5 URURUSS9R5nURU5Ul
[
R
S[UR5U4-5 URSUUl
[
R
S	[UR5-5 [
R[ R"5(a1[
R
S
5 UR%UR5 gg)z
Load the MiniFAT table.
r$r zaloadminifat(): minifatsect=%d, nb FAT sectors=%d, used_size=%d, stream_size=%d, nb MiniSectors=%dz%OLE MiniStream is larger than MiniFATT��	force_FATz$MiniFAT shrunk from %d to %d sectorsNzloadminifat(): len=%dz	
MiniFAT:)r�r�r�rr�r6r�r�rr�_openrbr�r6rer�r&r�r�)r��stream_size�nb_minisectors�	used_sizer�s     r1r7�OleFileIO.loadminifattsM���/�/�$�2B�2B�B���)�)�.�.�4�+@�+@�@��B�t�G\�G\�\��"�Q�&�	��	�	�u�
�
�
�t�8�8�)�R`�a�b�	c��"����/�1X�Y��J�J�t�'�'���J�E�J�J�L�����q�)����	�	�8�C����<M�~�;^�^�_��|�|�O�^�4����	�	�)�C����,=�=�>����G�M�M�*�*��I�I�l�#��L�L����&�+r3c��URRURUS--5 URRUR5n[U5UR:waD[RSU[U5UR4-5 UR[S5 U$![aM [RSXRUS--UR4-5 UR[S5 N�f=f)zu
Read given sector from file on disk.

:param sect: int, sector index
:returns: a string containing the sector data.
r$z(getsect(): sect=%X, seek=%d, filesize=%dr�z*getsect(): sect=%X, read=%d, sectorsize=%dr�)rmrcrrr6r�rsrrrbre)r�r	r�s   r1r��OleFileIO.getsect�s���$	N��G�G�L�L����D��F�3�4�
�����d�o�o�.���v�;�$�/�/�)��I�I�B��s�6�{�D�O�O�4�5�
6����|�-D�E��
���	N��I�I�@�����Q��/����@�A�
B����|�-L�M�	N�s�+B1�1AD�Dc��[U[5(d[S5e[U[5(a[U5S:wa[S5eURRURUS--5 [U5UR:aX#UR[U5-
--
nO$[U5UR:�a[S5eURRU5 g![aM [RSXRUS--UR4-5 UR[S5 N�f=f)z�
Write given sector to file on disk.

:param sect: int, sector index
:param data: bytes, sector data
:param padding: single byte, padding character if data < sector size
z'write_sect: data must be a bytes stringr$z4write_sect: padding must be a bytes string of 1 charz+write_sect(): sect=%X, seek=%d, filesize=%dr��Data is larger than sector sizeN)rgrh�	TypeErrorrermrcrrr6r�rsrr�
ValueError�write)r�r	rk�paddings    r1�
write_sect�OleFileIO.write_sect�s���$��&�&��E�F�F��'�5�)�)�S��\�1�_��R�S�S�	N��G�G�L�L����D��F�3�4�
�t�9�t���&��t����T��:�;�;�D�
��Y����
(��>�?�?����
�
�d����	N��I�I�C�����Q��/����@�A�
B����|�-L�M�	N�s�+C3�3AE
�	E
c�4�[U[5(d[S5e[U[5(a[U5S:wa[S5eURRU5 [U5nX@R:aX#URU-
--
nURU:a[S5eURRU5 g![a< [RSXR4-5 UR[S5 N�f=f)z�
Write given sector to file on disk.

:param fp_pos: int, file position
:param data: bytes, sector data
:param padding: single byte, padding character if data < sector size
z,write_mini_sect: data must be a bytes stringr$z9write_mini_sect: padding must be a bytes string of 1 charz)write_mini_sect(): fp_pos=%d, filesize=%dr�rN)rgrhrrermrcrr6r�rsrrr�rr)r��fp_posrkr�len_datas     r1�_write_mini_sect�OleFileIO._write_mini_sect�s����$��&�&��J�K�K��'�5�)�)�S��\�Q�->��W�X�X�	N��G�G�L�L�� �
�t�9���+�+�+��t�4�4�x�?�@�@�D�� � �8�+��>�?�?����
�
�d����	N��I�I�A��~�~�.�/�
0����|�-L�M�	N�s�C�AD�Dc�z�[RS5 URUSS9UlURRS-n[RSURRU4-5 S/U-UlUR
S5nUR
SUlURR5 g)zE
Load the directory.

:param sect: sector index of directory stream.
zLoading the Directory:Tr�rz&loaddirectory: size=%d, max_entries=%dNr)	r6r�r�rxrrArBr�r>)r�r	�max_entries�
root_entrys    r1r��OleFileIO.loaddirectory�s���	�	�	�*�+�!�J�J�t�t�J�<����'�'�,�,��3���	�	�:�
�
�
�
#�
#�[�1�2�	3� �&�;�.����(�(��+�
��O�O�A�&��	�	
�	�	�$�$�&r3c��US:dU[UR5:�aUR[S5 URUb%UR[S5 URU$UR
R
US-5 UR
RS5n[X!U5URU'URU$)a&
Load a directory entry from the directory.
This method should only be called once for each storage/stream when
loading the directory.

:param sid: index of storage/stream in the directory.
:returns: a OleDirectoryEntry object

:exception OleFileError: if the entry has always been referenced.
rz OLE directory index out of rangez'double reference for OLE stream/storager)	rerArrrrxrcrbr)r�rr2s   r1rB�OleFileIO._load_direntrys����q�5�C��T�_�_�-�-����|�-O�P��?�?�3��+����/�9�
;��?�?�3�'�'������s�S�y�)��!�!�&�&�s�+��0��T�B���������s�#�#r3c�8�URR5 g)z%
Dump directory (for debugging only)
N)r�r�r�s r1�
dumpdirectory�OleFileIO.dumpdirectory,s��	
�	�	���r3c��[RSX[U54-5 X R:a�U(d�UR(d~UR5 URRn[RSURRU4-5 URURRUSS9Ul[URXSURURURRUS9$[URXURURURUR US9$)aD
Open a stream, either in FAT or MiniFAT according to its size.
(openstream helper)

:param start: index of first sector
:param size: size of stream (or nothing if size is unknown)
:param force_FAT: if False (default), stream will be opened in FAT or MiniFAT
    according to size. If True, it will always be opened in FAT.
z1OleFileIO.open(): sect=%Xh, size=%d, force_FAT=%sz%Opening MiniStream: sect=%Xh, size=%dTr�r)rmr	rr
rrr
r)r6r��strr/rtr7r�rr(r�r�r�r6rmrrrs)r��startrr��size_ministreams     r1r��OleFileIO._open2s
��	�	�	�E�
�#�i�.�)�*�	+��'�'�'�	��?�?�� � �"�#'�)�)�.�.���	�	�A��Y�Y�)�)�?�;�<�=�"&�*�*�T�Y�Y�-A�-A�#�t�#-�#5�������e�$%�$�2E�2E�!%������8L�8L�'+�-�
-�����e�$(�O�O�(,���T�X�X�&*�n�n�'+�	-�
-r3c��X#R/-nURH�nUR[:Xa>U(a"UR	USSUR/-5 URXXdU5 MUUR[:Xa-U(a$UR	USSUR/-5 M�M�UR[S5 M� g)a}
listdir helper

:param files: list of files to fill in
:param prefix: current location in storage tree (list of names)
:param node: current node (OleDirectoryEntry object)
:param streams: bool, include streams if True (True by default) - new in v0.26
:param storages: bool, include storages if True (False by default) - new in v0.26
    (note: the root storage is never included)
r$NzIThe directory tree contains an entry which is not a stream nor a storage.)	r.rr rr�_listr
rr)r��files�prefix�node�streams�storagesr2s       r1r�OleFileIO._listWs����9�9�+�%���Y�Y�E����=�0���L�L�����u�z�z�l�!:�;��
�
�5�%�(�C��!�!�\�1���L�L�����u�z�z�l�!:�;���"�"�#3�6A�B�r3c�F�/nURU/URX5 U$)a=
Return a list of streams and/or storages stored in this file

:param streams: bool, include streams if True (True by default) - new in v0.26
:param storages: bool, include storages if True (False by default) - new in v0.26
    (note: the root storage is never included)
:returns: list of stream and/or storage paths
)rr�)r�r"r#rs    r1�listdir�OleFileIO.listdirss$�����
�
�5�"�d�i�i��;��r3c�,�[U[5(aURS5nURnUHQnURH1nUR
R
5UR
5:XdM1 O
 [S5eUnMS UR$)a�
Returns directory entry of given filename. (openstream helper)
Note: this method is case-insensitive.

:param filename: path of stream in storage tree (except root entry), either:

    - a string using Unix path syntax, for example:
      'storage_1/storage_1.2/stream'
    - or a list of storage filenames, path to the desired stream/storage.
      Example: ['storage_1', 'storage_1.2', 'stream']

:returns: sid of requested filename
:exception IOError: if file not found
�/zfile not found)	rg�
basestring�splitr�rr.rCr�r)r�rjr!r.r_s     r1�_find�OleFileIO._find�sz��$�h�
�+�+��~�~�c�*�H��y�y���D��y�y���8�8�>�>�#�t�z�z�|�3��!��.�/�/��D�
��x�x�r3c���URU5nURUnUR[:wa[	S5eURURUR5$)a�
Open a stream as a read-only file object (BytesIO).
Note: filename is case-insensitive.

:param filename: path of stream in storage tree (except root entry), either:

    - a string using Unix path syntax, for example:
      'storage_1/storage_1.2/stream'
    - or a list of storage filenames, path to the desired stream/storage.
      Example: ['storage_1', 'storage_1.2', 'stream']

:returns: file object (read-only)
:exception IOError: if filename not found, or if this is not a stream.
zthis file is not a stream)r,rAr r
r�r�r(r�r�rjrr2s    r1�
openstream�OleFileIO.openstream�sU���j�j��"������$�����|�+��5�6�6��z�z�%�*�*�E�J�J�7�7r3c�d�UR(dURU5 [UR5nURR(dURRU5 URUR
-n[
UR5H�upVXd-nXd-nURRUS-UR-X�R
--n	XSS-
:a"X%UR
-US-UR
-n
OX%UR
-Sn
URX�5 M� g)Nr$)r1r9rer�r�r��	enumerater
)r�r2�
data_to_writer�
block_size�idxr	�	sect_base�sect_offsetr�data_per_sectors           r1�_write_mini_stream�OleFileIO._write_mini_stream�s������"�"�4�(���)�)�*�
��y�y�#�#��I�I�&�&�t�,��%�%��)>�)>�>�
�"�5�#3�#3�4�I�C��*�I��+�K��i�i�*�*�9�5��9�4�;K�;K�K�k�Zo�Zo�No�o�F��1�n�%�"/�d�6K�6K�0K�c�TU�g�Y]�Yn�Yn�Mn�"o��"/�d�6K�6K�0K�0L�"M���!�!�&�:�5r3c	�,�[U[5(d[S5eURU5nURUnUR
[:wa[S5eURnU[U5:wa[S5eXPR:a#UR
[:waURXBS9$URnXPRS-
-UR-n[ R#SU-5 [%U5H�nX�S-
:a=X(UR-US-UR-n	[U	5UR:XdeOuX(UR-Sn	[ R#SXPR[U	5XPR-4-5 [U	5UR-XPR-:XdeUR'Xi5 UR(UnM� U[,:wa[S
5eg![*a [S	5ef=f)a�
Write a stream to disk. For now, it is only possible to replace an
existing stream by data of the same size.

:param stream_name: path of stream in storage tree (except root entry), either:

    - a string using Unix path syntax, for example:
      'storage_1/storage_1.2/stream'
    - or a list of storage filenames, path to the desired stream/storage.
      Example: ['storage_1', 'storage_1.2', 'stream']

:param data: bytes, data to be written, must be the same size as the original
    stream.
z)write_stream: data must be a bytes stringzthis is not a streamz?write_stream: data must be the same size as the existing stream)r2r4r$r�NzGwrite_stream: size=%d sectorsize=%d data_sector=%Xh size%%sectorsize=%dr�z)incorrect last sector index in OLE stream)rgrhrr,rAr r
r�rrerr/rr:r(rr6r�r�rrrr)
r��stream_namerkrr2rr	rr"�data_sectors
          r1�write_stream�OleFileIO.write_stream�s����$��&�&��G�H�H��j�j��%������$�����|�+��0�1�1��z�z���3�t�9���^�_�_��'�'�'�E�,<�,<�
�,J��*�*�5�*�O�O������o�o�a�/�0�T�_�_�D�
��	�	�#�j�0�1��z�"�A��Q�,��"�d�o�o�$5��1��d�o�o�8M�N���;�'����8�9�8�"�d�o�o�$5�$6�7���	�	�c��_�_�c�+�.>����@V�W�X�Y��;�'�$�/�/�9�4�/�/�;Q�Q�R�Q��O�O�D�.�
N��x�x��~��-#�6�:���E�F�F���	�
N��L�M�M�
N�s�G=�=Hc�|�URU5nURUnUR$![a gf=f)aX
Test if given filename exists as a stream or a storage in the OLE
container, and return its type.

:param filename: path of stream in storage tree. (see openstream for syntax)
:returns: False if object does not exist, its entry type (>0) otherwise:

    - STGTY_STREAM: a stream
    - STGTY_STORAGE: a storage
    - STGTY_ROOT: the root entry
F)r,rAr rr/s    r1�get_type�OleFileIO.get_typesA��	��*�*�X�&�C��O�O�C�(�E��#�#�#���	��	�s�+.�
;�;c�Z�URU5nURUnUR$)z�
Return clsid of a stream/storage.

:param filename: path of stream/storage in storage tree. (see openstream for
    syntax)
:returns: Empty string if clsid is null, a printable representation of the clsid otherwise

new in version 0.44
)r,rAr�r/s    r1�getclsid�OleFileIO.getclsids*���j�j��"������$���{�{�r3c�b�URU5nURUnUR5$)a
Return modification time of a stream/storage.

:param filename: path of stream/storage in storage tree. (see openstream for
    syntax)
:returns: None if modification time is null, a python datetime object
    otherwise (UTC timezone)

new in version 0.26
)r,rArbr/s    r1rb�OleFileIO.getmtime$�-���j�j��"������$���~�~��r3c�b�URU5nURUnUR5$)z�
Return creation time of a stream/storage.

:param filename: path of stream/storage in storage tree. (see openstream for
    syntax)
:returns: None if creation time is null, a python datetime object
    otherwise (UTC timezone)

new in version 0.26
)r,rArfr/s    r1rf�OleFileIO.getctime3rIr3c�H�URU5ng![a gf=f)z�
Test if given filename exists as a stream or a storage in the OLE
container.
Note: filename is case-insensitive.

:param filename: path of stream in storage tree. (see openstream for syntax)
:returns: True if object exist, else False.
TF)r,r)r�rjrs   r1r��OleFileIO.existsBs*��	��*�*�X�&�C����	��	�s��
!�!c��URU5nURUnUR[:wa[	S5eUR
$)a
Return size of a stream in the OLE container, in bytes.

:param filename: path of stream in storage tree (see openstream for syntax)
:returns: size in bytes (long integer)
:exception IOError: if file not found
:exception TypeError: if this is not a stream.
zobject is not an OLE stream)r,rAr r
rrr/s    r1�get_size�OleFileIO.get_sizeQsD���j�j��"������$�����|�+��9�:�:��z�z�r3c�.�URR$)zX
Return root entry name. Should usually be 'Root Entry' or 'R' in most
implementations.
)r�r.r�s r1�get_rootentry_name�OleFileIO.get_rootentry_nameas��
�y�y�~�~�r3c	�V�US:Xa/nUn[U[5(dSRU5nURU5n0nUR	S5n[USS5nUR	S5n[USS5n	UR
[US55 SUR	[UR	S	55S	-
5-n[US	5n
[U
[[!U5S-55n
[#U
5H�n
Sn[USU
S--5n[USU
S--5n[X5n[$R'US
5n[(R+SUUUU4-5 UR-XS	-UUX#5nUXn'M� U$![aGnS
R[U5U5nUR[U[U55 UsSnA$SnAff=f![a=nSU[U5U4-nUR[U[U55 SnAGMSnAff=f)�
Return properties described in substream.

:param filename: path of stream in storage tree (see openstream for syntax)
:param convert_time: bool, if True timestamps will be converted to Python datetime
:param no_conversion: None or list of int, timestamps not to be converted
    (for example total editing time is not a real timestamp)

:returns: a dictionary of values indexed by id (integer)
Nr)rQr>rMrIrE�****r z6Error while parsing properties header in stream {}: {}rrB�UNKNOWN�$property id=%d: type=%d/%s offset=%X�3Error while parsing property id %d in stream %s: %s)rgrr�r0rbr�rcr��
BaseExceptionr�r�rr�type�minrvrer��VTr�r6r��_parse_property)r�rjr�r��
streampathrmrkr�r��fmtid�	num_props�excr�r"�property_idr
�
property_type�vt_namer�s                   r1r��OleFileIO.getpropertieshs���D� ��M��
��*�c�*�*����*�-�J�
�_�_�X�
&����	������A��1�Q�r�7�O�E������A��1�S�b�6�N�E��G�G�C��2�J���"�'�'�#�b�g�g�a�j�/�!�"3�4�4�A��A�q�	�I��	�3�s�1�v��z�?�3�	��9�%�A��K�
E�!�!�Q�q��s�U�m���Q��1�Q�3���� #�A��
��&�&��	�:���	�	�@�K�Q^�`g�io�Cp�p�q��,�,�Q�q��+�}�Vb�r��$)��!�&�&���;�	�K�Q�Q��Z� �#�'�C����/��d�3�i�@��K��	��,!�
E�L���j�!1�3�O8�8���"�"�#3�S�$�s�)�D�D��
E�s8�BF
�A<G!�
G�<G�G�G�!
H(�+1H#�#H(c	���SnU[::dU[[4;aURXX4XV5upxU$U[[
-:Xa{[RS5 Sn	[X5n
/n[U
5HDn[XU	-5nURXU	-S-X4XV5up|URU5 X�S--
n	MF UnU$U[-(a�U[)-n
[RS[RU
S5-5 Sn	[X5n
/n[U
5H8nURXU	-X4[)-XV5up|URU5 X�-
n	M: UnU$[RSX44-5 U$)Nz'property_type == VT_VECTOR | VT_VARIANTr zproperty_type == VT_VECTOR | %srW�5property id=%d: type=%d not implemented in parser yet)
�VT_BLOB�VT_CLSID�VT_CF�_parse_property_basic�	VT_VECTOR�
VT_VARIANTr6r�r�r�rr]r�)r�r�r
rcrdr�r��v�_�off�count�values�sz�property_type_bases              r1r^�OleFileIO._parse_property�s������G�#�}��5�8I�'I��-�-�a��Ua�q�D�A�4��3�i�*�4�
4��I�I�?�@��C���N�E��F��5�\�� #�A��|� 4�
��3�3�A��|�a�7G��eq�B����
�
�a� ��A�v�
��	"�
�A����Y�
&�!.�)��!;���I�I�7�"�&�&�AS�U^�:_�_�`��C���N�E��F��5�\���2�2�1�s�l�K�bk�ak�Qk�my�J����
�
�a� ��	��"��A���
�I�I�M�Q\�Pl�l�m��r3c�L�SnSnU[:Xa[X5nUS:�aUS-
nSnXx4$U[:Xa[X5nSnXx4$U[[[
4;a[
X5nSnXx4$U[[4;a[
X5nSnXx4$U[[4;a5[
X5n	XS-US-U	-S-
nURSS5nSU	-nXx4$U[:Xa [
X5n	XS-US-U	-nSU	-nXx4$U[:Xa8[
XS-5n	URXS-US-U	S--5nSU	S--nXx4$U[:Xa�[![
X55[![
XS-55S	--nU(a|X6;aw["R%S
X7['U5S-4-5 [(R("SSSSSS5n
["R%S
US--5 U
[(R*"US-S9-nOUS-nSnXx4$U[,:Xa[/X5nSnXx4$U[0:Xa[3XUS-5nSnXx4$U[4:Xa [
X5n	XS-US-U	-nSU	-nXx4$U[6:Xa[9[X55nSnXx4$Sn["R%SX44-5 Xx4$)Nr���r:r r$r�r3r�8Converting property #%d to python datetime, value=%d=%fs逖�r��timedelta days=%d�@�T$r@r�r>rErh)�VT_I2r}�VT_UI2�VT_I4�VT_INT�VT_ERRORr��VT_UI4�VT_UINT�VT_BSTR�VT_LPSTR�replaceri�	VT_LPWSTRr,�VT_FILETIMEr-r6r��floatr�r��VT_UI1rsrjr�rk�VT_BOOL�bool)r�r�r
rcrdr�r�r�rrrr�s           r1rl�OleFileIO._parse_property_basic�sX���E��D���%��A����E�>�!�E�M�E���b�;��a�&�(��A�����\�;��[�5�&�(�";�;��A�����P�;��O�6�7�"3�3��A�����J�;��I�7�H�"5�5�
�A�����(�6�!�8�E�>�!�#3�4���
�
�g�s�3���5�y��v�;��u�'�)��A�����(�6�!�8�E�>�2���5�y��j�;��i�)�+�
�A�a�x�(���.�.�q���&��(�5��7�:J�/K�L���5�1�9�}��Z�;��Y�+�-��S��^�,��S��1�H�5E�0F��0J�K�� �K�$D��I�I�X�)�%��,�x�2G�H�I�J�+3�*;�*;�D�!�Q��1�a�*P�'��I�I�1�U�=O�5P�Q�R�/�(�2D�2D�RW�Y[�R[�2\�\�E�"�X�-�E���8�;��7�&�(��1�9�
����2�;��1�(�*��q��r�	�2�3����,�;��+�%�'��A�����(�6�!�8�E�>�2���5�y�� �;���'�)��S��^�,�����;�����	�	�Q�U`�Tp�p�q��;�r3c�n�[5UlURRU5 UR$)z�
Parse standard properties streams, return an OleMetadata object
containing all the available metadata.
(also stored in the metadata attribute of the OleFileIO object)

new in version 0.25
)rrr�r�s r1�get_metadata�OleFileIO.get_metadata%	s)��$�
��
��
�
�&�&�t�,��}�}�r3c
�\�[S5nUS:Xa/nUn[U[5(dSRU5nUR	U5n/nURS5n[USS5n	[
US5n
/n[U
5GH�nURS5n[USS5n
X�:XdM*[
US5nURU5 S	UR[
URS
55S
-
5-n[
US
5nUSSSU--nSSU--n[
UUUS
-5nUS
-
n[U5HgnUUUS
-n[
UUS
-US-5nUUS-US-U-RS5RS5nURUSS
.5 US-U-nMi [U[[U5S-55n[SU5GH6nSn[
USUS--5n[
USUS--5n[
UU5n[ R#US5n[$R'SUUUU4-5 U[(:Xa[+UUS
-5nUS:�aUS-
nGO�US:Xa"[
UUS-5nUUS-US-U-S-
nGOuU[,:Xa[+UUS
-5nGOZU[.[0[24;a[
UUS
-5nGO4U[4[64;a[
UUS
-5nGOU[8[:4;a4[
UUS
-5nUUS-US-U-S-
nUR=SS5nGO�U[>:Xa[
UUS
-5nUUS-US-U-nGO�U[@:Xa1[
UUS
-5nURCUUS-US-US--5nGOkU[D:Xa�[G[
UUS
-55[G[
UUS-55S--nU(a~UU;ax[$R'SUU[IU5S-4-5 [JRJ"SSSSSS5n[$R'SUS--5 U[JRL"US-S9-nO�US-nO�U[N:Xa[QUUS
-5nO�U[R:Xa[UUS
-US-5nOgU[T:Xa[
UUS
-5nUUS-US-U-nO?U[V:Xa[Y[+UUS
-55nOSn[$R'S UU4-5 UX|S-
S!'GM9 GM� U$![Za=nS"U[]U5U4-nUR_[`U[cU55 SnAGM�SnAff=f![Za?nS#[]U5<S$U<3nUR_[`U[cU55 UsSnA$SnAff=f)%rUs��՜.��+,��Nr)rQr>rMrIrErVr �utf_8�)�
property_namer�r:rrBrWrXrxryr$r�r3rrzr{r�r|r}r@r�rhr�rYz0Error while parsing properties header in stream z: )2r�rgrr�r0rbr�r�rcr�r�rr\rvrer�r]r�r6r�r~r}rr�r�r�r�r�r�r�r�rir�r,r�r-r�r�r�r�rsrjrkr�r�rZr�rrr[)r�rjr�r��FMTID_USERDEFINED_PROPERTIESr_rmrkr�r��sections_count�section_file_pointersr"r`�file_pointerra�PropertyIdentifierAndOffsetr��entry_count�
identifier�str_size�stringrcr
rdrer�rrr�rbr�s                               r1�get_userdefined_properties�$OleFileIO.get_userdefined_properties1	s
�� (.�.q�'r�$��D� ��M��
��*�c�*�*����*�-�J�
�_�_�X�
&����
�G�G�B�K���q��2�w����Q���� "��R	��>�*���G�G�B�K���q��"�v����8�#&�q�"�:�L��G�G�L�)��"�'�'�#�b�g�g�a�j�/�A�*=�">�>�A� #�A�q�	�I�23�A�q��9��}�2E�/��a�	�k�M�E�"%�a��u�Q�w�&7�"8�K��Q�J�E�"�;�/��%&�u�e�Q�h�%7�
�#&�q��q��%�!�)�'<�#=��!"�5��7�E�!�G�H�,<�!=�!D�!D�W�!M�!S�!S�TX�!Y�����V�T�$J�K� %�a��� 0��0�!$�I�s�3�q�6�A�:�� ?�I�'�q�)�4��&'��gQ�*-�a��Q��U��*;�K�%(��B��Q��J�%7�F�,/��6�N�M�&(�f�f�]�I�&F�G��I�I�&L�P[�]j�ls�u{�O|�&|�}�
 -��5�(+�A�v��z�(:��#(�E�>�,1�E�M�E��!.�!�!3�+.�q�&�1�*�+=��()�&�2�+�f�r�k�H�6L�q�6P�(Q��!.�&�!8�(+�A�v��z�(:��!.�5�&�(�2K�!K�),�A�v��z�(:��!.�6�7�2C�!C�(+�A�v��z�(:��!.�7�H�2E�!E�
),�A�v��z�(:��()�&�1�*�V�a�Z�%�5G�!�5K�(L��(-�
�
�g�s�(C��!.�'�!9�),�A�v��z�(:��()�&�1�*�V�a�Z�%�5G�(H��!.�)�!;�
),�A�v��z�(:��(,�(>�(>�q��!��F�UV�J�Y^�ab�Yb�Lb�?c�(d��!.�+�!=�(,�S��F�Q�J�-?�(@�D��Q�PV�YZ�PZ�I[�D\�`b�Db�(c��$0�K�}�4T�$'�I�I�.h�1<�e�U�5�\�T\�E\�0]�/^�%_�;C�:K�:K�D�RS�UV�XY�[\�^_�:`�$7�$'�I�I�.A�U�Og�Eh�.i�$j�,?�(�BT�BT�bg�km�bm�Bn�,n�E�-2�X�,=�E�!.�&�!8�(*�1�V�a�Z�=�(9��!.�(�!:�(.�q��!��F�R�K�/H�(I��!.�%�!7�),�A�v��z�(:��()�&�1�*�V�a�Z�%�5G�(H��!.�'�!9�)-�S��F�Q�J�-?�(@��(,�� #�	�	�$[�_j�ly�^z�$z�!|� 05�D�1��I�g�.�G5�?+�f���! -�Q�#X� +�T�*�-=�s�[D�#D�C� �.�.�/?��d�3�i�P�P��Q���	�
�Z� �#�'�C����/��d�3�i�@��K��	�sP�=1U"�2D*U"�L/T�
U"�
U�"1U�U"�U�U"�"
V+�,4V&� V+�&V+)+rsr�rprurvr�rwrxrAryrrzr{r|rmr}r~rr�r�r�r6r�r/r�rtr�r�r�r�r�r�rqrrr�r�r�r�r�rr�r�rm)r�)Frh)r�)TF)FN)3r�r�r�r�r�rrr�r�r�r�r�rr,rir�r�r0r�r�r�r�r�r7r�rr
r�rBrrr�rr&r,r0r:r?rBrErbrfr�rOrRr�r^rlr�r�r�r8r3r1rr�s���8!%�L�!��>S�S�j�� �CO�!�4�(_6�B �'�,�2"�H�2
�!�FQ#�f"'�H�>�4�4&'�P$�2�#/�%�#-�JB�8��>8�*;�$;G�z�&�
 �
 �
�� �>�@�>[�|
�{r3rc��SSKnSSKnSn[R[R[R
[R[RS.nSnURUS9nURSSS	S
S9 URSSS
SS9 URSSSSS9 URSSSSUSS9 UR5upg[SR[[55 [U5S:Xa0[[ 5 UR#5 UR$"5 UR&(aSUl[R*"X6R(SS9 [-5 UGH�n[/U5n	[S5 [U5 [S5 U	R15 U	R35GH>n
U
SSS:XdM[SU
-5 U	R5U
S S!9n[7UR955nUHqup�[;U
[<[>45(a[U
5S":�aU
SS"n
[;U
[>5(aS#HnU[AU
5;dMS$n
 O [S%X�5 Ms URH(akU	RKU
S S!9n[U5(aH[S'U
-5 [MU5H(unn[S(RUUS)US*55 M* GM;GM>GMA URN(a�[S,5 U	R35H�n
[S-[QS.RSU
55S-S/S09 U	RUU
5nU[V:Xa0[S1U	RYU
5-5 U	R[U
5 Mr[S2U-5 M� [5 [S35 U	R\HJnUcM[S4RUR^URa5URc555 ML [5 U	Re5nURg5 [5 U	Ri5n[S6U-5 U	RkS75(ab[S85 [S9U	RUS755 [S:U	RYS755 U	RkS;5(a[S<5 [S=5 U	Rl(a<U	RlH+unn[S>RURnU55 M- O[S?5 U	Rq5 GM� g![Ba [DRGS&U
-5 GN
f=f! [DRGS+U
-5 GM�=f![Ba [DRGS55 GN�f=f![Ba [DRGS@U-5 GM�f=f)Az�
Main function when olefile is runs as a script from the command line.
This will open an OLE2 file and display its structure and properties
:return: nothing
rNr�)r��infor�r��criticalz1usage: %prog [options] <filename> [filename2 ...])�usagez-c�
store_true�
check_streamsz*check all streams (for debugging purposes))�action�dest�helpz-p�extract_custompropz$extract all user-defined propertiresz-d�
debug_modez\debug mode, shortcut for -l debug (displays a lot of debug information, for developers only)z-lz
--loglevel�loglevel�storezBlogging level debug/info/warning/error/critical (default=%default))r�r��defaultr�z=olefile version {} {} - https://www.decalage.info/en/olefile
r�z%(levelname)-8s %(message)s)r/r�zD--------------------------------------------------------------------����z%r: propertiesTr��2)r$r:r#r r;r<r=rArBrD�rErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTz
(binary data)z   z&Error while parsing property stream %rz%r: user-defined propertiesz
	{} {}: {}r�r�z3Error while parsing user-defined property stream %rz
Checking streams...�-r)rYrZzsize %dzNOT a stream : type=%dz5Modification/Creation times of all directory entries:z- {}: mtime={} ctime={}zError while parsing metadatazRoot entry name: "%s"�worddocumentzThis is a Word document.ztype of stream 'WordDocument':zsize :z
macros/vbaz%This document may contain VBA macros.z(
Non-fatal issues raised during parsing:r��NonezError while parsing file %r)9r��optparser&r��INFO�WARNING�ERROR�CRITICAL�OptionParser�
add_option�
parse_argsr�r��__version__�__date__rer��
print_help�exitr�r��basicConfigrrrr&r��sorted�itemsrgr*rhr�rr6�	exceptionr�r�r3r�r�r�rBr
rOr0rAr.rbrfr�r�rRr�rqr�r�)r�r��DEFAULT_LOG_LEVEL�
LOG_LEVELSr��parser�optionsr�rjr��
streamnamer��krorr�	variablesr��variable�st_typer2�metar��exctyper�s                        r1�mainr��	s.���!���M�M��L�L��O�O��M�M��$�$�
�J�
@�E�
�
"�
"��
"�
/�F�
���d�<�o�
9��;�
���d�<�6J�A��C�
���d�<�l�
k��m�
���d�L�z�'�Sd�!e��g��'�'�)�O�W�	�
J�
Q�
Q�R]�_g�
h�i��4�y�A�~�
�g���������
����"������j�)9�)9�:�C`�a�����^	D��H�%�C��(�O��(�O��(�O�����!�k�k�m�
��b�>�!�$��.��*�Z�7�8�]� #� 1� 1�*�4� 1� P�� &�u�{�{�}� 5��$)�D�A�)�!�j�%�-@�A�A�#&�q�6�B�;�()�#�2��A�)�!�U�3�3�*L�A�'(�I�a�L�'8�,;��(-�	*L�
"�%��.�%*� 	j�"�5�5�(+�(F�(F�z�`d�(F�(e�I�"�9�~�~� %�&C�j�&P� Q�7@��7K�O�E�8�$)�-�*>�*>�u�h��F_�`h�ip�`q�*r�$s�8L� .�6�/,�D�$�$��-�.�"%�+�+�-�J��#�t�C�H�H�Z�$8�9�#�3�G�!�l�l�:�6�G��,�.��i�#�,�,�z�*B�B�C����z�2��6��@�A�#0���
�I�J������$��3�:�:�5�:�:����(�%�.�.�*:�<�=�(�
�G�
>��'�'�)���	�	��
�G��)�)�+�D��)�D�0�1��z�z�.�)�)��0�1��6����^�8T�U��h����^� <�=��:�:�l�+�+��A�B�
�=�>��!�!�$'�$6�$6�L�G�S��*�+�+�G�,<�,<�c�B�C�%7��f�
��I�I�K�{��4%�]��
�
�&N�Q[�&[�\�]��j��
�
�&[�^h�&h�i�i��F�
>��
�
�<�=�
>��*�	D��M�M�7�(�B�C�C�	D�s��2AW�W�BU$�)U$�A6V
�6C W�AW�+ V.�DW�$"V
�W�	V
�
W�
V+�'W�.W�
W�W�W�"W;�:W;�__main__)NNrh)zr��
__future__rr�r��
__author__�__all__rr�ryr��os.pathr�r�r&r�r�rrhrvr-�xranger�rr��itemsizer�rr*�	NameError�version_inforr�r2r6rrrrrrrrrr	rr
rr
rr�VT_EMPTY�VT_NULLr~r��VT_R4�VT_R8�VT_CY�VT_DATEr��VT_DISPATCHr�r�rn�
VT_UNKNOWN�
VT_DECIMAL�VT_I1r�rr��VT_I8�VT_UI8r�r��VT_VOID�
VT_HRESULT�VT_PTR�VT_SAFEARRAY�	VT_CARRAY�VT_USERDEFINEDr�r�r�ri�	VT_STREAM�
VT_STORAGE�VT_STREAMED_OBJECT�VT_STORED_OBJECT�VT_BLOB_OBJECTrkrjrmr]r5�varsr��keyword�varrrrrrrrrsr}r�r�r�r�r�r�r�RuntimeWarningrrr�rrr�r�r8r3r1�<module>r�sF���8&�x���� �
�	��
�
�E�E�E�E�
�e���D���I�	�;�;�s�����!�
�F�
�[�[�����!�#�
�F�
�[�[�����!�#��F�
�U�
V�V������A����#��!��
#�+�+�A�-��8����!�	,���
�
��
��
�
�
���	�
�����
��������
���
��A�G�Q�u�a��q���%��5�	��1�7�!�k�b�X�"�'�
�
�"�z��j�2�U�b�v�	��"�6�B�e�r��"�6�b�g�
��r�J�"�6�2�l��y���B�8�"�	�"�k�
��b�I�R�*�B�);���B�^�b��2�(�
�	���������(�L�G�S��r��{�e����3��)�4�
��
�������
��:�z	�C�<��1�,�,�
*�"O�	�7�	�	�l�	�X8�X8�t���,P(��
�
�P(�lZ2�Z2�~q�q�p/OD�d�z���F���_P���I���B���J��s#�H%�3H4�%H1�0H1�4I�?I

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 1.1 KB 0644
olefile.cpython-313.pyc File 97.9 KB 0644
Filemanager