Mpj+ |dZddlmZdZddlZddlZddlZddlZddlZejdk(rejjdejjejjejjeZejjejj%edZeejvrejj)dedd lmZdd lmZdd lmZd ezZej8d ej:dej<dej>dej@dejBdiZ"ej8dej:dej<dej>dej@dejBdiZ#ddddZ$dZ%dZ&dZ'e(dk(re'yy)a_ oledir.py oledir parses OLE files to display technical information about their directory entries, including deleted/orphan streams/storages and unused entries. Author: Philippe Lagadec - http://www.decalage.info License: BSD, see source code or documentation oledir is part of the python-oletools package: http://www.decalage.info/python/oletools )print_functionz0.54NntT) auto_colorsz..) tablestream)xglob) KNOWN_CLSIDSz0oledir %s - http://decalage.info/python/oletoolsEmptyStorageStream ILockBytesIPropertyStorageRootgreencyanyellowmagentared)unusedORPHANc.|tjk(ry|S)N-)olefileNOSTREAM)sids ]/mnt/ssd/data/Dropbox/adrian/scripts/msg_venv/lib/python3.12/site-packages/oletools/oledir.py sid_displayrys g ch|j}|tvr|dt|zz }d}d|vrd}||fS)Nz %srCVEr)upperr)clsid clsid_uppercolors r clsid_displayr%sD++-Kl" ,{333 E ~ 5>rcJ d}tj|}|jdddd|jdd d d dd |jdddd dd |j\}}t |dk(rBt t t t|jtjt t tjdk(r!tjjddt!j"||j$|j&|j(D]^\}}}|r|j+dr|r|d|n|}t d|z|t-j.|}nt-j.|}t1j2gddt0j4} t7t |j8D]Q} |j8| } | 4|j;| } | j<t,j>k(rd} nd} nd } | jjAd!rd"} ntC| jd#d$} tE| jF}tE| jH}tE| jJ}tLjO| j<d%}tPjO| j<d&}tRjO| d&}| jU| | || |||d'| jVz| jXf d||ddddddf (Tt1j2gd)d*t0j4} |j[}d}|j\j^}ta|\}}| jU||d+|fdd,d|f(tc|jed-D]}|d$} tC| d#d$} d}|jg|t,jht,jjfvrd,}d.t |d#z z| z}|jm|} |jo|}|jq|}ta|\}}| jU||||fd|d|f(|jsay#d+}YVxYw)/Nz2usage: oledir [options] [filename2 ...])usagez-r store_true recursivez)find files recursively in subdirectories.)actiondesthelpz-zz--zip zip_passwordstrzhif the file is a zip archive, open all files from it, using the provided password (requires Python 2.6+))r+typedefaultr,z-fz --zipfname zip_fname*zoif the file is a zip archive, file(s) to be opened within the zip. Wildcards * and ? are supported. (default:*)rrT)r reset_atexit)r)r-r1/z in z!OLE directory entries in file %s:) r9r9r6) idStatusTypeNameLeftRightChildz1st SectSize) column_width header_rowstylerrrUnknownrz%X)colors)r5r6&)r;r>rBCLSIDrr)storagesz ):optparse OptionParser add_option parse_argslenprintBANNER__doc__ print_helpsysexitosname colorclassWindowsenabler iter_filesr)r-r1endswithr OleFileIOr TableStreamTableStyleSlimrange direntries_load_direntry entry_type STGTY_EMPTY startswithreprrsid_left sid_right sid_child STORAGE_NAMESgetSTORAGE_COLORS STATUS_COLORS write_row isectStartsizeget_rootentry_namerootr"r%sortedlistdirget_type STGTY_STORAGE STGTY_ROOT_findget_sizegetclsidclose)r'parseroptionsargs containerfilenamedata full_nameoletabler;dstatusr\leftrightchildrh etype_color status_colorrootnameentry_idr" clsid_text clsid_colorentry name_color indented_namerus rmainrsr @E  " " /F d  ##D)C##H-C''5Qe,,.CNN+, ^Br"Ay&&r*<<7#6#66%F%F"vv  (AFF|Ab) +D ,E ,E&**1<<CJ(,,Q\\5AK(,,VU;L OORT4tVWVbVbObdedjdjklKtT4QUW[\  ^; ^@''^6,,.))+"/"6 K 8S*= $fdK@  BCKKK67 JE9D:a#DJ||E"w'<'P>P&QQ#  #e*Q,/$6Myy'H ||E*LL'E&3E&: #J OOX}dJG$(*dK#H  J J& Car s ;RR"__main__))rW __future__r __version__rYr[rPrr]r\r^r_pathnormpathabspathdirname__file___thismodule_dirjoin _parent_dirinsertoletools.thirdparty.tablestreamroletools.thirdparty.xglobroletools.common.clsidrrVrir{ STGTY_STREAMSTGTY_LOCKBYTESSTGTY_PROPERTYr|rorqrrrr%r__name__rrrs L&  77d?$/''""277??277??83L#MNggrww||OTBC chhHHOOA{#7+.