dns_zone_parser
About
This CLI-driven gem parses DNS Zone files in two ways:
- Parses all records into an array of DNS Record objects
- Outputs a CSV file
Zone file must be formatted in the following fashion:
domain_name time_out IN record_type ip_address
For example, zone files provided by GoDaddy are listed in the above-mentioed format.
Release Notes (v1.0.0)
Installation
gem 'dns_zone_parser'
Terminal Execution
ruby cli_rb path_to_zone_file
Methods
Initializaiton
dns_zone_parser = IdmeDNSZoneParser.new(ARGV[0])
Write to CSV File
A CSV output named parsed_dns_zone.csv can be obtained by running the following command:
dns_zone_parser = IdmeDNSZoneParser.new(ARGV[0])
dns_zone_parser.write_csv_file
Obtain an Array of Records
This gem defines a model known as a Record
. The record has five attributes:
attr_accessor :domain
attr_accessor :time_out
attr_accessor :class_type
attr_accessor :record_type
attr_accessor :ip_address
To obtain an array of all the records as Record
objects in your project, run the following command
dns_zone_parser = IdmeDNSZoneParser.new(ARGV[0])
records = dns_zone_parser.parse
Credit
Created by Arthur Ariel Sabintsev for ID.me