Skip to content

Commit

Permalink
Merge a51888d into 5f35f38
Browse files Browse the repository at this point in the history
  • Loading branch information
anewton1998 committed Jan 21, 2018
2 parents 5f35f38 + a51888d commit 64bd8c1
Show file tree
Hide file tree
Showing 19 changed files with 1,425 additions and 36 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ gem 'webmock', :require => false, :group => :test

# Added at 2017-12-22 16:26:48 -0500 by andy:
gem "rainbow", "~> 3.0"

# Added at 2018-01-16 15:43:09 -0500 by andy:
gem "jcrvalidator", "= 0.8.3"
17 changes: 12 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.3.8)
big-phoney (0.1.4)
coveralls (0.8.21)
json (>= 1.8, < 3)
simplecov (~> 0.14.1)
Expand All @@ -13,17 +13,23 @@ GEM
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
docile (1.1.5)
email_address_validator (2.0.0)
hashdiff (0.3.7)
jcrvalidator (0.8.3)
addressable (= 2.3.8)
big-phoney (= 0.1.4)
email_address_validator (~> 2.0)
parslet (~> 1.7)
json (2.1.0)
netaddr (1.5.1)
public_suffix (3.0.1)
parslet (1.8.1)
rainbow (3.0.0)
rake (12.3.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
Expand All @@ -42,7 +48,7 @@ GEM
tins (~> 1.0)
thor (0.19.4)
tins (1.16.3)
webmock (3.1.1)
webmock (3.2.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
Expand All @@ -52,6 +58,7 @@ PLATFORMS

DEPENDENCIES
coveralls
jcrvalidator (= 0.8.3)
netaddr
rainbow (~> 3.0)
rake
Expand Down
2 changes: 1 addition & 1 deletion lib/nicinfo/autnum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def display
@config.logger.start_data_item
@config.logger.data_title "[ AS NUMBER ]"
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "autnum", @config )
endNum = NicInfo.get_endAutnum @objectclass
startNum = NicInfo.get_startAutnum @objectclass
if endNum
Expand Down
17 changes: 16 additions & 1 deletion lib/nicinfo/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module NicInfo
IPV6_REGEX = /\A(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\z/
IPV6_HEXCOMPRESS_REGEX = /\A((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)\z/

#File Name Constants
# File Name Constants
LASTTREE_YAML = "lasttree.yaml"
DEMO_DIR = "demo"
BOOTSTRAP_FILE_DIR = "bsfiles"
Expand All @@ -53,6 +53,21 @@ module NicInfo
IPV4_BOOTSTRAP = "ipv4.json"
IPV6_BOOTSTRAP = "ipv6.json"

# JCR Constants
JCR_DIR = "jcr"
RDAP_JCR = "rdap.jcr"
STRICT_RDAP_JCR = "strict.jcr"
JCR_ROOT_ENTITY = "entity_response"
JCR_ROOT_NAMESERVER = "nameserver_response"
JCR_ROOT_DOMAIN = "domain_response"
JCR_ROOT_NETWORK = "network_response"
JCR_ROOT_AUTNUM = "autnum_response"
JCR_ROOT_ERROR = "error_response"
JCR_ROOT_HELP = "help_response"
JCR_ROOT_DOMAIN_SEARCH = "domainSearch_response"
JCR_ROOT_NAMESERVER_SEARCH = "nameserverSearch_response"
JCR_ROOT_ENTITY_SEARCH = "entitySearch_response"

# Config constants
OUTPUT = "output"
MESSAGES = "messages"
Expand Down
29 changes: 29 additions & 0 deletions lib/nicinfo/demo/error-code.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,35 @@
"href":"http://www.example.com/tos.html"
}
]
},
{
"title":"Copyright",
"description":[
"This test data is Copyright (C) 2015-2018 ARIN."
],
"links":[
{
"value":"https://rdap.arin.net/bootstrap/entity/restricted",
"rel":"copyright",
"type":"text/html",
"href":"http://www.example.com/copyright.html"
}
]
},
{
"title":"About",
"description":[
"Questions regarding ARIN's RDAP service should be sent to arin-tech-discuss@arin.net.",
"See our mailing list for more info."
],
"links":[
{
"value":"https://rdap.arin.net/bootstrap/entity/restricted",
"rel":"about",
"type":"text/html",
"href":"https://lists.arin.net/mailman/listinfo/arin-tech-discuss"
}
]
}
],
"errorCode":418,
Expand Down
7 changes: 4 additions & 3 deletions lib/nicinfo/demo/nameservers.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
"nameserverSearchResults": [
{
"handle":"XXXX",
"objectClassName" : "nameserver",
"ldhName":"ns1.xn--fo-5ja.example",
"unicodeName":"foo.example",
"unicodeName":"ns1.foo.example",
"status":[ "active" ],
"ipAddresses":{
"v4":[ "192.0.2.1", "192.0.2.2" ],
Expand Down Expand Up @@ -229,9 +230,9 @@
},
{
"handle":"XXXX2",
"objectClassName":"domain",
"objectClassName":"nameserver",
"ldhName":"ns1.xn--fo-5ja.example",
"unicodeName":"foo.example",
"unicodeName":"ns1.foo.example",
"status":[ "active" ],
"ipAddresses":{
"v4":[ "192.0.2.1", "192.0.2.2" ],
Expand Down
4 changes: 2 additions & 2 deletions lib/nicinfo/demo/ns-simple.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns2.example.com",
"nicInfo_demoHint" : "nicinfo ns2.example.com",
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns2.example.example",
"nicInfo_demoHint" : "nicinfo ns2.example.example",
"rdapConformance":[
"rdap_level_0"
],
Expand Down
4 changes: 2 additions & 2 deletions lib/nicinfo/demo/ns-very-simple.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns1.example.com",
"nicInfo_demoHint" : "nicinfo ns1.example.com",
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns1.example.example",
"nicInfo_demoHint" : "nicinfo ns1.example.example",
"rdapConformance":[
"rdap_level_0"
],
Expand Down
6 changes: 3 additions & 3 deletions lib/nicinfo/demo/ns.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"nicInfo_demoUrl" : "https://rdap.arin.net/bootstrap/nameserver/ns1.xn--fo-5ja.example",
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns1.xn--fo-5ja.example",
"nicInfo_demoHint" : "nicinfo ns1.xn--fo-5ja.example",
"rdapConformance":[
"rdap_level_0"
Expand All @@ -25,9 +25,9 @@
}
],
"handle":"XXXX",
"objectClassName":"entity",
"objectClassName":"nameserver",
"ldhName":"ns1.xn--fo-5ja.example",
"unicodeName":"foo.example",
"unicodeName":"ns1.foo.example",
"status":[ "active" ],
"ipAddresses":{
"v4":[ "192.0.2.1", "192.0.2.2" ],
Expand Down
2 changes: 1 addition & 1 deletion lib/nicinfo/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def display
@config.logger.start_data_item
@config.logger.data_title "[ DOMAIN ]"
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "domain", @config )
@config.logger.terse "Domain Name", NicInfo::get_ldhName( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.datum "I18N Domain Name", NicInfo::get_unicodeName( @objectclass ), NicInfo::AttentionType::SUCCESS
variants = @objectclass[ "variants" ]
Expand Down
21 changes: 15 additions & 6 deletions lib/nicinfo/entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class JCard

attr_accessor :fns, :names, :phones, :emails, :adrs, :kind, :titles, :roles, :orgs

def initialize
def initialize( config )
@config = config
@fns = Array.new
@names = Array.new
@phones = Array.new
Expand All @@ -130,6 +131,11 @@ def get_vcard entity
def process entity
if ( vcard = get_vcard( entity ) ) != nil
vcardElements = vcard[ 1 ]
if vcardElements.size == 0
@config.conf_msgs << "jCard (vCard) is empty."
elsif vcardElements[ 0 ][ 0 ] != "version"
@config.conf_msgs << "jCard (vCard) does not have required version first element."
end
vcardElements.each do |element|
if element[ 0 ] == "fn"
@fns << element[ 3 ]
Expand All @@ -151,7 +157,7 @@ def process entity
if element[ 3 ][ -2 ].instance_of? Array
name << " " << element[ 3 ][ -2 ].join( ' ' )
end
@names << name
@names << name.strip
end
if element[ 0 ] == "tel"
tel = Tel.new
Expand Down Expand Up @@ -217,6 +223,9 @@ def process entity
@orgs << org
end
end
if @fns.empty?
@config.conf_msgs << "jCard (vCard) has no required 'fn' property."
end
end
return self
end
Expand All @@ -232,7 +241,7 @@ class Entity

def initialize config
@config = config
@jcard = JCard.new
@jcard = JCard.new( config )
@common = CommonJson.new config
@entity = nil
@asEvents = Array.new
Expand Down Expand Up @@ -283,12 +292,12 @@ def display
@config.logger.start_data_item
@config.logger.data_title "[ ENTITY ]"
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "entity", @config )
@jcard.fns.each do |fn|
@config.logger.terse "Name", fn, NicInfo::AttentionType::SUCCESS
@config.logger.terse "Common Name", fn, NicInfo::AttentionType::SUCCESS
end
@jcard.names.each do |n|
@config.logger.extra "Name", n, NicInfo::AttentionType::SUCCESS
@config.logger.extra "Formal Name", n, NicInfo::AttentionType::SUCCESS
end
@jcard.orgs.each do |org|
item_value = org.names.join( ", " )
Expand Down
14 changes: 11 additions & 3 deletions lib/nicinfo/ip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ def display
@config.logger.start_data_item
@config.logger.data_title "[ IP NETWORK ]"
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
@config.logger.terse "Start Address", NicInfo.get_startAddress( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.terse "End Address", NicInfo.get_endAddress( @objectclass ), NicInfo::AttentionType::SUCCESS
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "ip network", @config )
start_addr = NicInfo.get_startAddress( @objectclass )
if start_addr.include?( '/' )
@config.conf_msgs << "start IP #{start_addr} is not an IP address (possibly a CIDR)"
end
@config.logger.terse "Start Address", start_addr , NicInfo::AttentionType::SUCCESS
end_addr = NicInfo.get_endAddress( @objectclass )
if end_addr.include?( '/' )
@config.conf_msgs << "end IP #{end_addr} is not an IP address (possibly a CIDR)"
end
@config.logger.terse "End Address", end_addr, NicInfo::AttentionType::SUCCESS
@config.logger.terse "CIDRs", get_CIDRs
@config.logger.datum "IP Version", @objectclass[ "ipVersion" ]
@config.logger.extra "Name", NicInfo.get_name( @objectclass )
Expand Down
Loading

0 comments on commit 64bd8c1

Please sign in to comment.