<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 FtpRouterBoard ( Annotation ) : <EOL> protocol = protocols . FTP <EOL> subprotocol = protocols . FTP . BANNER <EOL> port = None <EOL> manufact_1_re = re . compile ( <EOL> "<STR_LIT>" , <EOL> re . IGNORECASE <EOL> ) <EOL> manufact_2_re = re . compile ( <EOL> "<STR_LIT>" , <EOL> re . IGNORECASE <EOL> ) <EOL> product_re = re . compile ( "<STR_LIT>" , re . IGNORECASE ) <EOL> implementation_re = re . compile ( <EOL> "<STR_LIT>" , <EOL> re . IGNORECASE <EOL> ) <EOL> tests = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : Manufacturer . ROUTER_BOARD , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:version>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> } <EOL> def process ( self , obj , meta ) : <EOL> banner = obj [ "<STR_LIT>" ] <EOL> if ( <EOL> self . manufact_1_re . search ( banner ) or <EOL> self . manufact_2_re . search ( banner ) <EOL> ) : <EOL> meta . global_metadata . manufacturer = Manufacturer . ROUTER_BOARD <EOL> product = self . product_re . search ( banner ) . group ( <NUM_LIT:1> ) <EOL> meta . global_metadata . product = product <EOL> meta . local_metadata . product = "<STR_LIT>" <EOL> implementation = self . implementation_re . search ( banner ) <EOL> meta . local_metadata . version = implementation . group ( <NUM_LIT:1> ) <EOL> return meta <EOL> """<STR_LIT>""" </s>
