Sindbad~EG File Manager
3
�fy
� @ s@ d dl mZ d dlmZ d dlZdZdZdZG dd� de�ZdS ) � )�SoSCleanerParser)� SoSMacMapNze((?<!([0-9a-fA-F\'\"]:)|::)([^:|-])?([0-9a-fA-F]{2}(:|-)){7}[0-9a-fA-F]{2}(\'|\")?(\/|\,|\-|\.|\s|$))ze((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-]?[0-9a-fA-F]{4}(:|-)){3}[0-9a-fA-F]{4}(\'|\")?(\/|\,|\-|\.|\s|$)))zW((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-])?(([0-9a-fA-F]{2}([:\-\_])){5,6}([0-9a-fA-F]{2}))))c sT e Zd ZdZdZeeegZdZ dgZ
dZdZg f� fdd � Z
d
d� Zdd
� Z� ZS )�SoSMacParserz!Handles parsing for MAC addressesz
MAC Parser�53:4f:53�534f:53zsos_commands/.*/modinfo.*Zmac_mapFc s t � | _tt| �j||� d S )N)r �mapping�superr �__init__)�self�configZskip_clean_files)� __class__� � /usr/lib/python3.6/mac_parser.pyr 4 s zSoSMacParser.__init__c C sD x|d dkr|dd� }qW x|d dkr:|dd� }q W |j � S )z�Strips away leading and trailing non-alphanum characters from any
matched string to leave us with just the bare MAC addr
r Z0123456789abcdefABCDEF� N���r )�strip)r
�matchr
r
r �reduce_mac_match8 s
zSoSMacParser.reduce_mac_matchc C s� d}xv| j D ]l}dd� tj||tj�D �}|r|t|�7 }x<|D ]4}| j|�}|j| j�r\q@| jj |�}|j
||�}q@W qW ||fS )Nr c S s g | ]}|d �qS )r r
)�.0�mr
r
r �
<listcomp>F s z,SoSMacParser._parse_line.<locals>.<listcomp>)�regex_patterns�re�findall�I�lenr �
startswith�obfuscated_patternsr �get�replace)r
�line�count�patternZmatchesr Zstripped_matchZ new_matchr
r
r �_parse_lineC s
zSoSMacParser._parse_line)r r )�__name__�
__module__�__qualname__�__doc__�name�
IPV6_REG_8HEX�
IPV6_REG_4HEX�IPV4_REGr r Zparser_skip_filesZmap_file_keyZcompile_regexesr r r# �
__classcell__r
r
)r r r ! s r ) Zsos.cleaner.parsersr Zsos.cleaner.mappings.mac_mapr r r) r* r+ r r
r
r
r �<module> s
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists