Created
April 13, 2016 19:39
-
-
Save nanotechz9l/8a30a0d2fa3e4e595a335ae549cd2db4 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require '/root/Desktop/juniper_hash.rb';#require 'sugar' | |
# Parser script for Sweet tooth! | |
# DL juniper_hash.rb: https://github.com/sventantau/juniper_hash/blob/master/juniper_hash.rb | |
begin | |
unless ARGV.length == 1 | |
puts "Doh! - Missing arguments. A Juniper FW config file must be given as an ARGV! Correct usage below:"#.foreground(:yellow).bright | |
puts "\n#{$0} juniper_fw.conf\n"#.foreground(:white).bright | |
#exit | |
end | |
file = ARGV[0] | |
hash_config = JuniperHash.get_hash(File.open(ARGV[0]).read) | |
text_config = JuniperHash.build_config_from_hash(hash_config) | |
JuniperHash.get_hash(text_config) == hash_config | |
puts hash_config | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
simple ruby script to parse juniper router configuration into nested hash