U /^v@sddlZddlZddlZddlmZdZedkZedkZedkZ edkZ dd d d g\Z Z Z ZeZeZGd d d eZGdddZddZddZddZddZddZddZddZddZd d!Zd"d#Zdaa da!z ddl"Z"Wne#k rdZ"YnXd$d%Z$d&d'Z%d(d)Z&d*d+Z'e rFeegZ(n>erXeeegZ(n,e rheegZ(nervegZ(neeeeegZ(ej)d,kre%ge(Z*nej)d-kre&ge(Z*ne(Z*da+dd.d/d0Z,da-d=d1d2Z.d3d4Z/d5d6Z0d7d8Z1ed9Z2ed:Z3ed;Z4ed<Z5dS)>N)EnumzKa-Ping Yee ZAIXZDarwinZLinuxZWindowszreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZdZdZdS)SafeUUIDrN)__name__ __module__ __qualname__safeZunsafeunknownr r /usr/lib64/python3.8/uuid.pyrFsrc@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 lLr r) count TypeErrorreplacestriplen ValueErrorint_ from_bytesobject __setattr__)selfhexbytesbytes_lefieldsr versionrtime_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<|SNr r)r rrr value)r0dr r r __getstate__s   zUUID.__getstate__cCs:t|d|dt|dd|kr.t|dntjdSr>)r.r/rr )r0stater r r __setstate__s zUUID.__setstate__cCst|tr|j|jkStSN isinstancer r NotImplementedr0otherr r r __eq__s  z UUID.__eq__cCst|tr|j|jkStSrDrErHr r r __lt__s  z UUID.__lt__cCst|tr|j|jkStSrDrErHr r r __gt__s  z UUID.__gt__cCst|tr|j|jkStSrDrErHr r r __le__s  z UUID.__le__cCst|tr|j|jkStSrDrErHr r r __ge__s  z UUID.__ge__cCs t|jSrD)hashr r0r r r __hash__sz UUID.__hash__cCs|jSrDr rPr r r __int__sz UUID.__int__cCsd|jjt|fS)Nz%s(%r)) __class__rstrrPr r r __repr__ sz UUID.__repr__cCs tddS)NzUUID objects are immutable)r')r0namer?r r r r/ szUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)N%032xz%s-%s-%s-%s-%sr rrR)r0r1r r r __str__s  z UUID.__str__cCs|jddS)Nrr)r to_bytesrPr r r r2sz UUID.bytescCs<|j}|ddd|ddd|ddd|ddS)Nrrrrrr2)r0r2r r r r3s( z UUID.bytes_lecCs|j|j|j|j|j|jfSrD)r6r7r8r9r:r;rPr r r r4s  z UUID.fieldscCs |jd?S)NrrRrPr r r r6#sz UUID.time_lowcCs|jd?d@S)NrrRrPr r r r7'sz UUID.time_midcCs|jd?d@S)Nr r^rRrPr r r r8+szUUID.time_hi_versioncCs|jd?d@S)N8rRrPr r r r9/szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr!r`rRrPr r r r:3szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nr!r)r8r7r6rPr r r time7s  z UUID.timecCs|jd@d>|jBS)N?r)r9r:rPr r r r<<s zUUID.clock_seqcCs |jd@S)NlrRrPr r r r;Asz UUID.nodecCs d|jS)NrXrRrPr r r r1EszUUID.hexcCs dt|S)Nz urn:uuid:)rUrPr r r urnIszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nr$ll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURErPr r r variantMs   z UUID.variantcCs |jtkrt|jd?d@SdS)Nr%)rirfr rPr r r r5Xs z UUID.version)NNNNNN)#rrr __slots__rr r=rArCrJrKrLrMrNrQrSrVr/r[propertyr2r3r4r6r7r8r9r:rbr<r;r1rdrir5r r r r r Lsb4 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 subprocesswhichpathsepjoindictenvironPopenPIPEDEVNULL) commandargsrsrtru executablermrrprocr 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) rsplitrplowerrstripranger*r r(rr+ IndexErrorOSError) r~rZhw_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)keywordsrrr 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)rssocket gethostbyname gethostnamerrfsencode)rsrZip_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)rrpreadlinerrindexr+r*r&r r(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)rpencoding:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rr)rsreructypescreate_string_bufferwindllZkernel32ZGetSystemDirectoryAinsertr?decoder{rmrxr|rrprr)r fullmatchr r(r) rsrrurdirsrbufferdirrrr?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_unpackrlengthZResetZNCBRESETordZlanaZLana_numZNCBASTATljustZCallnameZADAPTER_STATUSZadapter_addressr*r r-r) rrrZncbZadaptersrstatusr2rr 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)NFdarwin.r Zuuidwincuuid_generate_time_safecs d}|}t|j|fSNrrr2raw)_bufferres)_uuid_generate_time_saferr r _generate_time_safefs rTuuid_generate_timecs d}|t|jdfSrr)r)_uuid_generate_timerr r rqs ZUuidCreateSequentialZ UuidCreatez/Could not find fallback ctypes uuid functions: )_has_uuid_generate_time_safesysplatformr rsunamereleaser_uuidZgenerate_time_saferZhas_uuid_generate_time_saferZ ctypes.util startswithappendZCDLLutilZ find_library ExceptionhasattrrrZrestyperZrpcrt4getattr _UuidCreatewarningswarn ImportWarning)Z _libnamesZlibnamelibexcrr )rrrr _load_system_functions8sT&          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 rposixnt)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)r2rrdl@'Hw r"lrr^r!rar`rrc)r4r5) rrrr+r r rbtime_ns_last_timestamprrr)r;r<rZsafely_generatedrrbZ nanosecondsZ timestamprr6r7r8r:r9r r r uuid1s>          rcCs8ddlm}||jt|d}t|ddddS)Nr)md5utf-8rrr2r5)hashlibrr2digestr ) namespacerWrrOr r r uuid3s rcCsttdddS)Nrrr)r rsurandomr r r r uuid4 srcCs8ddlm}||jt|d}t|ddddS)Nr)sha1rrrr)rrr2rr )rrWrrOr 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)6rsrrenumr __author__systemZ_AIXZ_DARWINZ_LINUX_WINDOWSrerfrgrhr r,r2rrr rrrrrrrrrrrrrr ImportErrorrrrrZ _OS_GETTERSrWrrrrrrrrZ NAMESPACE_DNSZ NAMESPACE_URLZ NAMESPACE_OIDZNAMESPACE_X500r r r r /s      " $  T        '