vizi_whois 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README.rdoc +64 -0
  2. data/Rakefile +45 -0
  3. data/build_gem1.bat +1 -0
  4. data/build_gem2.bat +1 -0
  5. data/build_gem3.bat +1 -0
  6. data/data/testfile.txt +4 -0
  7. data/data/testfile2.txt +10 -0
  8. data/data/testfile3.txt +209 -0
  9. data/doc/Object.html +200 -0
  10. data/doc/ParserTest.html +268 -0
  11. data/doc/README_rdoc.html +128 -0
  12. data/doc/Rakefile.html +148 -0
  13. data/doc/Visit.html +487 -0
  14. data/doc/VisitList.html +385 -0
  15. data/doc/Vizi/LogFormat.html +377 -0
  16. data/doc/Vizi/LogParser.html +551 -0
  17. data/doc/Vizi/Visit.html +487 -0
  18. data/doc/Vizi/VisitList.html +386 -0
  19. data/doc/Vizi.html +168 -0
  20. data/doc/ViziLogFormat.html +382 -0
  21. data/doc/ViziLogParser.html +551 -0
  22. data/doc/created.rid +8 -0
  23. data/doc/docs/Whois_Documentation.doc +0 -0
  24. data/doc/formats/apache-custom-log.pdf +0 -0
  25. data/doc/formats/apache.rtf +238 -0
  26. data/doc/formats/format-descriptions.xls +0 -0
  27. data/doc/formats/w3c-extended.pdf +0 -0
  28. data/doc/formats/w3c-extended.rtf +135 -0
  29. data/doc/images/brick.png +0 -0
  30. data/doc/images/brick_link.png +0 -0
  31. data/doc/images/bug.png +0 -0
  32. data/doc/images/bullet_black.png +0 -0
  33. data/doc/images/bullet_toggle_minus.png +0 -0
  34. data/doc/images/bullet_toggle_plus.png +0 -0
  35. data/doc/images/date.png +0 -0
  36. data/doc/images/find.png +0 -0
  37. data/doc/images/loadingAnimation.gif +0 -0
  38. data/doc/images/macFFBgHack.png +0 -0
  39. data/doc/images/package.png +0 -0
  40. data/doc/images/page_green.png +0 -0
  41. data/doc/images/page_white_text.png +0 -0
  42. data/doc/images/page_white_width.png +0 -0
  43. data/doc/images/plugin.png +0 -0
  44. data/doc/images/ruby.png +0 -0
  45. data/doc/images/tag_green.png +0 -0
  46. data/doc/images/wrench.png +0 -0
  47. data/doc/images/wrench_orange.png +0 -0
  48. data/doc/images/zoom.png +0 -0
  49. data/doc/index.html +112 -0
  50. data/doc/js/darkfish.js +116 -0
  51. data/doc/js/jquery.js +32 -0
  52. data/doc/js/quicksearch.js +114 -0
  53. data/doc/js/thickbox-compressed.js +10 -0
  54. data/doc/lib/vizi/parser_rb.html +63 -0
  55. data/doc/lib/vizi/vizi_tracker_rb.html +63 -0
  56. data/doc/lib/vizi_log_parser_rb.html +56 -0
  57. data/doc/lib/vizi_tracker_rb.html +56 -0
  58. data/doc/rdoc.css +759 -0
  59. data/doc/test/parser_test_rb.html +54 -0
  60. data/doc/test/test_helper_rb.html +56 -0
  61. data/doc/testit_rb.html +63 -0
  62. data/geany_run_script.bat +6 -0
  63. data/lib/vizi/geany_run_script.bat +6 -0
  64. data/lib/vizi/vizi_whois.rb +189 -0
  65. data/lib/vizi_whois.rb +5 -0
  66. data/log/formatted.log +39 -0
  67. data/log/output.log +240 -0
  68. data/log/system.log +20 -0
  69. data/test/parser_test.rb +48 -0
  70. data/test/test_helper.rb +3 -0
  71. data/testgem.rb +44 -0
  72. data/testit.rb +44 -0
  73. data/vizi_whois.gemspec +18 -0
  74. metadata +144 -0
@@ -0,0 +1,48 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
+
3
+ require 'uri'
4
+
5
+ class ParserTest < Test::Unit::TestCase
6
+
7
+ def test_parser_creation
8
+
9
+ parser = HttpLogParser.new
10
+ assert_not_nil parser
11
+ assert_equal 5, parser.formats.size
12
+
13
+ parser = HttpLogParser.new('%h %l %u %t \"%r\" %>s %b')
14
+ assert_not_nil parser
15
+ assert_equal 1, parser.formats.size
16
+
17
+ parser = HttpLogParser.new({
18
+ :common => '%h %l %u %t \"%r\" %>s %b',
19
+ :common_with_virtual => '%v %h %l %u %t \"%r\" %>s %b',
20
+ })
21
+ assert_not_nil parser
22
+ assert_equal 2, parser.formats.size
23
+
24
+ end
25
+
26
+ def test_simple_parsing
27
+
28
+ parser = HttpLogParser.new
29
+ assert_not_nil parser
30
+
31
+ parsed = parser.parse_line('111.222.333.444 - - [21/Apr/2010:01:02:03 +0000] "GET /some/url?some=parameter HTTP/1.1" 302 123 "http://somewhere.com" "Browser (Version 1.0)"')
32
+
33
+ assert_equal '111.222.333.444', parsed[:ip]
34
+ assert_equal '111.222.333.444', parsed[:domain]
35
+ assert_equal '-', parsed[:auth]
36
+ assert_equal '-', parsed[:username]
37
+ assert_equal '21/Apr/2010:01:02:03 +0000', parsed[:datetime]
38
+ assert_equal 'GET /some/url?some=parameter HTTP/1.1', parsed[:request]
39
+ assert_equal '302', parsed[:status]
40
+ assert_equal '123', parsed[:bytecount]
41
+ assert_equal 'http://somewhere.com', parsed[:referer]
42
+ assert_equal 'Browser (Version 1.0)', parsed[:user_agent]
43
+
44
+ assert_equal 11, parsed.size
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require "#{File.expand_path(File.dirname(__FILE__))}/../lib/http_log_parser.rb"
3
+ begin; require 'ruby-debug'; rescue LoadError; end
data/testgem.rb ADDED
@@ -0,0 +1,44 @@
1
+ # This is a sample application that uses the Vizi_whois gem classes
2
+ #
3
+ # This application will read a text file with IP addresses.
4
+ # For each IP address, the whois method will be called and responses received.
5
+ #
6
+ # Author:: Al Kivi <al.kivi@vizitrax.com>
7
+
8
+ ## require 'c:\rails\vizi_whois\lib\vizi_whois'
9
+ require 'vizi_whois'
10
+
11
+ require 'logger'
12
+ require 'socket'
13
+
14
+ syslog = Logger.new('./log/system.log',shift_age = 'weekly')
15
+ syslog.info "Starting IP address test file ... >>> "+Time.now.to_s
16
+
17
+ out_file = File.new('./log/output.log', 'w')
18
+
19
+ File.delete('./log/formatted.log') if File.exist?('./log/formatted.log')
20
+ parse_file = File.new('./log/formatted.log', 'w')
21
+
22
+ # Open test file for reading
23
+ File.open('./data/testfile.txt', 'r') do |file|
24
+ rec_count = 0
25
+ while(line = file.gets) # Read each line of the test file, one IP address per line
26
+ @whoisresult = Vizi::Gowhois.new
27
+ p line.chomp
28
+ rarray = @whoisresult.query(line.chomp)
29
+ @contents = rarray[0]
30
+ out_file.puts '----------------------------------------------------------------'
31
+ out_file.puts '> ' + line
32
+ out_file.puts '>> ' + rarray[1]
33
+ out_file.puts '>>> ' + rarray[2]
34
+ out_file.puts '----------------------------------------------------------------'
35
+ out_file.puts @contents
36
+ @result = Vizi::Formatter.new
37
+ @formatted = @result.parse(@contents, rarray[1], rarray[2])
38
+ p @formatted
39
+ rec_count = rec_count + 1
40
+ end
41
+ syslog.info "Record count is "+rec_count.to_s
42
+ syslog.info "Ending ... >>> "+Time.now.to_s
43
+ end
44
+
data/testit.rb ADDED
@@ -0,0 +1,44 @@
1
+ # This is a sample application that uses the Vizi_whois gem classes
2
+ #
3
+ # This application will read a text file with IP addresses.
4
+ # For each IP address, the whois method will be called and responses received.
5
+ #
6
+ # Author:: Al Kivi <al.kivi@vizitrax.com>
7
+
8
+ require './lib/vizi_whois'
9
+ ## require 'vizi_whois'
10
+
11
+ require 'logger'
12
+ require 'socket'
13
+
14
+ syslog = Logger.new('./log/system.log',shift_age = 'weekly')
15
+ syslog.info "Starting IP address test file ... >>> "+Time.now.to_s
16
+
17
+ out_file = File.new('./log/output.log', 'w')
18
+
19
+ File.delete('./log/formatted.log') if File.exist?('./log/formatted.log')
20
+ parse_file = File.new('./log/formatted.log', 'w')
21
+
22
+ # Open test file for reading
23
+ File.open('./data/testfile.txt', 'r') do |file|
24
+ rec_count = 0
25
+ while(line = file.gets) # Read each line of the test file, one IP address per line
26
+ @whoisresult = Vizi::Gowhois.new
27
+ p line.chomp
28
+ rarray = @whoisresult.query(line.chomp)
29
+ @contents = rarray[0]
30
+ out_file.puts '----------------------------------------------------------------'
31
+ out_file.puts '> ' + line
32
+ out_file.puts '>> ' + rarray[1]
33
+ out_file.puts '>>> ' + rarray[2]
34
+ out_file.puts '----------------------------------------------------------------'
35
+ out_file.puts @contents
36
+ @result = Vizi::Formatter.new
37
+ @formatted = @result.parse(@contents, rarray[1], rarray[2])
38
+ p @formatted
39
+ rec_count = rec_count + 1
40
+ end
41
+ syslog.info "Record count is "+rec_count.to_s
42
+ syslog.info "Ending ... >>> "+Time.now.to_s
43
+ end
44
+
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'vizi_whois'
5
+ s.version = '0.1.0'
6
+ s.summary = "Global whois capability to select the right whois server and get response data"
7
+ s.description = "This gem module provides a classes to find the right Regional Internet Registry
8
+ for a given IP Address. The query method will navigate each major RIR until a response is found.
9
+
10
+ A second class allows the responses from various RIRs to be formatted to a common response format"
11
+ s.files = Dir.glob("**/**/**")
12
+ s.test_files = Dir.glob("test/*_test.rb")
13
+ s.author = "Al Kivi"
14
+ s.homepage = "http://www.vizitrax.com"
15
+ s.email = "al.kivi@vizitrax.com"
16
+ s.has_rdoc = true
17
+ s.required_ruby_version = '>= 1.8.2'
18
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vizi_whois
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Al Kivi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-23 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: |-
22
+ This gem module provides a classes to find the right Regional Internet Registry
23
+ for a given IP Address. The query method will navigate each major RIR until a response is found.
24
+
25
+ A second class allows the responses from various RIRs to be formatted to a common response format
26
+ email: al.kivi@vizitrax.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - doc/Visit.html
35
+ - doc/testit_rb.html
36
+ - doc/Rakefile.html
37
+ - doc/formats/apache.rtf
38
+ - doc/formats/w3c-extended.rtf
39
+ - doc/formats/apache-custom-log.pdf
40
+ - doc/formats/format-descriptions.xls
41
+ - doc/formats/w3c-extended.pdf
42
+ - doc/Vizi/Visit.html
43
+ - doc/Vizi/VisitList.html
44
+ - doc/Vizi/LogFormat.html
45
+ - doc/Vizi/LogParser.html
46
+ - doc/images/bullet_black.png
47
+ - doc/images/bullet_toggle_plus.png
48
+ - doc/images/zoom.png
49
+ - doc/images/bug.png
50
+ - doc/images/wrench_orange.png
51
+ - doc/images/bullet_toggle_minus.png
52
+ - doc/images/loadingAnimation.gif
53
+ - doc/images/macFFBgHack.png
54
+ - doc/images/date.png
55
+ - doc/images/brick_link.png
56
+ - doc/images/tag_green.png
57
+ - doc/images/ruby.png
58
+ - doc/images/page_white_width.png
59
+ - doc/images/find.png
60
+ - doc/images/wrench.png
61
+ - doc/images/page_green.png
62
+ - doc/images/package.png
63
+ - doc/images/plugin.png
64
+ - doc/images/brick.png
65
+ - doc/images/page_white_text.png
66
+ - doc/VisitList.html
67
+ - doc/ViziLogParser.html
68
+ - doc/Object.html
69
+ - doc/Vizi.html
70
+ - doc/created.rid
71
+ - doc/lib/vizi_tracker_rb.html
72
+ - doc/lib/vizi/vizi_tracker_rb.html
73
+ - doc/lib/vizi/parser_rb.html
74
+ - doc/lib/vizi_log_parser_rb.html
75
+ - doc/docs/Whois_Documentation.doc
76
+ - doc/ViziLogFormat.html
77
+ - doc/js/thickbox-compressed.js
78
+ - doc/js/jquery.js
79
+ - doc/js/darkfish.js
80
+ - doc/js/quicksearch.js
81
+ - doc/ParserTest.html
82
+ - doc/index.html
83
+ - doc/test/test_helper_rb.html
84
+ - doc/test/parser_test_rb.html
85
+ - doc/README_rdoc.html
86
+ - doc/rdoc.css
87
+ - geany_run_script.bat
88
+ - data/testfile.txt
89
+ - data/testfile2.txt
90
+ - data/testfile3.txt
91
+ - testgem.rb
92
+ - lib/vizi/geany_run_script.bat
93
+ - lib/vizi/vizi_whois.rb
94
+ - lib/vizi_whois.rb
95
+ - vizi_whois-0.1.0.gem
96
+ - vizi_whois.gemspec
97
+ - build_gem1.bat
98
+ - build_gem3.bat
99
+ - README.rdoc
100
+ - Rakefile
101
+ - log/system.log
102
+ - log/output.log
103
+ - log/formatted.log
104
+ - test/parser_test.rb
105
+ - test/test_helper.rb
106
+ - testit.rb
107
+ - build_gem2.bat
108
+ homepage: http://www.vizitrax.com
109
+ licenses: []
110
+
111
+ post_install_message:
112
+ rdoc_options: []
113
+
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 51
122
+ segments:
123
+ - 1
124
+ - 8
125
+ - 2
126
+ version: 1.8.2
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ requirements: []
137
+
138
+ rubyforge_project:
139
+ rubygems_version: 1.8.5
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: Global whois capability to select the right whois server and get response data
143
+ test_files:
144
+ - test/parser_test.rb