U &.e3w@sddlZddlZddlmZdZejdkr4dZZn ddlZeZ e dkZe dkZdd d d g\Z Z Z Z eZeZGd d d eZGdddZddZddZddZddZddZddZddZddZd d!Zd"d#Zdaada z ddl!Z!Wne"k rdZ!YnXd$d%Z#d&d'Z$d(d)Z%d*d+Z&erBeegZ'nJejd,krZeeegZ'n2ejd-krpeegZ'ner~egZ'neeeeegZ'ej(d.kre$ge'Z)nej(d/kre%ge'Z)ne'Z)da*dd0d1d2Z+da,d?d3d4Z-d5d6Z.d7d8Z/d9d:Z0ed;Z1ed<Z2ed=Z3ed>Z4dS)@N)EnumzKa-Ping Yee )win32darwinFZAIXZLinuxzreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZdZdZdS)SafeUUIDrN)__name__ __module__ __qualname__ZsafeZunsafeunknownr r /usr/lib64/python3.8/uuid.pyrHsrc@s6eZdZdZd| B}|d!>| d">B| d#>B|d$>B| B}|dk rDd|kr:d%d&>ksDntd'|dk rd%|krfdkspntd(|d)M}|d*O}|d+M}||d,>O}t |d-|t |d.|dS)/NzGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:zuuid:z{}- z$badly formed hexadecimal UUID stringz bytes_le is not a 16-char stringrzbytes is not a 16-char stringbig) byteorderzfields is not a 6-tuplerlz*field 1 out of range (need a 32-bit value)iz*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)z*field 6 out of range (need a 48-bit value)`P@0z*int is out of range (need a 128-bit value)zillegal version numberl lLrr) count TypeErrorreplacestriplen ValueErrorint_ from_bytesobject __setattr__)selfhexbytesbytes_lefieldsrversionrtime_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqr r r __init__sx            z UUID.__init__cCs&d|ji}|jtjkr"|jj|d<|SNrr)rrrr value)r1dr r r __getstate__s   zUUID.__getstate__cCs:t|d|dt|dd|kr.t|dntjdSr?)r/r0rr )r1stater r r __setstate__s zUUID.__setstate__cCst|tr|j|jkStSN isinstancer rNotImplementedr1otherr r r __eq__s  z UUID.__eq__cCst|tr|j|jkStSrErFrIr r r __lt__s  z UUID.__lt__cCst|tr|j|jkStSrErFrIr r r __gt__s  z UUID.__gt__cCst|tr|j|jkStSrErFrIr r r __le__s  z UUID.__le__cCst|tr|j|jkStSrErFrIr r r __ge__s  z UUID.__ge__cCs t|jSrE)hashrr1r r r __hash__sz UUID.__hash__cCs|jSrErrQr r r __int__sz UUID.__int__cCsd|jjt|fS)Nz%s(%r)) __class__rstrrQr r r __repr__ sz UUID.__repr__cCs tddS)NzUUID objects are immutable)r()r1namer@r r r r0szUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)N%032xz%s-%s-%s-%s-%sr rrS)r1r2r r r __str__s  z UUID.__str__cCs|jddS)Nrr)rto_bytesrQr r r r3sz UUID.bytescCs<|j}|ddd|ddd|ddd|ddS)Nrrrrrr3)r1r3r r r r4s( z UUID.bytes_lecCs|j|j|j|j|j|jfSrE)r7r8r9r:r;r<rQr r r r5 s  z UUID.fieldscCs |jd?S)NrrSrQr r r r7%sz UUID.time_lowcCs|jd?d@S)Nr rSrQr r r r8)sz UUID.time_midcCs|jd?d@S)Nr!r_rSrQr r r r9-szUUID.time_hi_versioncCs|jd?d@S)N8rSrQr r r r:1szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr"rarSrQr r r r;5szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nr"r)r9r8r7rQr r r time9s  z UUID.timecCs|jd@d>|jBS)N?r)r:r;rQr r r r=>s zUUID.clock_seqcCs |jd@S)NlrSrQr r r r<Csz UUID.nodecCs d|jS)NrYrSrQr r r r2GszUUID.hexcCs dt|S)Nz urn:uuid:)rVrQr r r urnKszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nr%ll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURErQr r r variantOs   z UUID.variantcCs |jtkrt|jd?d@SdS)Nr&)rjrgrrQr r r r6Zs z UUID.version)NNNNNN)#rrr __slots__rr r>rBrDrKrLrMrNrOrRrTrWr0r\propertyr3r4r5r7r8r9r:r;rcr=r<r2rerjr6r r r r r Nsb4 V              r c Gsddl}ddl}ddl}||}|dkrP|jd}|j||d}|dkrPdSt|j}d|d<|j|f||j |j |d}|S)Nr)z/sbinz /usr/sbin)pathCLC_ALL)stdoutstderrenv) osshutil subprocessZwhichpathsepjoindictenvironPopenPIPEZDEVNULL) commandargsrtrurv executablernrsprocr r r _popen`s    rcCs |d@ S)Nlr macr r r _is_universalsrc Csd}zt|f|}|s"WdS||jD]}|}tt|D]x}|||krNzN|||} t| ddd} t | r| WW5QRWS|p| }WqNt t fk rYqNXqNq.W5QRXWnt k rYnX|pdS)N:r) rsplitrqlowerrstripranger+rr)rr, IndexErrorOSError) r}r~Zhw_identifiersZ get_indexfirst_local_macrlinewordsiwordrr r r _find_macs*    rcCs4d}dD]&}td||dd}|r*|SdSdS)N)shwaddrsethersaddress:slladdr)rz-az-avZifconfigcSs|dSNr#r rr r r rz#_ifconfig_getnode..r)keywordsr~rr r r _ifconfig_getnodes rcCs tdddgdd}|r|SdS)NZiplinks link/ethercSs|dSrr rr r r rrz_ip_getnode..rrr r r _ip_getnodesrcCsddl}ddl}z||}Wntk r8YdSXtdd||gdd}|r\|Stdd||gdd}|r~|Stdd|d|gdd}|r|SdS) NrZarpz-ancSsdS)Nrr rr r r rrz_arp_getnode..cSs|dSrr rr r r rrz(%s)cSs|dS)Nr rr r r rr)rtsocketZ gethostbynameZ gethostnamerrfsencode)rtrZip_addrrr r r _arp_getnodes"rcCstdddgddS)NZlanscanz-aislan0cSsdS)Nrr rr r r rrz"_lanscan_getnode..rr r r r _lanscan_getnodesrc Cs&d}ztdd}|sWdS||j}z|d}Wn"tk rdYW5QRWdSX|jD]}zl|}||}t|dkr|ddkrt | ddd}t |r|WW5QRWS|p|}Wqltt fk rYqlXqlW5QRXWnt k rYnX|p$dS) NZnetstatz-iasAddressrrrr)rrqreadlinerrindexr,r+r'rr)rrr)rrrrrrrr r r _netstat_getnodes2    rc Cs<ddl}ddl}ddl}d}dddg}z:ddl}|d}|jj|d|d|j dWn YnX|D]}z$|j |j |ddg|jd d }Wntk rYqrYnX|r|jD]d} | d d } |d | rt| ddd} t| r| W5QRS|p"| }qW5QRXqr|p:dS)Nrrzc:\windows\system32zc:\winnt\system32i,mbcsZipconfigz/allZoem)rqencoding:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rr)rtrervctypescreate_string_bufferwindllZkernel32ZGetSystemDirectoryAinsertr@decoder{rnrxr|rrqrr*r fullmatchrr)r) rtrrvrdirsrbufferdirrrr@rr r r _ipconfig_getnodes6       rc Cs6ddl}ddl}d}|}|j|_||_}|||dkrLdS| t |j D]}| |j |_t|j||_||dkrq^| |j|_t|j||_dd|_||_}||dkrq^| |jdd}t|dkrq^t|d}t|r |S|p(|}q^|p4dS)Nr*rrr) win32wnetnetbiosZNCBZNCBENUMZCommandZ LANA_ENUMZBufferZ_packZNetbiosZ_unpackrZlengthZResetZNCBRESETordZlanaZLana_numZNCBASTATljustZCallnameZADAPTER_STATUSZadapter_addressr+rr.r) rrrZncbZadaptersrZstatusr3rr r r _netbios_getnode s>    rc stdk r dSdatjdkr8ttjdddkr8ntdk rPtj a tj adSzddl ddl dg}tjds~|d|D]}zj|}Wntk rYqYnXt|d r|jfd d a d aq qt|d r|jd_fdd a q qz jj}Wnd}YnXt|dt|ddaWn>tk r~}zddl}|d|tW5d}~XYnXdS)NFr.r Zuuidwincuuid_generate_time_safecs d}|}t|j|fSNrrr3raw)_bufferres)_uuid_generate_time_saferr r _generate_time_safehs rTuuid_generate_timecs d}|t|jdfSrr)r)_uuid_generate_timerr r rss ZUuidCreateSequentialZ UuidCreatez/Could not find fallback ctypes uuid functions: )_has_uuid_generate_time_safesysplatformrrtunamereleaser_uuidZgenerate_time_saferZhas_uuid_generate_time_saferZ ctypes.util startswithappendZCDLLutilZ find_library ExceptionhasattrrrZrestyperZrpcrt4getattr _UuidCreatewarningswarn ImportWarning)Z _libnamesZlibnamelibexcrr )rrrr _load_system_functions:sT&          rcCstt\}}t|djS)Nr^)rrr r<) uuid_time_r r r _unix_getnodes rcCs:ddl}t|d}t|dkr6tt|jdjSdS)Nrrr^)rrrrr bytes_rr<)rrr r r _windll_getnodes   rcCsddl}|ddBS)Nrr"l)random getrandbits)rr r r _random_getnodes rrrposixnt)getterscCsdtdk r tSttgD]H}z |aWnYqYnXtdk rdtkrRdkrnqtSqdS)Nrr)_node_GETTERSr)rgetterr r r getnodes     rcCsttdk rd||kr"dkrdnn>t\}}z t|}Wntk rVtj}YnXt||dSddl}|}|dd}tdk r|tkrtd}|a|dkrddl }| d}|d@} |d?d @} |d ?d @} |d @} |d ?d@} |dkrt }t| | | | | |fddS)N)r3rrdl@'Hw r#lrr_r"rbrarrd)r5r6) rrrr,r r rctime_ns_last_timestamprrr)r<r=rZsafely_generatedrrcZ nanosecondsZ timestamprr7r8r9r;r:r r r uuid1s>          rcCs<ddlm}||jt|ddd}t|ddddS) Nr)md5utf-8F)Zusedforsecurityrrr3r6)hashlibrr3digestr ) namespacerXrrr r r uuid3s   rcCsttdddS)Nrrr)r rturandomr r r r uuid4srcCs8ddlm}||jt|d}t|ddddS)Nr)sha1rrrr)rrr3rr )rrXrrPr r r uuid5s rz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)5rtrenumr __author__rZ_AIXZ_LINUXsystemZ_platform_systemrfrgrhrirr-r3rrr rrrrrrrrrrrrrr ImportErrorrrrrZ _OS_GETTERSrXrrrrrrrrZ NAMESPACE_DNSZ NAMESPACE_URLZ NAMESPACE_OIDZNAMESPACE_X500r r r r /s    " $  T          '