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
data/README.rdoc ADDED
@@ -0,0 +1,64 @@
1
+ = ViziWhois
2
+
3
+ == Introduction
4
+
5
+ This gem module provides a classes to find the right Regional Internet Registry
6
+ for a given IP Address. The query method will navigate each major RIR until a
7
+ response is found.
8
+
9
+ == Installation
10
+
11
+ Just run:
12
+
13
+ gem install vizi_whois
14
+
15
+ The following code will use a test file that contains a number of IP addresses
16
+ to test the Gowhois method across a variety of RIRs.
17
+
18
+ Once the whois result is received it is passed to the Formatter method. This method
19
+ extracts some of the most common fields from the results. The results from the
20
+ various RIRs are presented in a common presentation format.
21
+
22
+ == Usage
23
+
24
+ require 'vizi_whois'
25
+ require 'logger'
26
+ require 'socket'
27
+
28
+ syslog = Logger.new('./log/system.log',shift_age = 'weekly')
29
+ syslog.info "Starting IP address test file ... >>> "+Time.now.to_s
30
+
31
+ out_file = File.new('./log/output.log', 'w')
32
+
33
+ File.delete('./log/formatted.log') if File.exist?('./log/formatted.log')
34
+ formatted_file = File.new('./log/formatted.log', 'w')
35
+
36
+ # Open test file for reading
37
+ File.open('./data/testfile.txt', 'r') do |file|
38
+ rec_count = 0
39
+ while(line = file.gets) # Read each line of the test file, one IP address per line
40
+ @whoisresult = Vizi::Gowhois.new
41
+ p line.chomp
42
+ rarray = @whoisresult.query(line.chomp)
43
+ @contents = rarray[0]
44
+ out_file.puts '----------------------------------------------------------------'
45
+ out_file.puts '> ' + line
46
+ out_file.puts '>> ' + rarray[1]
47
+ out_file.puts '>>> ' + rarray[2]
48
+ out_file.puts '----------------------------------------------------------------'
49
+ out_file.puts @contents
50
+ @result = Vizi::Formatter.new
51
+ @formatted = @result.parse(@contents, rarray[1], rarray[2])
52
+ p @formatted
53
+ rec_count = rec_count + 1
54
+ end
55
+ syslog.info "Record count is "+rec_count.to_s
56
+ syslog.info "Ending ... >>> "+Time.now.to_s
57
+ end
58
+
59
+ == License
60
+
61
+ This code is made available under the MIT license.
62
+
63
+ All users of this code should read and follow the acceptable use policies for the following
64
+ whois servers; ARIN, RIPE, APNIC, AFRINIC and LACNIC.
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/rdoctask'
4
+ require 'rake/testtask'
5
+
6
+ spec = Gem::Specification.new do |s|
7
+ s.name = "vizi_whois"
8
+ s.version = "0.1.0"
9
+ s.author = "Al Kivi"
10
+ s.email = "al.kivi at vizitrax.com"
11
+ s.homepage = "http://github.com/al-kivi/Vizi_Whois"
12
+ s.summary = "Global whois module to select the right whois server and get response data"
13
+ s.description = "This gem module provides a classes to find the right Regional Internet Registry
14
+ for a given IP Address. The query method will navigate each major RIR until a response is found"
15
+
16
+ s.platform = Gem::Platform::RUBY
17
+ s.has_rdoc = true
18
+ s.extra_rdoc_files = ["README.rdoc"]
19
+
20
+ s.require_path = "lib"
21
+ s.files = %w(README.rdoc Rakefile) + Dir.glob("lib/**/*")
22
+ end
23
+
24
+ Rake::GemPackageTask.new(spec) do |pkg|
25
+ pkg.need_tar = true
26
+ end
27
+
28
+ Rake::RDocTask.new(:rdoc) do |rdoc|
29
+ rdoc.rdoc_dir = 'rdoc'
30
+ rdoc.title = 'HttpLogParser'
31
+ rdoc.options << '--line-numbers' << '--inline-source'
32
+ rdoc.rdoc_files.include('README')
33
+ rdoc.rdoc_files.include('lib/**/*.rb')
34
+ end
35
+
36
+ Rake::TestTask.new do |t|
37
+ t.libs << 'test'
38
+ t.test_files = FileList["test/**/*_test.rb"]
39
+ t.verbose = true
40
+ end
41
+
42
+ task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
43
+ puts "generated latest version"
44
+ end
45
+
data/build_gem1.bat ADDED
@@ -0,0 +1 @@
1
+ gem uninstall vizi_whois
data/build_gem2.bat ADDED
@@ -0,0 +1 @@
1
+ gem build vizi_whois.gemspec
data/build_gem3.bat ADDED
@@ -0,0 +1 @@
1
+ gem install -l vizi_whois-0.1.0.gem
data/data/testfile.txt ADDED
@@ -0,0 +1,4 @@
1
+ 79.142.69.69
2
+ 66.119.167.210
3
+ 219.91.245.192
4
+ 2001:4860:b002::68
@@ -0,0 +1,10 @@
1
+ 79.142.69.69
2
+ 66.119.167.210
3
+ 219.91.245.192
4
+ 80.202.69.59
5
+ 80.202.69.17
6
+ 90.193.221.196
7
+ 69.137.65.100
8
+ 82.169.107.125
9
+ 190.78.99.67
10
+ 212.95.32.92
@@ -0,0 +1,209 @@
1
+ 79.142.69.69
2
+ 66.119.167.210
3
+ 219.91.245.192
4
+ 80.202.69.59
5
+ 80.202.69.17
6
+ 90.193.221.196
7
+ 69.137.65.100
8
+ 82.169.107.125
9
+ 190.78.99.67
10
+ 212.95.32.92
11
+ 173.220.185.51
12
+ 199.67.203.142
13
+ 208.109.78.138
14
+ 213.5.64.179
15
+ 190.16.229.99
16
+ 193.169.86.61
17
+ 219.182.164.129
18
+ 70.51.152.128
19
+ 124.102.42.131
20
+ 72.233.113.82
21
+ 195.207.101.112
22
+ 58.146.110.109
23
+ 124.247.237.98
24
+ 65.175.128.11
25
+ 140.242.16.2
26
+ 99.179.20.30
27
+ 64.213.135.194
28
+ 66.187.233.202
29
+ 76.65.238.109
30
+ 131.107.0.74
31
+ 208.232.182.71
32
+ 71.33.198.39
33
+ 173.243.47.194
34
+ 207.140.148.33
35
+ 69.175.64.222
36
+ 65.208.151.116
37
+ 65.208.151.117
38
+ 65.208.151.112
39
+ 65.208.151.115
40
+ 65.208.151.114
41
+ 65.208.151.113
42
+ 65.208.151.118
43
+ 65.208.151.119
44
+ 109.170.238.130
45
+ 209.112.42.165
46
+ 140.239.93.71
47
+ 84.229.235.58
48
+ 72.163.78.6
49
+ 99.244.48.231
50
+ 128.107.239.233
51
+ 12.234.36.130
52
+ 62.195.191.9
53
+ 76.10.180.195
54
+ 202.177.225.144
55
+ 213.93.41.110
56
+ 24.222.41.77
57
+ 97.74.215.156
58
+ 92.80.222.226
59
+ 66.241.129.203
60
+ 99.247.43.115
61
+ 174.112.107.182
62
+ 116.73.243.118
63
+ 110.76.168.102
64
+ 86.170.165.19
65
+ 217.13.235.187
66
+ 207.245.46.50
67
+ 64.201.163.3
68
+ 49.14.59.215
69
+ 206.248.167.90
70
+ 93.80.218.163
71
+ 71.193.226.253
72
+ 209.208.62.114
73
+ 71.94.250.235
74
+ 69.58.178.59
75
+ 167.206.75.130
76
+ 203.165.4.194
77
+ 122.168.11.227
78
+ 124.124.198.202
79
+ 61.141.204.129
80
+ 41.133.199.182
81
+ 213.157.89.153
82
+ 79.168.8.225
83
+ 94.75.207.170
84
+ 142.177.129.101
85
+ 63.227.30.245
86
+ 74.12.232.94
87
+ 69.77.185.247
88
+ 122.168.212.24
89
+ 122.168.22.106
90
+ 122.176.221.123
91
+ 188.40.42.56
92
+ 77.250.43.196
93
+ 203.110.95.240
94
+ 91.37.251.28
95
+ 173.206.9.21
96
+ 72.8.32.234
97
+ 77.64.128.88
98
+ 74.93.254.250
99
+ 122.170.24.61
100
+ 182.72.16.234
101
+ 84.57.128.254
102
+ 72.39.85.133
103
+ 201.6.224.76
104
+ 63.245.43.94
105
+ 99.232.101.195
106
+ 24.15.244.34
107
+ 94.196.249.52
108
+ 189.121.171.196
109
+ 59.99.138.51
110
+ 69.159.85.62
111
+ 94.196.4.65
112
+ 200.49.159.101
113
+ 79.232.74.57
114
+ 63.148.189.165
115
+ 208.101.238.11
116
+ 94.196.83.25
117
+ 94.196.61.64
118
+ 159.182.1.4
119
+ 84.154.12.152
120
+ 82.171.165.227
121
+ 173.34.215.39
122
+ 71.252.142.57
123
+ 99.231.8.67
124
+ 201.6.225.113
125
+ 93.34.86.160
126
+ 89.203.26.102
127
+ 123.236.185.165
128
+ 216.254.165.165
129
+ 115.242.87.14
130
+ 120.42.46.126
131
+ 85.17.26.67
132
+ 77.211.187.107
133
+ 121.242.77.199
134
+ 99.242.20.86
135
+ 89.145.108.204
136
+ 208.38.172.10
137
+ 74.128.1.3
138
+ 174.91.61.188
139
+ 173.233.70.166
140
+ 202.98.131.121
141
+ 85.17.26.68
142
+ 220.10.126.83
143
+ 66.207.110.2
144
+ 24.114.255.3
145
+ 64.132.13.2
146
+ 180.11.129.29
147
+ 134.159.165.114
148
+ 194.237.142.21
149
+ 76.21.125.184
150
+ 74.13.99.122
151
+ 69.159.213.232
152
+ 99.227.11.73
153
+ 89.28.14.35
154
+ 120.107.172.133
155
+ 67.55.72.165
156
+ 99.232.103.148
157
+ 99.231.8.224
158
+ 66.163.172.45
159
+ 66.163.172.44
160
+ 99.233.13.181
161
+ 74.202.115.42
162
+ 75.69.62.138
163
+ 99.230.119.55
164
+ 118.97.224.2
165
+ 89.123.53.231
166
+ 198.107.114.245
167
+ 24.150.201.50
168
+ 61.196.204.50
169
+ 84.120.97.165
170
+ 200.195.159.226
171
+ 207.219.158.98
172
+ 210.48.147.2
173
+ 76.70.103.11
174
+ 115.242.74.130
175
+ 99.255.39.39
176
+ 99.228.133.167
177
+ 72.93.91.28
178
+ 195.59.90.123
179
+ 200.87.178.34
180
+ 99.255.90.167
181
+ 164.164.82.29
182
+ 122.255.73.11
183
+ 90.227.142.122
184
+ 15.203.169.106
185
+ 71.214.179.197
186
+ 199.126.173.96
187
+ 99.233.117.118
188
+ 188.40.46.56
189
+ 174.93.53.71
190
+ 99.244.248.73
191
+ 81.83.195.143
192
+ 91.42.28.43
193
+ 67.227.173.149
194
+ 124.154.16.92
195
+ 192.168.0.199
196
+ 99.225.159.140
197
+ 74.109.199.27
198
+ 64.180.235.62
199
+ 99.224.208.28
200
+ 72.43.119.235
201
+ 65.93.198.111
202
+ 178.239.58.144
203
+ 192.168.0.197
204
+ 216.18.195.219
205
+ 210.89.35.242
206
+ 128.100.177.120
207
+ 173.33.65.103
208
+ 216.198.159.52
209
+ 188.143.232.65
data/doc/Object.html ADDED
@@ -0,0 +1,200 @@
1
+ <?xml version="1.0" encoding="IBM437"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=IBM437" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Object</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="./index.html">Home</a>
25
+ <a href="./index.html#classes">Classes</a>
26
+ <a href="./index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="./testit_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="testit.rb">testit.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link"></p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-i-find_visit_in_list">#find_visit_in_list</a></li>
69
+
70
+ </ul>
71
+ </div>
72
+
73
+
74
+
75
+ </div>
76
+
77
+ <div id="project-metadata">
78
+
79
+
80
+ <div id="fileindex-section" class="section project-section">
81
+ <h3 class="section-header">Files</h3>
82
+ <ul>
83
+
84
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
85
+
86
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
87
+
88
+ </ul>
89
+ </div>
90
+
91
+
92
+ <div id="classindex-section" class="section project-section">
93
+ <h3 class="section-header">Class/Module Index
94
+ <span class="search-toggle"><img src="./images/find.png"
95
+ height="16" width="16" alt="[+]"
96
+ title="show/hide quicksearch" /></span></h3>
97
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
98
+ <fieldset>
99
+ <legend>Quicksearch</legend>
100
+ <input type="text" name="quicksearch" value=""
101
+ class="quicksearch-field" />
102
+ </fieldset>
103
+ </form>
104
+
105
+ <ul class="link-list">
106
+
107
+ <li><a href="./Vizi.html">Vizi</a></li>
108
+
109
+ <li><a href="./Vizi/LogFormat.html">Vizi::LogFormat</a></li>
110
+
111
+ <li><a href="./Vizi/LogParser.html">Vizi::LogParser</a></li>
112
+
113
+ <li><a href="./Vizi/Visit.html">Vizi::Visit</a></li>
114
+
115
+ <li><a href="./Vizi/VisitList.html">Vizi::VisitList</a></li>
116
+
117
+ <li><a href="./Object.html">Object</a></li>
118
+
119
+ <li><a href="./ParserTest.html">ParserTest</a></li>
120
+
121
+ </ul>
122
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
123
+ </div>
124
+
125
+
126
+ </div>
127
+ </div>
128
+
129
+ <div id="documentation">
130
+ <h1 class="class">Object</h1>
131
+
132
+ <div id="description" class="description">
133
+
134
+ </div><!-- description -->
135
+
136
+
137
+ <div id="5Buntitled-5D" class="documentation-section">
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <!-- Methods -->
147
+
148
+ <div id="public-instance-method-details" class="method-section section">
149
+ <h3 class="section-header">Public Instance Methods</h3>
150
+
151
+
152
+ <div id="find_visit_in_list-method" class="method-detail ">
153
+ <a name="method-i-find_visit_in_list"></a>
154
+
155
+
156
+ <div class="method-heading">
157
+ <span class="method-name">find_visit_in_list</span><span
158
+ class="method-args">(ip)</span>
159
+ <span class="method-click-advice">click to toggle source</span>
160
+ </div>
161
+
162
+
163
+ <div class="method-description">
164
+
165
+
166
+
167
+
168
+
169
+ <div class="method-source-code" id="find_visit_in_list-source">
170
+ <pre>
171
+ <span class="ruby-comment"># File testit.rb, line 18</span>
172
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">find_visit_in_list</span>(<span class="ruby-identifier">ip</span>)
173
+ <span class="ruby-ivar">@visits</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">visit</span><span class="ruby-operator">|</span> <span class="ruby-identifier">visit</span>.<span class="ruby-identifier">ip</span> = <span class="ruby-identifier">ip</span> }
174
+ <span class="ruby-keyword">end</span></pre>
175
+ </div><!-- find_visit_in_list-source -->
176
+
177
+ </div>
178
+
179
+
180
+
181
+
182
+ </div><!-- find_visit_in_list-method -->
183
+
184
+
185
+ </div><!-- public-instance-method-details -->
186
+
187
+ </div><!-- 5Buntitled-5D -->
188
+
189
+
190
+ </div><!-- documentation -->
191
+
192
+ <div id="validator-badges">
193
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
194
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
195
+ Rdoc Generator</a> 2</small>.</p>
196
+ </div>
197
+
198
+ </body>
199
+ </html>
200
+