Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vizi_whois

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vizi_whois

  • 0.4.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= ViziWhois

== Introduction

This gem module provides a classes to find the right Regional Internet Registry for a given IP Address. The query method will navigate each major RIR until a response is found.

== Installation

Just run:

gem install vizi_whois

The following code will use a test file that contains a number of IP addresses to test the Gowhois method across a variety of RIRs.

Once the whois result is received it is passed to the Formatter method. This method extracts some of the most common fields from the results. The results from the various RIRs are presented in a common presentation format.

== Usage

require 'vizi_whois'
require 'logger'
require 'socket'
 
syslog = Logger.new('./log/system.log',shift_age = 'weekly')
syslog.info "Starting IP address test file ... >>> "+Time.now.to_s

out_file = File.new('./log/output.log', 'w')

File.delete('./log/formatted.log') if File.exist?('./log/formatted.log') 
formatted_file = File.new('./log/formatted.log', 'w')

# Open test file for reading
File.open('./data/testfile.txt', 'r') do |file|
  rec_count = 0
  while(line = file.gets) # Read each line of the test file, one IP address per line
    @whoisresult = Vizi::Gowhois.new
    p line.chomp
    rarray = @whoisresult.query(line.chomp)
    @contents = rarray[0]
    out_file.puts '----------------------------------------------------------------'
    out_file.puts '> ' + line 
    out_file.puts '>> ' + rarray[1]
    out_file.puts '>>> ' + rarray[2]     
    out_file.puts '----------------------------------------------------------------'    
    out_file.puts @contents
    @result = Vizi::Formatter.new
    @formatted = @result.parse(@contents, rarray[1], rarray[2]) 
    p @formatted   
    rec_count = rec_count + 1 
  end
  syslog.info "Record count is "+rec_count.to_s
  syslog.info "Ending ... >>> "+Time.now.to_s
end

== License

This code is made available under the MIT license.

All users of this code should read and follow the acceptable use policies for the following whois servers; ARIN, RIPE, APNIC, AFRINIC and LACNIC.

FAQs

Package last updated on 05 May 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc