+
    ¿Ìj$  ã                   ój   € R t Rt^ RIt^ RIt^ RIt^ RIt ! R R]4      tR
R ltR t	R t
RR ltR	 tR# )aI  
xglob

xglob is a python package to list files matching wildcards (*, ?, []),
extending the functionality of the glob module from the standard python
library (https://docs.python.org/2/library/glob.html).

Main features:
- recursive file listing (including subfolders)
- file listing within Zip archives
- helper function to open files specified as arguments, supporting files
  within zip archives encrypted with a password

Author: Philippe Lagadec - http://www.decalage.info
License: BSD, see source code or documentation

For more info and updates: http://www.decalage.info/xglob
z0.07Nc                   ó6   a a€ ] tR t^Dt oRtV 3R ltRtVtV ;t# )ÚPathNotFoundExceptionzBraised if given a fixed file/dir (not a glob) that does not exist c                ó<   <€ \         \        V `  R V,          4       R# )zGiven path does not exist: %rN)Úsuperr   Ú__init__)ÚselfÚpathÚ	__class__s   &&€Úy/home/l0st/web/w4ttz.lol/public_html/toolz/MsgDoxxer/venv/lib/python3.14/site-packages/oletools/thirdparty/xglob/xglob.pyr   ÚPathNotFoundException.__init__F   s   ø€ ÜÔ# TÑ3Ø+¨dÕ2ö	4ó    © )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r	   Ú__classdict__s   @@r
   r   r   D   s   ù‡ € ÙM÷4õ 4r   r   c                óä   € \         P                  ! V 4       UUUUu. uFB  w  r#p\        P                  ! WA4       F"  p\         P                  P                  W%4      NK$  	  KD  	  upppp# u uppppi )zÅ
Recursive glob:
similar to glob.glob, but finds files recursively in all subfolders of path.
path: root directory where to search files
pattern: pattern for filenames, using wildcards, e.g. *.txt
)ÚosÚwalkÚfnmatchÚfilterr   Újoin)r   ÚpatternÚdirpathÚdirnamesÚfilesÚfs   &&    r
   Úrglobr"   O   sY   € ô )+¯ª°¬ö1Ù(5Ñ$ˆG˜uÜ—’ Ö/ˆAô �G‰G�L‰L˜Ö$á/ñ %Ù(5ô1ð 1ùõ 1s   œAA*
c              #  ó  "  € \         P                  P                  V 4      w  rVR8X  d   Rp\         P                  ! V4       FD  w  r4p\        P
                  ! WR4       F$  p\         P                  P                  W64      x € K&  	  KF  	  R# 5i)zÎ
Recursive iglob:
similar to glob.iglob, but finds files recursively in all subfolders of path.
pathname: root directory where to search files followed by pattern for
filenames, using wildcards, e.g. *.txt
Ú Ú.N)r   r   Úsplitr   r   r   r   )Úpathnamer   Úfilespecr   r   r    r!   s   &      r
   Úriglobr)   \   sd   é € ô —W‘W—]‘] 8Ó,�N€Dàˆr„zØˆä$&§G¢G¨D¦MÑ ˆ˜5Ü—’ Ö0ˆAÜ—'‘'—,‘,˜wÓ*Ô*ó 1ó %2ùs   ‚BBc              #  óp   "  € V P                  4       p\        P                  ! W!4       F  pVx € K	  	  R# 5i)zã
iglob in a zip:
similar to glob.iglob, but finds files within a zip archive.
- zipfileobj: zipfile.ZipFile object
- pathname: root directory where to search files followed by pattern for
filenames, using wildcards, e.g. *.txt
N)Únamelistr   r   )Ú
zipfileobjr'   r    r!   s   &&  r
   Úziglobr-   m   s-   é € ð ×ÑÓ!€Eä�^Š^˜EÖ,ˆØŒó -ùs   ‚46c              #  óL  "  € V'       d   \         pM\        P                  pV  FÛ  p\        V4      '       g8   \        P
                  P                  V4      '       g   RV\        V4      3x € KK  V! V4       F„  pVew   \        V\        4      '       g   \        VRR7      p\        P                  ! VR4      p\        Ws4       F  p VP                  W‚4      p	WhV	3x € K  	  VP                  4        K}  RVR3x € K†  	  KÝ  	  R#   \         d   p
YhT
3x €  Rp
?
KY  Rp
?
ii ; i5i)aç  
Open each file provided as argument:
- files is a list of arguments
- if zip_password is None, each file is listed without reading its content.
  Wilcards are supported.
- if not, then each file is opened as a zip archive with the provided password
- then files matching zip_fname are opened from the zip archive

Iterator: yields (container, filename, data) for each file. If zip_password is None, then
only the filename is returned, container and data=None. Otherwise container is the
filename of the container (zip file), and data is the file content (or an exception).
If a given filename is not a glob and does not exist, the triplet
(None, filename, PathNotFoundException) is yielded. (Globs matching nothing
do not trigger exceptions)
NÚutf8)ÚencodingÚr)r)   ÚglobÚiglobÚis_globr   r   Úexistsr   Ú
isinstanceÚbytesÚzipfileÚZipFiler-   ÚreadÚ	ExceptionÚclose)r    Ú	recursiveÚzip_passwordÚ	zip_fnamer3   r(   ÚfilenameÚzÚsubfilenameÚdataÚes   &&&&       r
   Ú
iter_filesrE   {   sü   é € ÷* Ü‰ä—
‘
ˆÛˆÜ�x× Ò ¬¯©¯©¸×)AÒ)AØ˜Ô"7¸Ó"AÐAÒAÙÙ˜hžˆHØÒ'ô " ,´×6Ò6Ü#(¨ÀÔ#G�Lô —O’O H¨cÓ2�ä#)¨!Ö#7�Kð7Ø Ÿv™v kÓ@˜Ø&°TÐ9Ô9ñ	 $8ð —‘–	ð ˜H dÐ*Ô*ó- (ó	 øô( %ô 7Ø&°QÐ6×6Ð6ûð7üs7   ‚AD$ÁA)D$ÃDÃ'D$ÄD!	ÄD	ÄD$ÄD!	Ä!D$c                óþ   € V P                  RR4      P                  RR4      P                  RR4      P                  RR4      P                  RR4      pRV9   ;'       g     RV9   ;'       g    R	V9   ;'       d    R
V9   # )a  determine if given file specification is a single file name or a glob

python's glob and fnmatch can only interpret ?, *, [list], and [ra-nge],
(and combinations: hex_*_[A-Fabcdef0-9]).
The special chars *?[-] can only be escaped using []
--> file_name is not a glob
--> file?name is a glob
--> file* is a glob
--> file[-._]name is a glob
--> file[?]name is not a glob (matches literal "file?name")
--> file[*]name is not a glob (matches literal "file*name")
--> file[-]name is not a glob (matches literal "file-name")
--> file-name is not a glob

Also, obviously incorrect globs are treated as non-globs
--> file[name is not a glob (matches literal "file[name")
--> file]-[name is treated as a glob
    (it is not a valid glob but detecting errors like this requires
     sophisticated regular expression matching)

Python's glob also works with globs in directory-part of path
--> dir-part of path is analyzed just like filename-part
--> thirdparty/*/xglob.py is a (valid) glob

TODO: create a correct regexp to test for validity of ranges
z[*]r$   z[?]z[[]z[]]z[-]Ú*Ú?Ú[Ú])Úreplace)r(   Úcleaneds   & r
   r4   r4   ´   sƒ   € ð: ×Ñ˜u bÓ)×1Ñ1°%¸Ó<ß‘w˜u bÓ)¯'©'°%¸Ó*<¿W¹WÀUÈBÓ=Oð ð �'‰>÷ .ð .˜S G™^÷ .ð .Ø�'‰>×,Ð,˜c W™nð.r   )z*.*)FNrG   )r   Ú__version__r   r   r2   r8   r;   r   r"   r)   r-   rE   r4   r   r   r
   Ú<module>rN      s@   ðñðr €÷
 "× !ô4˜Iô 4ô
1ò+ò"ô3+ôr".r   