nicinfo 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9c3a6d1d9737c9ae846f04b29351a2fbe1108b8
4
- data.tar.gz: 5d883318b59fb2b3a724e68ef16b639c575795dd
3
+ metadata.gz: 9795d629df0b8254d5212d7e9a7f061a3fd10e67
4
+ data.tar.gz: f0b0c40fbab2073c77359e3455e275fb0e17ef67
5
5
  SHA512:
6
- metadata.gz: d2d70dbb2e402d33e1a2b92d428ecfabe7cf75ac5ea27e62b1d5b89f45172e857a3677ca6786a15a67e1c699ff1806aa7efce0fd1438e4833eba512103a1d03c
7
- data.tar.gz: 43c5b70f9b9ad4d618002a57ad348f11b7ffa31bebca9f5a097feeae45b0d6608b86f492ee6bff87143d7edcf36c5815fa3c901c917dae57499365c5c9480910
6
+ metadata.gz: bd00e71e41d422e1f500cf429f643a58c9baf65e5d345918059a9a103f2f698af2ba6717437023cc702c56f56fdf759aebaa546b5bf269cbf7e9b1574e2a1b9b
7
+ data.tar.gz: 755ecf67a76d635483a4583aa7605aeb88fa5a6f036afe6d92a5fa63240d8b7dc625a12562ba5a1f8ef9d2713e2e5d669d4a4e74dbfb285d4e632e13c38ac519
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "description": "RDAP bootstrap file for Autonomous System Number allocations",
3
- "publication": "2015-08-11T00:09:31Z",
3
+ "publication": "2017-10-05T15:42:54Z",
4
4
  "services": [
5
5
  [
6
6
  [
@@ -324,11 +324,14 @@
324
324
  "58368-59391",
325
325
  "63488-63999",
326
326
  "64000-64098",
327
+ "64297-64395",
327
328
  "131072-132095",
328
329
  "132096-133119",
329
330
  "133120-133631",
330
331
  "133632-134556",
331
- "134557-135580"
332
+ "134557-135580",
333
+ "135581-136505",
334
+ "136506-137529"
332
335
  ],
333
336
  [
334
337
  "https://rdap.apnic.net/"
@@ -1379,7 +1382,9 @@
1379
1382
  "62464-63487",
1380
1383
  "64198-64296",
1381
1384
  "393216-394239",
1382
- "394240-395164"
1385
+ "394240-395164",
1386
+ "395165-396188",
1387
+ "396189-397212"
1383
1388
  ],
1384
1389
  [
1385
1390
  "https://rdap.arin.net/registry",
@@ -1624,6 +1629,7 @@
1624
1629
  "59392-60415",
1625
1630
  "60416-61439",
1626
1631
  "61952-62463",
1632
+ "64396-64495",
1627
1633
  "196608-197631",
1628
1634
  "197632-198655",
1629
1635
  "198656-199679",
@@ -1631,7 +1637,10 @@
1631
1637
  "200192-201215",
1632
1638
  "201216-202239",
1633
1639
  "202240-203263",
1634
- "203264-204287"
1640
+ "203264-204287",
1641
+ "204288-205211",
1642
+ "205212-206235",
1643
+ "206236-207259"
1635
1644
  ],
1636
1645
  [
1637
1646
  "https://rdap.db.ripe.net/"
@@ -2320,7 +2329,10 @@
2320
2329
  "262144-263167",
2321
2330
  "263168-263679",
2322
2331
  "263680-264604",
2323
- "264605-265628"
2332
+ "264605-265628",
2333
+ "265629-266652",
2334
+ "266653-267676",
2335
+ "267677-268700"
2324
2336
  ],
2325
2337
  [
2326
2338
  "https://rdap.lacnic.net/rdap/"
@@ -2328,4 +2340,4 @@
2328
2340
  ]
2329
2341
  ],
2330
2342
  "version": "1.0"
2331
- }
2343
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "description": "RDAP bootstrap file for Domain Name System registrations",
3
- "publication": "2017-10-05T15:42:56Z",
3
+ "publication": "2017-10-31T04:42:05Z",
4
4
  "services": [
5
5
  [
6
6
  [
@@ -8,7 +8,7 @@
8
8
  "net"
9
9
  ],
10
10
  [
11
- "https://rdap-pilot.verisignlabs.com"
11
+ "https://rdap-pilot.verisignlabs.com/rdap/v1/"
12
12
  ]
13
13
  ],
14
14
  [
@@ -37,4 +37,4 @@
37
37
  ]
38
38
  ],
39
39
  "version": "1.0"
40
- }
40
+ }
@@ -18,7 +18,7 @@
18
18
 
19
19
  module NicInfo
20
20
 
21
- VERSION = "1.2.0"
21
+ VERSION = "1.2.1"
22
22
  VERSION_LABEL = "NicInfo v." + VERSION
23
23
  COPYRIGHT = "Copyright (c) 2011-2017 American Registry for Internet Numbers (ARIN)"
24
24
  CONFIG_VERSION = 3
@@ -285,7 +285,7 @@ module NicInfo
285
285
  end
286
286
 
287
287
  # Do an HTTP GET with the path.
288
- def get url, try
288
+ def get url, try, expect_rdap = true
289
289
 
290
290
  data = @cache.get(url)
291
291
  if data == nil
@@ -310,7 +310,7 @@ module NicInfo
310
310
  if @config.config[ NicInfo::SECURITY ][ NicInfo::TRY_INSECURE ]
311
311
  @config.logger.mesg( "Secure connection failed. Trying insecure connection." )
312
312
  uri.scheme = "http"
313
- return get( uri.to_s, try )
313
+ return get( uri.to_s, try, expect_rdap )
314
314
  else
315
315
  raise e
316
316
  end
@@ -319,11 +319,13 @@ module NicInfo
319
319
  case res
320
320
  when Net::HTTPSuccess
321
321
  content_type = res[ "content-type" ].downcase
322
- unless content_type.include?(NicInfo::RDAP_CONTENT_TYPE) or content_type.include?(NicInfo::JSON_CONTENT_TYPE)
323
- raise Net::HTTPServerException.new("Bad Content Type", res)
324
- end
325
- if content_type.include? NicInfo::JSON_CONTENT_TYPE
326
- @config.conf_msgs << "Server responded with non-RDAP content type but it is JSON"
322
+ if expect_rdap
323
+ unless content_type.include?(NicInfo::RDAP_CONTENT_TYPE) or content_type.include?(NicInfo::JSON_CONTENT_TYPE)
324
+ raise Net::HTTPServerException.new("Bad Content Type", res)
325
+ end
326
+ if content_type.include? NicInfo::JSON_CONTENT_TYPE
327
+ @config.conf_msgs << "Server responded with non-RDAP content type but it is JSON"
328
+ end
327
329
  end
328
330
  data = res.body
329
331
  @cache.create_or_update(url, data)
@@ -331,7 +333,7 @@ module NicInfo
331
333
  if res.code == "301" or res.code == "302" or res.code == "303" or res.code == "307" or res.code == "308"
332
334
  res.error! if try >= 5
333
335
  location = res["location"]
334
- return get( location, try + 1)
336
+ return get( location, try + 1, expect_rdap)
335
337
  end
336
338
  res.error!
337
339
  end #end case
@@ -426,7 +428,7 @@ module NicInfo
426
428
 
427
429
  if @config.options.argv[0] == '.'
428
430
  @config.logger.mesg( "Obtaining current IP Address...")
429
- data = get("https://stat.ripe.net/data/whats-my-ip/data.json", 0)
431
+ data = get("https://stat.ripe.net/data/whats-my-ip/data.json", 0, false )
430
432
  json_data = JSON.load(data)
431
433
 
432
434
  if json_data["data"] == nil || json_data["data"]["ip"] == nil
@@ -434,6 +436,7 @@ module NicInfo
434
436
  @config.logger.mesg("Unable to determine your IP Address. You must specify it.")
435
437
  exit
436
438
  elsif
439
+ @config.logger.mesg("Your IP address is " + json_data["data"]["ip"])
437
440
  @config.options.argv[0] = json_data["data"]["ip"]
438
441
  end
439
442
  end
@@ -500,172 +503,6 @@ module NicInfo
500
503
  display_rdap_query( json_data, true )
501
504
  end
502
505
 
503
- =begin
504
- if @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] == nil && !@config.options.url
505
- bootstrap = Bootstrap.new( @config )
506
- qtype = @config.options.query_type
507
- if qtype == QueryType::BY_SERVER_HELP
508
- qtype = guess_query_value_type( @config.options.argv )
509
- end
510
- case qtype
511
- when QueryType::BY_IP4_ADDR
512
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_ip( @config.options.argv[ 0 ] )
513
- when QueryType::BY_IP6_ADDR
514
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_ip( @config.options.argv[ 0 ] )
515
- when QueryType::BY_IP4_CIDR
516
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_ip( @config.options.argv[ 0 ] )
517
- when QueryType::BY_IP6_CIDR
518
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_ip( @config.options.argv[ 0 ] )
519
- when QueryType::BY_AS_NUMBER
520
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_as( @config.options.argv[ 0 ] )
521
- when QueryType::BY_DOMAIN
522
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_domain( @config.options.argv[ 0 ] )
523
- when QueryType::BY_NAMESERVER
524
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_domain( @config.options.argv[ 0 ] )
525
- when QueryType::BY_ENTITY_HANDLE
526
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_entity( @config.options.argv[ 0 ] )
527
- when QueryType::SRCH_ENTITY_BY_NAME
528
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::ENTITY_ROOT_URL ]
529
- when QueryType::SRCH_DOMAIN_BY_NAME
530
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_domain( @config.options.argv[ 0 ] )
531
- when QueryType::SRCH_DOMAIN_BY_NSNAME
532
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_domain( @config.options.argv[ 0 ] )
533
- when QueryType::SRCH_DOMAIN_BY_NSIP
534
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::DOMAIN_ROOT_URL ]
535
- when QueryType::SRCH_NS_BY_NAME
536
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_domain( @config.options.argv[ 0 ] )
537
- when QueryType::SRCH_NS_BY_IP
538
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = bootstrap.find_url_by_ip( @config.options.argv[ 0 ] )
539
- else
540
- @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] = @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::HELP_ROOT_URL ]
541
- end
542
- end
543
-
544
- begin
545
- rdap_url = nil
546
- unless @config.options.url
547
- path = create_resource_url(@config.options.argv, @config.options.query_type)
548
- rdap_url = make_rdap_url(@config.config[NicInfo::BOOTSTRAP][NicInfo::BOOTSTRAP_URL], path)
549
- else
550
- rdap_url = @config.options.argv[0]
551
- end
552
- data = get( rdap_url, 0 )
553
- json_data = JSON.load data
554
- if (ec = json_data[ NicInfo::NICINFO_DEMO_ERROR ]) != nil
555
- res = MyHTTPResponse.new( "1.1", ec, "Demo Exception" )
556
- res["content-type"] = NicInfo::RDAP_CONTENT_TYPE
557
- res.body=data
558
- raise Net::HTTPServerException.new( "Demo Exception", res )
559
- end
560
- inspect_rdap_compliance json_data
561
- cache_self_references json_data
562
- if @config.options.output_json
563
- @config.logger.raw( DataAmount::TERSE_DATA, data, false )
564
- elsif @config.options.json_values
565
- @config.options.json_values.each do |value|
566
- @config.logger.raw( DataAmount::TERSE_DATA, eval_json_value( value, json_data), false )
567
- end
568
- else
569
- Notices.new.display_notices json_data, @config, @config.options.query_type == QueryType::BY_SERVER_HELP
570
- if @config.options.query_type != QueryType::BY_SERVER_HELP
571
- result_type = get_query_type_from_result( json_data )
572
- if result_type != nil
573
- if result_type != @config.options.query_type
574
- @config.logger.mesg( "Query type is " + @config.options.query_type + ". Result type is " + result_type + "." )
575
- else
576
- @config.logger.mesg( "Result type is " + result_type + "." )
577
- end
578
- @config.options.query_type = result_type
579
- elsif json_data[ "errorCode" ] == nil
580
- @config.conf_msgs << "Response has no result type."
581
- end
582
- data_tree = DataTree.new( )
583
- case @config.options.query_type
584
- when QueryType::BY_IP4_ADDR
585
- NicInfo::display_ip( json_data, @config, data_tree )
586
- when QueryType::BY_IP6_ADDR
587
- NicInfo::display_ip( json_data, @config, data_tree )
588
- when QueryType::BY_IP4_CIDR
589
- NicInfo::display_ip( json_data, @config, data_tree )
590
- when QueryType::BY_IP6_CIDR
591
- NicInfo::display_ip( json_data, @config, data_tree )
592
- when QueryType::BY_IP
593
- NicInfo::display_ip( json_data, @config, data_tree )
594
- when QueryType::BY_AS_NUMBER
595
- NicInfo::display_autnum( json_data, @config, data_tree )
596
- when "NicInfo::DsData"
597
- NicInfo::display_ds_data( json_data, @config, data_tree )
598
- when "NicInfo::KeyData"
599
- NicInfo::display_key_data( json_data, @config, data_tree )
600
- when QueryType::BY_DOMAIN
601
- NicInfo::display_domain( json_data, @config, data_tree )
602
- when QueryType::BY_NAMESERVER
603
- NicInfo::display_ns( json_data, @config, data_tree )
604
- when QueryType::BY_ENTITY_HANDLE
605
- NicInfo::display_entity( json_data, @config, data_tree )
606
- when QueryType::SRCH_DOMAINS
607
- NicInfo::display_domains( json_data, @config, data_tree )
608
- when QueryType::SRCH_DOMAIN_BY_NAME
609
- NicInfo::display_domains( json_data, @config, data_tree )
610
- when QueryType::SRCH_DOMAIN_BY_NSNAME
611
- NicInfo::display_domains( json_data, @config, data_tree )
612
- when QueryType::SRCH_DOMAIN_BY_NSIP
613
- NicInfo::display_domains( json_data, @config, data_tree )
614
- when QueryType::SRCH_ENTITY_BY_NAME
615
- NicInfo::display_entities( json_data, @config, data_tree )
616
- when QueryType::SRCH_NS
617
- NicInfo::display_nameservers( json_data, @config, data_tree )
618
- when QueryType::SRCH_NS_BY_NAME
619
- NicInfo::display_nameservers( json_data, @config, data_tree )
620
- when QueryType::SRCH_NS_BY_IP
621
- NicInfo::display_nameservers( json_data, @config, data_tree )
622
- end
623
- @config.save_as_yaml( NicInfo::LASTTREE_YAML, data_tree ) if !data_tree.empty?
624
- show_search_results_truncated json_data
625
- show_conformance_messages
626
- show_helpful_messages json_data, data_tree
627
- end
628
- end
629
- @config.logger.end_run
630
- rescue JSON::ParserError => a
631
- @config.logger.mesg( "Server returned invalid JSON!" )
632
- rescue SocketError => a
633
- @config.logger.mesg(a.message)
634
- rescue ArgumentError => a
635
- @config.logger.mesg(a.message)
636
- rescue Net::HTTPServerException => e
637
- case e.response.code
638
- when "200"
639
- @config.logger.mesg( e.message )
640
- when "401"
641
- @config.logger.mesg("Authorization is required.")
642
- handle_error_response e.response
643
- when "404"
644
- @config.logger.mesg("Query yielded no results.")
645
- handle_error_response e.response
646
- else
647
- @config.logger.mesg("Error #{e.response.code}.")
648
- handle_error_response e.response
649
- end
650
- @config.logger.trace("Server response code was " + e.response.code)
651
- rescue Net::HTTPFatalError => e
652
- case e.response.code
653
- when "500"
654
- @config.logger.mesg("RDAP server is reporting an internal error.")
655
- handle_error_response e.response
656
- when "501"
657
- @config.logger.mesg("RDAP server does not implement the query.")
658
- handle_error_response e.response
659
- when "503"
660
- @config.logger.mesg("RDAP server is reporting that it is unavailable.")
661
- handle_error_response e.response
662
- else
663
- @config.logger.mesg("Error #{e.response.code}.")
664
- handle_error_response e.response
665
- end
666
- @config.logger.trace("Server response code was " + e.response.code)
667
- end
668
- =end
669
506
 
670
507
  end
671
508
 
@@ -872,9 +709,10 @@ SUMMARY
872
709
  NicInfo is a Registry Data Access Protocol (RDAP) client capable of querying RDAP
873
710
  servers containing IP address, Autonomous System, and Domain name information.
874
711
 
875
- The general usage is "nicinfo QUERY_VALUE" where the type of QUERY_VALUE influences the
876
- type of query performed. This program will attempt to guess the type of QUERY_VALUE,
877
- but the QUERY_VALUE type maybe explicitly set using the -t option.
712
+ The general usage is "nicinfo QUERY_VALUE" where the QUERY_VALUE is an IP address,
713
+ autonomous system number, or domain name. The type of query to perform is implicitly
714
+ determined but maybe explicitly set using the -t option. When the QUERY_VALUE is simply
715
+ a dot or period character (e.g. "."), the IP address of the client is implied.
878
716
 
879
717
  Given the type of query to perform, this program will attempt to use the most appropriate
880
718
  RDAP server it can determine, and follow referrals from that server if necessary.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nicinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newton
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.5.1
108
+ rubygems_version: 2.6.11
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: RDAP Client