3 /f]@sddlZdZddddg\ZZZZeZeZ Gddde Z d d Z d d Z d dZddZddZddZddZddZddZdZZyddlZddlZddlZdgZejjdsejdxLeD]DZyejej j!eZ"Wne#k rwYnXe$e"dre"j%ZPqW[ejdkrzreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZd6ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ eddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zed(d)Zed*d+Zed,d-Zed.d/Zed0d1Zed2d3Zed4d5ZdS)7UUIDNcCs|||||gjddkr td|dk rl|jddjdd}|jdjdd}t|dkrbtd t|d }|dk rt|d krtd |d'dd(|d)d*d+|d,d-d.|dd}|dk rt|d krtdtj|dd}|dk r"t|d kr td|\}}} } } } d|ko.d/kns>tdd|koRd0knsbtdd| kovd1knstdd| kod2knstdd| kod3knstdd| kod4knstd| d>| B} |d>|d>B| d>B| d>B| B}|dk rTd|koDd d>knsTtd|dk rd |kord knstd!|d6M}|d7O}|d9M}||d%>O}||jd&<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 stringzbytes is not a 16-char stringbig) byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*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)0z*field 6 out of range (need a 48-bit value)`P@z*int is out of range (need a 128-bit value)zillegal version numberiiiLintrrrrrliirll l lll) count TypeErrorreplacestriplen ValueErrorint_ from_bytes__dict__)selfhexbytesbytes_lefieldsrversiontime_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqr//usr/lib64/python3.6/uuid.py__init__jsZ   6    $    z UUID.__init__cCst|tr|j|jkStS)N) isinstancerrNotImplemented)r"otherr/r/r0__eq__s  z UUID.__eq__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__lt__s  z UUID.__lt__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__gt__s  z UUID.__gt__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__le__s  z UUID.__le__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__ge__s  z UUID.__ge__cCs t|jS)N)hashr)r"r/r/r0__hash__sz UUID.__hash__cCs|jS)N)r)r"r/r/r0__int__sz UUID.__int__cCsd|jjt|fS)Nz%s(%r)) __class____name__str)r"r/r/r0__repr__sz UUID.__repr__cCs tddS)NzUUID objects are immutable)r)r"namevaluer/r/r0 __setattr__szUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)Nz%032xz%s-%s-%s-%s-%sr r)r)r"r#r/r/r0__str__s z UUID.__str__cCs|jjddS)Nrr )rto_bytes)r"r/r/r0r$sz UUID.bytescCs<|j}|ddd|ddd |d d d |ddS) Nrrr r rrrrrrrr)r$)r"r$r/r/r0r%s(z UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r(r)r*r+r,r-)r"r/r/r0r&s z UUID.fieldscCs |jd?S)Nr)r)r"r/r/r0r(sz UUID.time_lowcCs|jd?d@S)Nri)r)r"r/r/r0r)sz UUID.time_midcCs|jd?d@S)Nri)r)r"r/r/r0r*szUUID.time_hi_versioncCs|jd?d@S)N8)r)r"r/r/r0r+szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr rI)r)r"r/r/r0r,szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nir r)r*r)r()r"r/r/r0time sz UUID.timecCs|jd@d>|jBS)N?r )r+r,)r"r/r/r0r.s zUUID.clock_seqcCs |jd@S)Nl)r)r"r/r/r0r-sz UUID.nodecCs d|jS)Nz%032x)r)r"r/r/r0r#szUUID.hexcCs dt|S)Nz urn:uuid:)r?)r"r/r/r0urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nir i@i lll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURE)r"r/r/r0variant s   z UUID.variantcCs |jtkrt|jd?d@SdS)Nr)rQrNr)r"r/r/r0r'+s z UUID.version)NNNNNN)r> __module__ __qualname__r1r5r6r7r8r9r;r<r@rCrFpropertyr$r%r&r(r)r*r+r,rJr.r-r#rLrQr'r/r/r/r0r:s60 O              rc Gsddl}ddl}ddl}|j|}|dkrP|jjd}|j||d}|dkrPdSt|j}d|d<|j|f||j |j |d}|S) Nr/sbin /usr/sbin)pathCLC_ALL)stdoutstderrenv)rVrW) osshutil subprocessZwhichpathsepjoindictenvironPopenPIPEZDEVNULL) commandargsr^r_r` executablerXr]procr/r/r0_popen1s    rkc Csyt|f|j}|sdS|x|jD]z}|jjj}xdtt|D]T}|||krLy*|||}t|jddd} | r| SWqLt t fk rYqLXqLWq*WWdQRXWnt k rYnXdS)N:r) rksplitr[lowerrstriprangerrrr IndexErrorOSError) rgrhZhw_identifiersZ get_indexrjlinewordsiwordmacr/r/r0 _find_macDs$   rycCs0d }x&d D]}td||d d }|r |Sq WdS) Nhwaddretheraddress:lladdrr-a-avZifconfigcSs|dS)Nrr/)rvr/r/r0bsz#_ifconfig_getnode..)rzr{r|r})rr~r)ry)keywordsrhrxr/r/r0_ifconfig_getnode]s  rcCs tdddgdd}|r|SdS)NZiplinks link/ethercSs|dS)Nrr/)rvr/r/r0risz_ip_getnode..)ry)rxr/r/r0 _ip_getnodefsrcCsddl}ddl}y|j|j}Wntk r6dSXtdd|j|gdd}|rZ|Stdd|j|gdd}|r||Stdd|jd|gdd}|r|SdS) NrZarpz-ancSsdS)Nrrr/)rvr/r/r0rvsz_arp_getnode..cSs|dS)Nrr/)rvr/r/r0r{sz(%s)cSs|dS)Nr/)rvr/r/r0rs)r^socketZ gethostbynameZ gethostnamersryfsencode)r^rZip_addrrxr/r/r0 _arp_getnodems rcCstdddgddS)NZlanscanz-aislan0cSsdS)Nrr/)rvr/r/r0rsz"_lanscan_getnode..)ryr/r/r/r0_lanscan_getnodesrc"Csytdd}|sdS||jjjj}y|jd}Wntk rNdSXxt|jD]j}yL|jj}||}t|dkr|jddkrt |j ddd}|r|SWqXtt fk rYqXXqXWWdQRXWnt k rYnXdS) NZnetstatz-iasAddressrlrrmr) rkr[readlinerprnindexrrrrrrrrs)rjrurvrtrwrxr/r/r0_netstat_getnodes,   rc Cs ddl}ddl}ddl}dddg}y:ddl}|jd}|jjj|d|jd|j j dWn YnXx|D]}y$|j |j j |ddg|jd d }Wntk rwpYnX|JxB|jD]8}|jd djj} |jd | rt| jdddSqWWdQRXqpWdS)Nrrzc:\windows\system32zc:\winnt\system32i,mbcsZipconfigz/allZoem)r[encoding:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rrr)r^rer`ctypescreate_string_bufferwindllZkernel32ZGetSystemDirectoryAinsertrBdecodererXrbrfrsr[rnrro fullmatchrr) r^rr`dirsrbufferdirrjrtrBr/r/r0_ipconfig_getnodes*      rcCsddl}ddl}|j}|j|_|j|_}|j|j|dkrHdS|j xt |j D]}|j |j |_t|j||_|j|dkrq\|j |j|_t|j||_djd|_|j|_}|j|dkrq\|j |jdd}t|dkrq\tj|dSWdS)Nr*rr r ) win32wnetnetbiosZNCBZNCBENUMZCommandZ LANA_ENUMZBufferZ_packZNetbiosZ_unpackrqZlengthZResetZNCBRESETordZlanaZLana_numZNCBASTATljustZCallnameZADAPTER_STATUSZadapter_addressrrr )rrZncbZadaptersrvZstatusr$r/r/r0_netbios_getnodes4  rZuuidwincuuid_generate_timedarwin. ZUuidCreateSequentialZ UuidCreatecCs$tjd}t|tt|jdjS)Nr)r$)rr_uuid_generate_timerbytes_rawr-)_bufferr/r/r0_unixdll_getnodes rcCs,tjd}t|dkr(tt|jdjSdS)Nrr)r$)rr _UuidCreaterrrr-)rr/r/r0_windll_getnodes  rcCsddl}|jddBS)Nrr l)random getrandbits)rr/r/r0_random_getnodesrc Cs~tdk r tSddl}|jdkr$t}nt}xP|tgD]B}y |aWnw4YnXtdk r4dtkoldknr4tSq4WdS)NrZwin32rr l)_nodesysplatform_NODE_GETTERS_WIN32_NODE_GETTERS_UNIXr)rZgettersgetterr/r/r0getnode&s    rc Cstr>||kodknr>tjd}t|tt|jdSddl}t|jd}t|dd}tdk r~|tkr~td}|a|dkrddl }|j d}|d @}|d ?d @}|d ?d @} |d@} |d?d@} |dkrt }t||| | | |fddS)Nr)r$rgeAdl@'Hw rlrir irIr rK)r&r') rrrrrrrJr_last_timestamprrr) r-r.rrJZ nanosecondsZ timestamprr(r)r*r,r+r/r/r0uuid1Ds,     rcCs<ddlm}||jt|dddj}t|ddddS) Nr)md5zutf-8F)Zusedforsecurityrr)r$r')hashlibrr$digestr) namespacerArrr/r/r0uuid3gs   rcCsttjdddS)Nrr)r$r')rr^urandomr/r/r/r0uuid4psrcCs8ddlm}||jt|dj}t|ddddS)Nr)sha1zutf-8rr)r$r')rrr$rr)rrArr:r/r/r0uuid5ts rz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)/sxx "           #