Sha256: d600d6837e1ee6b960bb9388bc22271dd0084e18c847e15583205f757604ddc7
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
# This is a sample application that uses the Vizi_whois gem classes # # This application will read a text file with IP addresses. # For each IP address, the whois method will be called and responses received. # # Author:: Al Kivi <al.kivi@vizitrax.com> #require 'c:\rails\vizi_whois\lib\vizi_whois' require 'rubygems' # needed for ruby 1.8.7 require 'vizi_whois' require 'logger' require 'socket' require 'yaml' 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') parse_file = File.new('./log/formatted.log', 'w') p 'starting' # 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 p 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]) @formatted = @formatted.gsub('\n','<br/>') 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vizi_logger-0.1.0 | testit_old.rb |