Created
March 24, 2018 00:04
-
-
Save justincjahn/b185969294581dce83bec731fa3c2dee to your computer and use it in GitHub Desktop.
Oxidized NCM: PANOS XML Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PanOS < Oxidized::Model | |
# PaloAlto PAN-OS model # | |
# Modified by https://github.com/justinjahn to output XML from CLI instead of JSON | |
comment '! ' | |
prompt /^[\w.\@:\(\)-]+[#>]\s?$/ | |
cmd :all do |cfg| | |
cfg.each_line.to_a[2..-3].join | |
end | |
cmd 'show system info' do |cfg| | |
cfg.gsub! /^(up)?time:\ .*$/, '' | |
cfg.gsub! /^app-.*?:\ .*$/, '' | |
cfg.gsub! /^av-.*?:\ .*$/, '' | |
cfg.gsub! /^threat-.*?:\ .*$/, '' | |
cfg.gsub! /^wildfire-.*?:\ .*$/, '' | |
cfg.gsub! /^wf-private.*?:\ .*$/, '' | |
cfg.gsub! /^url-filtering.*?:\ .*$/, '' | |
cfg.gsub! /^global-.*?:\ .*$/, '' | |
comment cfg | |
end | |
cmd 'configure' do |cfg| | |
cmd 'show' do |showconfig| | |
cfg = showconfig | |
end | |
send "quit\n" | |
cfg | |
end | |
cfg :ssh do | |
post_login 'set cli pager off' | |
post_login 'set cli config-output-format xml' | |
pre_logout 'quit' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Oxidized folks are working on a way to use the Web API to pull this, but i'm lazy. See ytti/oxidized#440 for more info.