class ZyNOS < Oxidized::Model using Refinements prompt /^([\w.@()-<]+[#>]\s?)$/ # if there is something you can not identify after prompt, uncomment next line and comment previous line # prompt /^([\w.@()-<]+[#>]\s?).*$/ comment '! ' # Used in Zyxel DSLAMs, such as SAM1316. Uncomment next line to enable ftp. # cmd 'config-0' # replace next line control sequence with a new line expect /(\e\[1M\e\[\??\d+(;\d+)*[A-Za-z]\e\[1L)|(\eE)/ do |data, re| data.gsub re, "\n" end # replace all used vt100 control sequences expect /\e\[\??\d+(;\d+)*[A-Za-z]/ do |data, re| data.gsub re, '' end # ignore copyright motd expect /^(Copyright .*)\n^([\w.@()-<]+[#>]\s?)$/ do send '\n' "" end cmd :all do |cfg| cfg = cfg.gsub /^\r/, '' # Additional filtering for elder switches sending vt100 control chars via telnet cfg.gsub! /\e\[\??\d+(;\d+)*[A-Za-z]/, '' cfg end # remove snmp community, username, password and admin-password cmd :secret do |cfg| cfg.gsub! /^(snmp-server get-community) \S+(.*)/, '\\1