U /^vc@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__ZsafeZunsafeunknownrr/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)Z 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)iz*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@0iz*int is out of range (need a 128-bit value)zillegal version numberl lLr r ) count TypeErrorreplacestriplen ValueErrorint_ from_bytesobject __setattr__)selfhexbytesbytes_lefieldsr versionr time_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqrrr __init__sx            z UUID.__init__cCs&d|ji}|jtjkr"|jj|d<|SNr r )r r rrvalue)r*Zdrrr __getstate__s   zUUID.__getstate__cCs:t|d|dt|dd|kr.t|dntjdSr8)r(r)rr)r*Zstaterrr __setstate__s zUUID.__setstate__cCst|tr|j|jkStSNZ isinstancer r ZNotImplementedr*Zotherrrr __eq__  z UUID.__eq__cCst|tr|j|jkStSr<r=r>rrr __lt__r@z UUID.__lt__cCst|tr|j|jkStSr<r=r>rrr __gt__r@z UUID.__gt__cCst|tr|j|jkStSr<r=r>rrr __le__r@z UUID.__le__cCst|tr|j|jkStSr<r=r>rrr __ge__r@z UUID.__ge__cCs t|jSr<)hashr r*rrr __hash__z UUID.__hash__cCs|jSr<r rFrrr __int__rHz UUID.__int__cCsd|jjt|fS)Nz%s(%r))Z __class__rstrrFrrr __repr__ rHz UUID.__repr__cCs tddS)NzUUID objects are immutable)r!)r*namer9rrr r) rHzUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)N%032xz%s-%s-%s-%s-%sri rirI)r*r+rrr __str__s  z UUID.__str__cCs|jddS)Nrr)r Zto_bytesrFrrr r,z UUID.bytescCs<|j}|ddd|ddd|ddd|ddS)Nrrrrrr,)r*r,rrr r-s( z UUID.bytes_lecCs|j|j|j|j|j|jfSr<)r0r1r2r3r4r5rFrrr r.s  z UUID.fieldscCs |jd?S)NrrIrFrrr r0#rPz UUID.time_lowcC|jd?d@S)NrrIrFrrr r1'rPz UUID.time_midcCrR)NrrSrIrFrrr r2+rPzUUID.time_hi_versioncCrR)Ni8rIrFrrr r3/rPzUUID.clock_seq_hi_variantcCrR)NrrTrIrFrrr r43rPzUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nrr)r2r1r0rFrrr time7s  z UUID.timecCs|jd@d>|jBS)N?r)r3r4rFrrr r6<s zUUID.clock_seqcCs |jd@S)NlrIrFrrr r5ArPz UUID.nodecCs d|jS)NrNrIrFrrr r+ErPzUUID.hexcCs dt|S)Nz urn:uuid:)rKrFrrr urnIrPzUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nrll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURErFrrr variantMs   z UUID.variantcCs |jtkrt|jd?d@SdS)Nri)r]rZr rFrrr r/Xs z UUID.version)NNNNNN)#rrrZ __slots__rrr7r:r;r?rArBrCrDrGrJrLr)rOZpropertyr,r-r.r0r1r2r3r4rVr6r5r+rXr]r/rrrr 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)pathZCZLC_ALL)stdoutZstderrenv) osshutil subprocessZwhichZpathsepjoinZdictZenvironPopenPIPEZDEVNULL) commandargsrarbrcZ executabler^r`procrrr _popen^s    rjcCs |d@ S)Nlrmacrrr _is_universalrHrmc 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) rjsplitr_lowerrstripranger$r r"rmr% IndexErrorOSError) rgrhZhw_identifiersZ get_indexfirst_local_macrilinewordsiwordrlrrr _find_macs*    r{cCs4d}dD]&}td||dd}|r*|SdSdS)N)shwaddrsethersaddress:slladdr)rz-az-avZifconfigcS|dSNrrryrrr roz#_ifconfig_getnode..r{)Zkeywordsrhrlrrr _ifconfig_getnodes rcCs tdddgdd}|r|SdS)NZipZlinks link/ethercSr|r}rr~rrr rroz_ip_getnode..rrkrrr _ip_getnodesrcCsddl}ddl}z||}Wntk r8YdSXtdd||gdd}|r\|Stdd||gdd}|r~|Stdd|d|gdd}|r|SdS) NrZarpz-ancSdS)Nrrr~rrr rroz_arp_getnode..cSr|r}rr~rrr rroz(%s)cSr|)Nirr~rrr rro)rasocketZ gethostbynameZ gethostnamerur{Zfsencode)rarZip_addrrlrrr _arp_getnodes"rcCstdddgddS)NZlanscanz-aislan0cSr)Nrrr~rrr rroz"_lanscan_getnode..rrrrr _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-iasAddressirnrror)rjr_ZreadlinerrrpZindexr%r$r r r"rmrtru)rvrirxryrwrzrlrrr _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,ZmbcsZipconfigz/allZoem)r_Zencodingz:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rr)rarercctypescreate_string_bufferwindllZkernel32ZGetSystemDirectoryAZinsertr9Zdecoderer^rdrfrur_rpr#rqZ fullmatchr r"rm) rarrcrvZdirsrZbufferZdirrirwr9rlrrr _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)NrZ*rrr) win32wnetnetbiosZNCBZNCBENUMZCommandZ LANA_ENUMZBufferZ_packZNetbiosZ_unpackrsZlengthZResetZNCBRESETZordZlanaZLana_numZNCBASTATZljustZCallnameZADAPTER_STATUSZadapter_addressr$r r'rm) rrrvZncbZadaptersryZstatusr,rlrrr _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)NFZdarwinZ.ri ZuuidZwinZcuuid_generate_time_safecs d}|}t|j|fSNrrr,raw)_bufferZres)_uuid_generate_time_saferrr _generate_time_safef rTuuid_generate_timecs d}|t|jdfSrr)r)_uuid_generate_timerrr rqrZUuidCreateSequentialZ UuidCreatez/Could not find fallback ctypes uuid functions: )_has_uuid_generate_time_safesysplatformr raZunameZreleaserp_uuidZgenerate_time_saferZhas_uuid_generate_time_saferZ ctypes.utilZ startswithZappendZCDLLZutilZ find_libraryZ ExceptionZhasattrrrZrestyperZrpcrt4Zgetattr _UuidCreatewarningsZwarnZ ImportWarning)Z _libnamesZlibnameZlibZexcrr)rrrr _load_system_functions8sT&          rcCstt\}}t|djS)NrQ)rrr r5) uuid_timeZ_rrr _unix_getnodes rcCs:ddl}t|d}t|dkr6tt|jdjSdS)NrrrQ)rrrrr bytes_rr5)rrrrr _windll_getnodes   rcCsddl}|ddBS)Nrrl)random getrandbits)rrrr _random_getnodes rZposixZnt)getterscCsdtdk r tSttgD]H}z |aWnYqYnXtdk rdtkrRdkrnqtSqdS)Nrr)_node_GETTERSr)rZgetterrrr 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)r,r ridl@'Hw rilrrSrrUrTrrW)r.r/) rrrr%rr rVZtime_ns_last_timestamprrr)r5r6rZsafely_generatedr rVZ nanosecondsZ timestamprr0r1r2r4r3rrr uuid1s>          rcC8ddlm}||jt|d}t|ddddS)Nr)md5utf-8rrr,r/)hashlibrr,digestr ) namespacerMrrErrr uuid3 rcCsttdddS)Nrr r)r raZurandomrrrr uuid4 rPrcCr)Nr)sha1rrrr)rrr,rr )rrMrrErrr uuid5rrz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)6rarrZenumrZ __author__ZsystemZ_AIXZ_DARWINZ_LINUXZ_WINDOWSrYrZr[r\r r&r,rrr rjrmr{rrrrrrrrrrrZ ImportErrorrrrrZ _OS_GETTERSrMrrrrrrrrZ NAMESPACE_DNSZ NAMESPACE_URLZ NAMESPACE_OIDZNAMESPACE_X500rrrr Z/s      " $  T        '