diff options
Diffstat (limited to 'lib/oxidized')
| -rw-r--r-- | lib/oxidized/input/cli.rb | 3 | ||||
| -rw-r--r-- | lib/oxidized/model/asa.rb | 3 | ||||
| -rw-r--r-- | lib/oxidized/model/cumulus.rb | 14 | ||||
| -rw-r--r-- | lib/oxidized/model/datacom.rb | 7 | ||||
| -rw-r--r-- | lib/oxidized/model/pfsense.rb | 27 | ||||
| -rw-r--r-- | lib/oxidized/model/saos.rb | 6 | ||||
| -rw-r--r-- | lib/oxidized/model/timos.rb | 71 | 
7 files changed, 117 insertions, 14 deletions
| diff --git a/lib/oxidized/input/cli.rb b/lib/oxidized/input/cli.rb index fc7f426..660e173 100644 --- a/lib/oxidized/input/cli.rb +++ b/lib/oxidized/input/cli.rb @@ -14,6 +14,9 @@ module Oxidized          d = node.model.get          disconnect          d +      rescue PromptUndetect +        disconnect +        raise        end        def connect_cli diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index 1e45a91..a41348e 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -13,6 +13,9 @@ class ASA < Oxidized::Model    cmd :secret do |cfg|      cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \2'      cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3' +    cfg.gsub! /ikev2 pre-shared-key (\S+)/, 'ikev2 pre-shared-key <secret hidden>' +    cfg.gsub! /ikev2 (remote|local)-authentication pre-shared-key (\S+)/, 'ikev2 \1-authentication pre-shared-key <secret hidden>' +    cfg.gsub! /^(aaa-server TACACS\+ \(\S+\) host.*\n\skey) \S+$/m, '\1 <secret hidden>'      cfg    end diff --git a/lib/oxidized/model/cumulus.rb b/lib/oxidized/model/cumulus.rb index 68d856e..dc6792a 100644 --- a/lib/oxidized/model/cumulus.rb +++ b/lib/oxidized/model/cumulus.rb @@ -1,6 +1,6 @@  class Cumulus < Oxidized::Model -  prompt /^((\w*)@(.*)([>#]\s)+)$/ +  prompt /^((\w*)@(.*)):/    comment  '# ' @@ -22,7 +22,7 @@ class Cumulus < Oxidized::Model      cfg += cmd 'cat /etc/hosts'      cfg += add_comment 'THE INTERFACES' -    cfg += cmd 'cat /etc/network/interfaces' +    cfg += cmd 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-'      cfg += add_comment 'RESOLV.CONF'      cfg += cmd 'cat /etc/resolv.conf' @@ -30,6 +30,9 @@ class Cumulus < Oxidized::Model      cfg += add_comment 'NTP.CONF'      cfg += cmd 'cat /etc/ntp.conf' +    cfg += add_comment 'IP Routes' +    cfg += cmd 'netstat -rn' +      cfg += add_comment 'QUAGGA DAEMONS'      cfg += cmd 'cat /etc/quagga/daemons' @@ -55,10 +58,13 @@ class Cumulus < Oxidized::Model      cfg += cmd 'cat /etc/cumulus/switchd.conf'      cfg += add_comment 'ACL' -    cfg += cmd 'iptables -L' +    cfg += cmd 'iptables -L -n'      cfg += add_comment 'VERSION'      cfg += cmd 'cat /etc/cumulus/etc.replace/os-release' + +    cfg += add_comment 'License' +    cfg += cmd 'cl-license'    end @@ -73,4 +79,4 @@ class Cumulus < Oxidized::Model    end -end
\ No newline at end of file +end diff --git a/lib/oxidized/model/datacom.rb b/lib/oxidized/model/datacom.rb index 54091ed..5dbc080 100644 --- a/lib/oxidized/model/datacom.rb +++ b/lib/oxidized/model/datacom.rb @@ -24,7 +24,12 @@ class DataCom < Oxidized::Model      cfg.cut_head    end -  cfg :telnet, :ssh do +  cfg :ssh do +    password /^Password:\s$/ +    pre_logout 'exit' +  end + +  cfg :telnet do      username /login:\s$/      password /^Password:\s$/      pre_logout 'exit' diff --git a/lib/oxidized/model/pfsense.rb b/lib/oxidized/model/pfsense.rb new file mode 100644 index 0000000..8cb0118 --- /dev/null +++ b/lib/oxidized/model/pfsense.rb @@ -0,0 +1,27 @@ +class PfSense < Oxidized::Model + +  # use other use than 'admin' user, 'admin' user cannot get ssh/exec. See issue #535 +   +  comment  '# ' +   +  #add a comment in the final conf +  def add_comment comment +    "\n###### #{comment} ######\n"  +  end + +  cmd :all do |cfg| +    cfg.each_line.to_a[1..-2].join +  end +   +  #show the persistent configuration +  pre do +    cfg = add_comment 'Configuration' +    cfg += cmd 'cat /cf/conf/config.xml'     +  end +   +  cfg :ssh do +    exec true +    pre_logout 'exit' +  end +  +end diff --git a/lib/oxidized/model/saos.rb b/lib/oxidized/model/saos.rb index cada35b..5d460cf 100644 --- a/lib/oxidized/model/saos.rb +++ b/lib/oxidized/model/saos.rb @@ -17,8 +17,10 @@ class SAOS < Oxidized::Model      username /login:/      password /assword:/    end -  cfg :telnet do + +  cfg :telnet, :ssh do +    post_login 'system shell set more off'      post_login 'system shell session set more off'      pre_logout 'exit'    end -end
\ No newline at end of file +end diff --git a/lib/oxidized/model/timos.rb b/lib/oxidized/model/timos.rb index dc28580..d40e845 100644 --- a/lib/oxidized/model/timos.rb +++ b/lib/oxidized/model/timos.rb @@ -1,8 +1,10 @@  class TiMOS < Oxidized::Model -  # Alcatel-Lucent TiMOS (Timetra) -  # used in SR/ESS/SAS routers -  +  # +  # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent). +  # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP. +  # +    comment  '# '    prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/ @@ -12,26 +14,81 @@ class TiMOS < Oxidized::Model      new_cfg << cfg.each_line.to_a[1..-2].join    end +  # +  # Show the boot options file. +  #    cmd 'show bof' do |cfg|      comment cfg    end +  # +  # Show the system information. +  #    cmd 'show system information' do |cfg| -    # strip uptime +    # +    # Strip uptime. +    #      cfg.sub! /^System Up Time.*\n/, ''      comment cfg    end +  # +  # Show the card state. +  #    cmd 'show card state' do |cfg|      comment cfg    end -  cmd 'show boot-messages' do |cfg| -    cfg.gsub! /\r/, "" +  # +  # Show the boot log. +  # +  cmd 'file type bootlog.txt' do |cfg| +    # +    # Strip carriage returns and backspaces. +    # +    cfg.gsub! /\r/, '' +    cfg.gsub! /[\b][\b][\b]/, "\n" +    comment cfg +  end + +  # +  # Show the running debug configuration. +  # +  cmd 'show debug' do |cfg|      comment cfg    end -  cmd 'admin display-config' +  # +  # Show the saved debug configuration (admin debug-save). +  # +  cmd 'file type config.dbg' do |cfg| +    # +    # Strip carriage returns. +    # +    cfg.gsub! /\r/, '' +    comment cfg +  end + +  # +  # Show the running persistent indices. +  # +  cmd 'admin display-config index' do |cfg| +    # +    # Strip carriage returns. +    # +    cfg.gsub! /\r/, '' +    comment cfg +  end + +  # +  # Show the running configuration. +  # +  cmd 'admin display-config' do |cfg| +    # +    # Strip carriage returns. +    # +    cfg.gsub! /\r/, '' +  end    cfg :telnet do      username /^Login: / | 
