<s> from ztag . annotation import Annotation <EOL> from ztag . annotation import OperatingSystem <EOL> from ztag import protocols <EOL> import ztag . test <EOL> import re <EOL> class UCLinux ( Annotation ) : <EOL> name = "<STR_LIT>" <EOL> protocol = protocols . FTP <EOL> subprotocol = protocols . FTP . BANNER <EOL> port = None <EOL> product_re = re . compile ( <EOL> "<STR_LIT>" , <EOL> re . IGNORECASE <EOL> ) <EOL> version_re = re . compile ( <EOL> "<STR_LIT>" , <EOL> re . IGNORECASE <EOL> ) <EOL> tests = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : OperatingSystem . UCLINUX , <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 self . product_re . search ( banner ) : <EOL> meta . global_metadata . os = OperatingSystem . UCLINUX <EOL> meta . local_metadata . product = "<STR_LIT>" <EOL> version = self . version_re . search ( banner ) . group ( <NUM_LIT:1> ) <EOL> meta . local_metadata . version = version <EOL> if "<STR_LIT>" in banner : <EOL> meta . tags . append ( "<STR_LIT>" ) <EOL> return meta </s>
