Ë ^ì³_Ý#Wãó—dZddlmZddlZddlmZddlm Z m Z iZ iZ Gd„de «Z Gd„de «ZGd „d e «Zd „Zd „Zd „Zd„Zedk(re«ye«y)zý Provides access to public OUI and IAB registration data published by the IEEE. More details can be found at the following URLs :- - IEEE Home Page - http://www.ieee.org/ - Registration Authority Home Page - http://standards.ieee.org/regauth/ éN)Ú _open_binary)Ú SubscriberÚ Publishercó—eZdZdZd„Zd„Zy)Ú FileIndexerzš A concrete Subscriber that receives OUI record offset information that is written to an index data file as a set of comma separated records. có²—t|d«rt|d«r||_nt|d«|_tj|jd¬«|_y)z” Constructor. :param index_file: a file-like object or name of index file where index records will be written. ÚreadlineÚtellÚwÚ )ÚlineterminatorN)ÚhasattrÚfhÚopenÚ_csvÚwriter)ÚselfÚ index_files ú5/usr/lib/python3.12/site-packages/netaddr/eui/ieee.pyÚ__init__zFileIndexer.__init__7sB€ô �:˜zÔ *¬w°zÀ6Ô/JØ ˆD�Gä˜: sÓ+ˆDŒGä—k‘k $§'¡'¸$Ô?ˆ� ócó:—|jj|«y)z‡ Receives and writes index data to a CSV data file. :param data: record containing offset record information. N)rÚwriterow)rÚdatas rÚupdatezFileIndexer.updateEs€ð � ‰ ×јTÕ"rN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr©rrrr1s„ñò @ó#rrcó(‡—eZdZdZˆfd„Zd„ZˆxZS)ÚOUIIndexParseraÞ A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size of the record (in bytes). The file processed by this parser is available online from this URL :- - http://standards.ieee.org/regauth/oui/oui.txt This is a sample of the record structure expected:: 00-CA-FE (hex) ACME CORPORATION 00CAFE (base 16) ACME CORPORATION 1 MAIN STREET SPRINGFIELD UNITED STATES c󌕗tt|� «t|d«rt|d«r||_yt |d«|_y)zó Constructor. :param ieee_file: a file-like object or name of file containing OUI records. When using a file-like object always open it in binary mode otherwise offsets will probably misbehave. r r ÚrbN)Úsuperr"rrrr©rÚ ieee_fileÚ __class__s €rrzOUIIndexParser.__init__dó:ø€ô Œn˜dÑ,Ô.ä �9˜jÔ )¬g°iÀÔ.H؈D�Gä˜9 dÓ+ˆD�Grcóê—d}d}d}d}d}d} |jj«}|sn§|r||vrd}|rŒ)||vr‰|�"|j|«|j|«t |«}|jj «t |«z }|j «d} t| j||«d«} | |g}n|t |«z }ŒÄ|j|«|j|«y) z‹ Starts the parsing process which detects records and notifies registered subscribers as it finds each OUI record. TNró(hex)ó-rFé) rr ÚappendÚnotifyÚlenr ÚsplitÚintÚreplace) rÚ skip_headerÚrecordÚsizeÚmarkerÚhyphenÚ empty_stringÚlineÚoffsetÚouiÚindexs rÚparsezOUIIndexParser.parsessõ€ð ˆ ØˆØˆàˆØˆØˆ àØ—7‘7×#Ñ#Ó%ˆDáØá˜v¨™~Ø#� áàà˜‰~àÐ%à—M‘M $Ô'Ø—K‘K Ô'ä˜4“y�ØŸ™Ÿ™›¬#¨d«)Ñ3�Ø—j‘j“l 1‘o�ܘCŸK™K¨° Ó=¸rÓB�Ø ˜‘ðœ˜D› Ñ!�ð7ð< � ‰ �dÔØ � ‰ �FÕr©rrrrrr>Ú __classcell__©r(s@rr"r"Nsø„ñô* ,ö,rr"có(‡—eZdZdZˆfd„Zd„ZˆxZS)ÚIABIndexParseraÛ A concrete Publisher that parses IAB (Individual Address Block) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size of the record (in bytes). The file processed by this parser is available online from this URL :- - http://standards.ieee.org/regauth/oui/iab.txt This is a sample of the record structure expected:: 00-50-C2 (hex) ACME CORPORATION ABC000-ABCFFF (base 16) ACME CORPORATION 1 MAIN STREET SPRINGFIELD UNITED STATES c󌕗tt|� «t|d«rt|d«r||_yt |d«|_y)zó Constructor. :param ieee_file: a file-like object or name of file containing IAB records. When using a file-like object always open it in binary mode otherwise offsets will probably misbehave. r r r$N)r%rCrrrrr&s €rrzIABIndexParser.__init__¸r)rcó„—d}d}d}d}d}d}d} |jj«}|snò|r||vrd}|rŒ)||vro|�"|j|«|j|«|jj «t |«z } |j «d} | } | | g}t |«}nr||vr`|t |«z }|dj||«} |j «d} | j |«d} t| | zd «d z |d<n|t |«z }�Œ|j|«|j|«y) z‹ Starts the parsing process which detects records and notifies registered subscribers as it finds each IAB record. TNrr+s (base 16)r,rFr-é ) rr r.r/r r0r1r3r2)rr4r5r6Ú hex_markerÚ base16_markerr8r9r:r;Ú iab_prefixr=ÚprefixÚsuffixs rr>zIABIndexParser.parseÇsS€ð ˆ ØˆØˆàˆ Ø$ˆ ؈؈ àØ—7‘7×#Ñ#Ó%ˆDáØá˜z¨TÑ1Ø#� áàà˜TÑ!àÐ%Ø—M‘M $Ô'Ø—K‘K Ô'àŸ™Ÿ™›¬#¨d«)Ñ3�Ø!ŸZ™Z›\¨!™_� Ø"�Ø ˜�ܘ4“y‘Ø $Ñ&àœ˜D› Ñ!�Ø ™×*Ñ*¨6°<Ó@�ØŸ™› a™�ØŸ™ fÓ-¨aÑ0�Ü  ¨&¡°"Ó5¸"Ñ<��q’ ðœ˜D› Ñ!�ñCðH � ‰ �dÔØ � ‰ �FÕrr?rAs@rrCrC¢sø„ñô* ,ö3rrCcóh—||«}|jt|««|j«y)z4Generate an index files from the IEEE registry file.N)Úattachrr>)Ú registry_fhÚ index_pathÚparserÚ oui_parsers rÚcreate_index_from_registryrRýs+€á˜ Ó$€JØ×Ñ”k *Ó-Ô.Ø×ÑÕrcó —ttjtjt«d«tjtjt«d«t «ttjtjt«d«tjtjt«d«t «y)z1Create indices for OUI and IAB file based lookupszoui.txtúoui.idxziab.txtúiab.idxN)rRÚ_pathÚjoinÚdirnameÚ__file__r"rCr rrÚcreate_indicesrZsv€äÜ � ‰ ”5—=‘=¤Ó*¨IÓ6Ü � ‰ ”5—=‘=¤Ó*¨IÓ6Üôô Ü � ‰ ”5—=‘=¤Ó*¨IÓ6Ü � ‰ ”5—=‘=¤Ó*¨IÓ6Üõrcó^— tj|D�cgc]}|jd«‘Œc}«D]G}|D�cgc] }t|«‘Œc}\}}}|j |g«||j ||f«ŒI |j «ycc}wcc}w#|j «wxYw)z/Load index from file into index data structure.zUTF-8N)rÚreaderÚdecoder2Ú setdefaultr.Úclose)r=ÚfpÚxÚrowÚ_Úkeyr;r6s rÚ load_indexres˜€ðÜ—;‘;¹2Ó>¹2°a §¡¨Õ 1¸2Ñ>Ö?ˆCÙ36Ó"7±3¨a¤3 q¥6°3Ñ"7Ñ ˆS�&˜$Ø × Ñ ˜S "Ô %Ø �#‰J× Ñ ˜v t˜nÕ -ñ@ð �‰� ùò ?ùÚ"7øð �‰� ús&‚B•B­B»BÁ 1B BÂB,có|—ttttd««ttttd««y)z+Load OUI and IAB lookup indices into memoryrTrUN)reÚ OUI_INDEXrÚ __package__Ú IAB_INDEXr rrÚ load_indicesrjs$€äŒyœ,¤{°IÓ>Ô?ÜŒyœ,¤{°IÓ>Õ?rÚ__main__)rÚos.pathÚpathrVÚcsvrÚnetaddr.compatrÚ netaddr.corerrrgrirr"rCrRrZrerjrr rrÚrqs|ðñ4õÛå'ß.ð € ð € ô#�*ô#ô:Q�YôQôhX�YôXòvò òò@ð  ˆzÒáÕñ…Nr