summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/ciscosma.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2017-07-03 14:42:53 +0300
committerGitHub <noreply@github.com>2017-07-03 14:42:53 +0300
commitf96d9521a4b435b6c09d11e63e8e5602d7f033e6 (patch)
treeef6ee96e39306bf741ad745a46562480ea9fd8c6 /lib/oxidized/model/ciscosma.rb
parent0f934677a3167d5e27c72c8fda8d61d203aa780f (diff)
parent48d2179b0b3fc4249a871d2b43cbb2a1f2122e0a (diff)
Merge pull request #897 from cd67-usrt/patch-2
Create sma.rb Security Management Appliance CISCO
Diffstat (limited to 'lib/oxidized/model/ciscosma.rb')
-rw-r--r--lib/oxidized/model/ciscosma.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/oxidized/model/ciscosma.rb b/lib/oxidized/model/ciscosma.rb
new file mode 100644
index 0000000..a52e38a
--- /dev/null
+++ b/lib/oxidized/model/ciscosma.rb
@@ -0,0 +1,45 @@
+class CiscoSMA < Oxidized::Model
+
+ # SMA prompt "mail.example.com> "
+ prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/
+ comment '! '
+
+ # Select passphrase display option
+ expect /using loadconfig command\. \[Y\]\>/ do |data, re|
+ send "y\n"
+ data.sub re, ''
+ end
+
+ # handle paging
+ expect /-Press Any Key For More-+.*$/ do |data, re|
+ send " "
+ data.sub re, ''
+ end
+
+ cmd 'version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'showconfig' do |cfg|
+ #Delete hour and date which change each run
+ #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
+ # Delete select passphrase display option
+ cfg.gsub! /Do you want to mask the password\? Files with masked passwords cannot be loaded/, ''
+ cfg.gsub! /^\s+y/, ''
+ # Delete space
+ cfg.gsub! /\n\s{25}/, ''
+ # Delete after line
+ cfg.gsub! /([\/\-,.\w><@]+)(\s{27})/,"\\1"
+ # Add a carriage return
+ cfg.gsub! /([\/\-,.\w><@]+)(\s{6,8})([\/\-,.\w><@]+)/,"\\1\n\\2\\3"
+ # Delete prompt
+ cfg.gsub! /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/, ''
+ cfg
+
+ end
+
+ cfg :ssh do
+ pre_logout "exit"
+ end
+
+end