<s> import re <EOL> from ztag . annotation import Annotation <EOL> from ztag . annotation import OperatingSystem <EOL> from ztag . annotation import Type <EOL> from ztag . annotation import Manufacturer <EOL> from ztag import protocols <EOL> import ztag . test <EOL> class FtpWesternDigital ( Annotation ) : <EOL> protocol = protocols . FTP <EOL> subprotocol = protocols . FTP . BANNER <EOL> port = None <EOL> productDict = { <EOL> "<STR_LIT>" : re . compile ( "<STR_LIT>" , re . IGNORECASE ) , <EOL> "<STR_LIT>" : re . compile ( <EOL> "<STR_LIT>" , <EOL> re . IGNORECASE <EOL> ) <EOL> } <EOL> tests = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : Type . NAS , <EOL> "<STR_LIT>" : Manufacturer . WESTERN_DIGITAL , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : Type . NAS , <EOL> "<STR_LIT>" : Manufacturer . WESTERN_DIGITAL , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } <EOL> } , <EOL> } <EOL> def process ( self , obj , meta ) : <EOL> banner = obj [ "<STR_LIT>" ] <EOL> for product , regex in self . productDict . items ( ) : <EOL> if regex . search ( banner ) : <EOL> meta . global_metadata . device_type = Type . NAS <EOL> meta . global_metadata . product = product <EOL> temp = Manufacturer . WESTERN_DIGITAL <EOL> meta . global_metadata . manufacturer = temp <EOL> return meta <EOL> """<STR_LIT>""" </s>
