vizi_whois 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/data/testfile.txt +5 -4
- data/lib/vizi/vizi_whois.rb +12 -12
- data/lib/vizi_whois.rb +4 -4
- data/log/formatted.log +44 -31
- data/log/output.log +228 -201
- data/log/system.log +16 -20
- data/log/system.log.20110820 +20 -0
- data/log/system.log.20110903 +7 -0
- data/pkg/vizi_whois-0.1.0/README.rdoc +64 -0
- data/pkg/vizi_whois-0.1.0/Rakefile +45 -0
- data/pkg/vizi_whois-0.1.0/lib/vizi/geany_run_script.bat +6 -0
- data/pkg/vizi_whois-0.1.0/lib/vizi/vizi_whois.rb +189 -0
- data/pkg/vizi_whois-0.1.0/lib/vizi_whois.rb +5 -0
- data/pkg/vizi_whois-0.1.0.gem +0 -0
- data/testit.rb +2 -2
- data/vizi_whois-0.1.0.gem +0 -0
- data/vizi_whois.gemspec +2 -2
- metadata +16 -6
data/data/testfile.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
74.12.40.41
|
2
|
+
74.7.249.38
|
3
|
+
10.131.0.4
|
4
|
+
74.146.62.218
|
5
|
+
144.36.232.162
|
data/lib/vizi/vizi_whois.rb
CHANGED
@@ -107,7 +107,7 @@ module Vizi
|
|
107
107
|
country_list = ["GERMANY","UNITED KINGDOM","UK","ENGLAND","INDIA","NETHERLANDS","SPAIN","BELGIUM","PR CHINA","NORWAY"]
|
108
108
|
odd_list = ["EMAIL","CONTA","PHONE","ABUSE ","SENT ","SEND ","DATE ","ATTN ","INFRA","THIS ","ANTIA","*****","-----"]
|
109
109
|
|
110
|
-
formatted_file = File.open('./log/formatted.log', 'a')
|
110
|
+
# formatted_file = File.open('./log/formatted.log', 'a')
|
111
111
|
|
112
112
|
a = contents.upcase.split(/\n/)
|
113
113
|
i = -1
|
@@ -119,9 +119,9 @@ module Vizi
|
|
119
119
|
netname_count = 0
|
120
120
|
darray = []
|
121
121
|
outstring = ""
|
122
|
-
formatted_file.puts '+ ------------------------------------------------------'
|
123
|
-
formatted_file.puts '+ '+ country + ' - ' + server.upcase
|
124
|
-
formatted_file.puts '+ ------------------------------------------------------'
|
122
|
+
# formatted_file.puts '+ ------------------------------------------------------'
|
123
|
+
# formatted_file.puts '+ '+ country + ' - ' + server.upcase
|
124
|
+
# formatted_file.puts '+ ------------------------------------------------------'
|
125
125
|
while i < a.length-1
|
126
126
|
i = i + 1
|
127
127
|
line = [nil, nil]
|
@@ -140,12 +140,12 @@ module Vizi
|
|
140
140
|
line[0] = lastname
|
141
141
|
end
|
142
142
|
else
|
143
|
-
|
143
|
+
addressflag = true if line[0] == "ADDRESS"
|
144
144
|
end
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
line[1] = line[1].lstrip.gsub(".","")
|
146
|
+
line[1] = line[1].lstrip.gsub(", ",",")
|
147
|
+
line[1] = line[1].lstrip.gsub(" ,",",")
|
148
|
+
line[1] = line[1].chomp(",")
|
149
149
|
country_count = country_count + 1 if line[0] == "COUNTRY"
|
150
150
|
da_count = da_count + 1 if line[0] == "DESCR" or line[0] == "ADDRESS"
|
151
151
|
netname_count = netname_count + 1 if line[0] == "NETNAME"
|
@@ -170,9 +170,9 @@ module Vizi
|
|
170
170
|
lastname = line[0]
|
171
171
|
if goodline
|
172
172
|
if name_list.index(line[0])
|
173
|
-
newline = line[0] + ': ' + line[1]
|
174
|
-
formatted_file.puts '+ ' + newline
|
175
|
-
outstring = outstring + newline
|
173
|
+
newline = line[0] + ': ' + line[1] + '\n'
|
174
|
+
# formatted_file.puts '+ ' + newline
|
175
|
+
outstring = outstring + newline
|
176
176
|
else
|
177
177
|
# formatted_file.puts '. ' + line[0] + ':: ' + line[1]
|
178
178
|
end
|
data/lib/vizi_whois.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
load './lib/vizi/vizi_whois.rb'
|
5
|
-
|
2
|
+
module Vizi # :doc:
|
3
|
+
require 'vizi_whois'
|
4
|
+
## load './lib/vizi/vizi_whois.rb'
|
5
|
+
end
|
data/log/formatted.log
CHANGED
@@ -1,39 +1,52 @@
|
|
1
1
|
+ ------------------------------------------------------
|
2
|
-
+
|
2
|
+
+ US - ARIN
|
3
3
|
+ ------------------------------------------------------
|
4
|
-
+ NETNAME:
|
5
|
-
+
|
6
|
-
+
|
7
|
-
+ ADDRESS:
|
8
|
-
+
|
9
|
-
+
|
4
|
+
+ NETNAME: NET74
|
5
|
+
+ ORGNAME: AMERICAN REGISTRY FOR INTERNET NUMBERS
|
6
|
+
+ ADDRESS: 3635 CONCORDE PARKWAY
|
7
|
+
+ ADDRESS: SUITE 200
|
8
|
+
+ CITY: CHANTILLY
|
9
|
+
+ STATEPROV: VA
|
10
|
+
+ POSTALCODE: 20151
|
11
|
+
+ COUNTRY: US
|
10
12
|
+ ------------------------------------------------------
|
11
13
|
+ US - ARIN
|
12
14
|
+ ------------------------------------------------------
|
13
|
-
+ NETNAME:
|
14
|
-
+ ORGNAME:
|
15
|
-
+ ADDRESS:
|
16
|
-
+ CITY:
|
15
|
+
+ NETNAME: NET144
|
16
|
+
+ ORGNAME: VARIOUS REGISTRIES (MAINTAINED BY ARIN)
|
17
|
+
+ ADDRESS: 3635 CONCORD PARKWAY,SUITE 200
|
18
|
+
+ CITY: CHANTILLY
|
19
|
+
+ STATEPROV: VA
|
20
|
+
+ POSTALCODE: 20151
|
21
|
+
+ COUNTRY: US
|
22
|
+
+ ------------------------------------------------------
|
23
|
+
+ US - ARIN
|
24
|
+
+ ------------------------------------------------------
|
25
|
+
+ NETNAME: COMCAST-VOIP-3
|
26
|
+
+ ORGNAME: COMCAST CABLE COMMUNICATIONS,LLC
|
27
|
+
+ ADDRESS: 1800 BISHOPS GATE BLVD
|
28
|
+
+ CITY: MT LAUREL
|
29
|
+
+ STATEPROV: NJ
|
30
|
+
+ POSTALCODE: 08054
|
31
|
+
+ COUNTRY: US
|
32
|
+
+ ------------------------------------------------------
|
33
|
+
+ US - ARIN
|
34
|
+
+ ------------------------------------------------------
|
35
|
+
+ NETNAME: PRIVATE-ADDRESS-ABLK-RFC1918-IANA-RESERVED
|
36
|
+
+ ORGNAME: INTERNET ASSIGNED NUMBERS AUTHORITY
|
37
|
+
+ ADDRESS: 4676 ADMIRALTY WAY,SUITE 330
|
38
|
+
+ CITY: MARINA DEL REY
|
17
39
|
+ STATEPROV: CA
|
18
|
-
+ POSTALCODE:
|
40
|
+
+ POSTALCODE: 90292-6695
|
19
41
|
+ COUNTRY: US
|
20
42
|
+ ------------------------------------------------------
|
21
|
-
+
|
22
|
-
+ ------------------------------------------------------
|
23
|
-
+ NETNAME:
|
24
|
-
+
|
25
|
-
+
|
26
|
-
+
|
27
|
-
+
|
28
|
-
+
|
29
|
-
+
|
30
|
-
+
|
31
|
-
+ CA - ARIN
|
32
|
-
+ ------------------------------------------------------
|
33
|
-
+ NETNAME: METROBRIDGE-NET
|
34
|
-
+ ORGNAME: METROBRIDGE NETWORKS CORPORATION
|
35
|
-
+ ADDRESS: 918 - 1030 WEST GEORGIA STREET
|
36
|
-
+ CITY: VANCOUVER
|
37
|
-
+ STATEPROV: BC
|
38
|
-
+ POSTALCODE: V6E-2Y3
|
39
|
-
+ COUNTRY: CA
|
43
|
+
+ US - ARIN
|
44
|
+
+ ------------------------------------------------------
|
45
|
+
+ NETNAME: NET74
|
46
|
+
+ ORGNAME: AMERICAN REGISTRY FOR INTERNET NUMBERS
|
47
|
+
+ ADDRESS: 3635 CONCORDE PARKWAY
|
48
|
+
+ ADDRESS: SUITE 200
|
49
|
+
+ CITY: CHANTILLY
|
50
|
+
+ STATEPROV: VA
|
51
|
+
+ POSTALCODE: 20151
|
52
|
+
+ COUNTRY: US
|
data/log/output.log
CHANGED
@@ -1,111 +1,107 @@
|
|
1
1
|
----------------------------------------------------------------
|
2
|
-
>
|
3
|
-
>>
|
4
|
-
>>>
|
2
|
+
> 74.12.40.41
|
3
|
+
>> US
|
4
|
+
>>> arin
|
5
5
|
----------------------------------------------------------------
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
% Information related to '79.142.64.0/20AS49544'
|
46
|
-
|
47
|
-
route: 79.142.64.0/20
|
48
|
-
descr: ALTUSHOST INC.
|
49
|
-
origin: AS49544
|
50
|
-
mnt-by: ALTUSHOST-MNT
|
51
|
-
source: RIPE # Filtered
|
6
|
+
#
|
7
|
+
# The following results may also be obtained via:
|
8
|
+
# http://whois.arin.net/rest/nets;handle=NET-74-0-0-0-0?showDetails=true&showARIN=true
|
9
|
+
#
|
10
|
+
|
11
|
+
NetRange: 74.0.0.0 - 74.255.255.255
|
12
|
+
CIDR: 74.0.0.0/8
|
13
|
+
OriginAS:
|
14
|
+
NetName: NET74
|
15
|
+
NetHandle: NET-74-0-0-0-0
|
16
|
+
Parent:
|
17
|
+
NetType: Allocated to ARIN
|
18
|
+
RegDate: 2005-06-17
|
19
|
+
Updated: 2010-06-30
|
20
|
+
Ref: http://whois.arin.net/rest/net/NET-74-0-0-0-0
|
21
|
+
|
22
|
+
OrgName: American Registry for Internet Numbers
|
23
|
+
OrgId: ARIN
|
24
|
+
Address: 3635 Concorde Parkway
|
25
|
+
Address: Suite 200
|
26
|
+
City: Chantilly
|
27
|
+
StateProv: VA
|
28
|
+
PostalCode: 20151
|
29
|
+
Country: US
|
30
|
+
RegDate: 1997-12-22
|
31
|
+
Updated: 2011-03-19
|
32
|
+
Comment: For abuse issues please see URL:
|
33
|
+
Comment: http://www.arin.net/abuse.html
|
34
|
+
Comment: The Registration Services Help Desk is open
|
35
|
+
Comment: from 7 a.m. to 7 p.m., U.S. Eastern time to assist you.
|
36
|
+
Comment: Phone Number: (703) 227-0660; Fax Number: (703) 227-0676.
|
37
|
+
Ref: http://whois.arin.net/rest/org/ARIN
|
38
|
+
|
39
|
+
OrgNOCHandle: ARINN-ARIN
|
40
|
+
OrgNOCName: ARIN NOC
|
41
|
+
OrgNOCPhone: +1-703-227-9840
|
42
|
+
OrgNOCEmail: noc@arin.net
|
43
|
+
OrgNOCRef: http://whois.arin.net/rest/poc/ARINN-ARIN
|
52
44
|
|
45
|
+
OrgTechHandle: ARIN-HOSTMASTER
|
46
|
+
OrgTechName: Registration Services Department
|
47
|
+
OrgTechPhone: +1-703-227-0660
|
48
|
+
OrgTechEmail: hostmaster@arin.net
|
49
|
+
OrgTechRef: http://whois.arin.net/rest/poc/ARIN-HOSTMASTER
|
50
|
+
|
51
|
+
#
|
52
|
+
# ARIN WHOIS data and services are subject to the Terms of Use
|
53
|
+
# available at: https://www.arin.net/whois_tou.html
|
54
|
+
#
|
53
55
|
|
54
56
|
----------------------------------------------------------------
|
55
|
-
>
|
56
|
-
>>
|
57
|
+
> 74.7.249.38
|
58
|
+
>> US
|
57
59
|
>>> arin
|
58
60
|
----------------------------------------------------------------
|
59
61
|
#
|
60
62
|
# The following results may also be obtained via:
|
61
|
-
# http://whois.arin.net/rest/nets;handle=NET-
|
63
|
+
# http://whois.arin.net/rest/nets;handle=NET-74-0-0-0-0?showDetails=true&showARIN=true
|
62
64
|
#
|
63
65
|
|
64
|
-
NetRange:
|
65
|
-
CIDR:
|
66
|
-
OriginAS:
|
67
|
-
NetName:
|
68
|
-
NetHandle: NET-
|
69
|
-
Parent:
|
70
|
-
NetType:
|
71
|
-
RegDate:
|
72
|
-
Updated:
|
73
|
-
Ref: http://whois.arin.net/rest/net/NET-
|
74
|
-
|
75
|
-
OrgName:
|
76
|
-
OrgId:
|
77
|
-
Address:
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
RAbuseHandle: MTP7-ARIN
|
105
|
-
RAbuseName: MBN Tech POC
|
106
|
-
RAbusePhone: +1-604-628-1240
|
107
|
-
RAbuseEmail: MBNtechPOC@metrobridge.com
|
108
|
-
RAbuseRef: http://whois.arin.net/rest/poc/MTP7-ARIN
|
66
|
+
NetRange: 74.0.0.0 - 74.255.255.255
|
67
|
+
CIDR: 74.0.0.0/8
|
68
|
+
OriginAS:
|
69
|
+
NetName: NET74
|
70
|
+
NetHandle: NET-74-0-0-0-0
|
71
|
+
Parent:
|
72
|
+
NetType: Allocated to ARIN
|
73
|
+
RegDate: 2005-06-17
|
74
|
+
Updated: 2010-06-30
|
75
|
+
Ref: http://whois.arin.net/rest/net/NET-74-0-0-0-0
|
76
|
+
|
77
|
+
OrgName: American Registry for Internet Numbers
|
78
|
+
OrgId: ARIN
|
79
|
+
Address: 3635 Concorde Parkway
|
80
|
+
Address: Suite 200
|
81
|
+
City: Chantilly
|
82
|
+
StateProv: VA
|
83
|
+
PostalCode: 20151
|
84
|
+
Country: US
|
85
|
+
RegDate: 1997-12-22
|
86
|
+
Updated: 2011-03-19
|
87
|
+
Comment: For abuse issues please see URL:
|
88
|
+
Comment: http://www.arin.net/abuse.html
|
89
|
+
Comment: The Registration Services Help Desk is open
|
90
|
+
Comment: from 7 a.m. to 7 p.m., U.S. Eastern time to assist you.
|
91
|
+
Comment: Phone Number: (703) 227-0660; Fax Number: (703) 227-0676.
|
92
|
+
Ref: http://whois.arin.net/rest/org/ARIN
|
93
|
+
|
94
|
+
OrgNOCHandle: ARINN-ARIN
|
95
|
+
OrgNOCName: ARIN NOC
|
96
|
+
OrgNOCPhone: +1-703-227-9840
|
97
|
+
OrgNOCEmail: noc@arin.net
|
98
|
+
OrgNOCRef: http://whois.arin.net/rest/poc/ARINN-ARIN
|
99
|
+
|
100
|
+
OrgTechHandle: ARIN-HOSTMASTER
|
101
|
+
OrgTechName: Registration Services Department
|
102
|
+
OrgTechPhone: +1-703-227-0660
|
103
|
+
OrgTechEmail: hostmaster@arin.net
|
104
|
+
OrgTechRef: http://whois.arin.net/rest/poc/ARIN-HOSTMASTER
|
109
105
|
|
110
106
|
#
|
111
107
|
# ARIN WHOIS data and services are subject to the Terms of Use
|
@@ -113,125 +109,156 @@ RAbuseRef: http://whois.arin.net/rest/poc/MTP7-ARIN
|
|
113
109
|
#
|
114
110
|
|
115
111
|
----------------------------------------------------------------
|
116
|
-
>
|
117
|
-
>>
|
118
|
-
>>>
|
112
|
+
> 10.131.0.4
|
113
|
+
>> US
|
114
|
+
>>> arin
|
119
115
|
----------------------------------------------------------------
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
netname: YOUTELE
|
125
|
-
descr: YOU Telecom India Pvt Ltd
|
126
|
-
country: IN
|
127
|
-
admin-c: SG135-AP
|
128
|
-
tech-c: NI23-AP
|
129
|
-
status: ASSIGNED NON-PORTABLE
|
130
|
-
mnt-by: MAINT-IN-YOU
|
131
|
-
changed: network@youtele.com 20091209
|
132
|
-
source: APNIC
|
133
|
-
|
134
|
-
route: 219.91.192.0/18
|
135
|
-
descr: YOU Broadband & Cable India Ltd.
|
136
|
-
country: IN
|
137
|
-
origin: AS18207
|
138
|
-
mnt-by: MAINT-IN-YOU
|
139
|
-
changed: hm-changed@apnic.net 20040706
|
140
|
-
changed: hm-changed@apnic.net 20050831
|
141
|
-
changed: hm-changed@apnic.net 20100323
|
142
|
-
source: APNIC
|
143
|
-
|
144
|
-
person: SRIDHAR G
|
145
|
-
nic-hdl: SG135-AP
|
146
|
-
e-mail: gr.sridhar@youbroadband.co.in
|
147
|
-
remarks: -----------------------------------------
|
148
|
-
remarks: send abuse and spam report to
|
149
|
-
remarks: abuse@youbroadband.in or spamlog@youbroadband.in
|
150
|
-
remarks: -----------------------------------------
|
151
|
-
address: YOU Broadband & Cable India Ltd.
|
152
|
-
address: Millenium Arcade, 2nd floor
|
153
|
-
address: Adajan-Hazira Road
|
154
|
-
address: Surat -395009,Gujarat
|
155
|
-
address: India
|
156
|
-
phone: +91-261-2789500
|
157
|
-
fax-no: +91-261-2789501
|
158
|
-
country: IN
|
159
|
-
changed: network@youbroadband.in 20100512
|
160
|
-
mnt-by: MAINT-IN-YOU
|
161
|
-
changed: hm-changed@apnic.net 20100512
|
162
|
-
source: APNIC
|
163
|
-
|
164
|
-
person: NOC IQARA
|
165
|
-
nic-hdl: NI23-AP
|
166
|
-
e-mail: network@youtele.com
|
167
|
-
address: YOU Broadband & Cable India Ltd.
|
168
|
-
address: Iqara Center
|
169
|
-
address: Adajan-Hazira Rd
|
170
|
-
address: Surat-9
|
171
|
-
phone: +91-261-2789500
|
172
|
-
fax-no: +91-261-2789501
|
173
|
-
country: IN
|
174
|
-
changed: network@youtele.com 20061103
|
175
|
-
mnt-by: MAINT-IN-YOU
|
176
|
-
source: APNIC
|
116
|
+
#
|
117
|
+
# The following results may also be obtained via:
|
118
|
+
# http://whois.arin.net/rest/nets;q=10.131.0.4?showDetails=true&showARIN=true
|
119
|
+
#
|
177
120
|
|
121
|
+
NetRange: 10.0.0.0 - 10.255.255.255
|
122
|
+
CIDR: 10.0.0.0/8
|
123
|
+
OriginAS:
|
124
|
+
NetName: PRIVATE-ADDRESS-ABLK-RFC1918-IANA-RESERVED
|
125
|
+
NetHandle: NET-10-0-0-0-1
|
126
|
+
Parent:
|
127
|
+
NetType: IANA Special Use
|
128
|
+
Comment: This block is used as private address space.
|
129
|
+
Comment: Traffic from these addresses does not come from IANA.
|
130
|
+
Comment: IANA has simply reserved these numbers in its database
|
131
|
+
Comment: and does not use or operate them. We are not the source
|
132
|
+
Comment: of activity you may see on logs or in e-mail records.
|
133
|
+
Comment: Please refer to http://www.iana.org/abuse/
|
134
|
+
Comment:
|
135
|
+
Comment: Addresses from this block can be used by
|
136
|
+
Comment: anyone without any need to coordinate with
|
137
|
+
Comment: IANA or an Internet registry. Addresses from
|
138
|
+
Comment: this block are used in multiple, separately
|
139
|
+
Comment: operated networks.
|
140
|
+
Comment:
|
141
|
+
Comment: This block was assigned by the IETF in the
|
142
|
+
Comment: Best Current Practice document, RFC 1918
|
143
|
+
Comment: which can be found at:
|
144
|
+
Comment:
|
145
|
+
Comment: http://www.rfc-editor.org/rfc/rfc1918.txt
|
146
|
+
RegDate:
|
147
|
+
Updated: 2011-04-12
|
148
|
+
Ref: http://whois.arin.net/rest/net/NET-10-0-0-0-1
|
149
|
+
|
150
|
+
OrgName: Internet Assigned Numbers Authority
|
151
|
+
OrgId: IANA
|
152
|
+
Address: 4676 Admiralty Way, Suite 330
|
153
|
+
City: Marina del Rey
|
154
|
+
StateProv: CA
|
155
|
+
PostalCode: 90292-6695
|
156
|
+
Country: US
|
157
|
+
RegDate:
|
158
|
+
Updated: 2004-02-24
|
159
|
+
Ref: http://whois.arin.net/rest/org/IANA
|
160
|
+
|
161
|
+
OrgTechHandle: IANA-IP-ARIN
|
162
|
+
OrgTechName: Internet Corporation for Assigned Names and Number
|
163
|
+
OrgTechPhone: +1-310-301-5820
|
164
|
+
OrgTechEmail: abuse@iana.org
|
165
|
+
OrgTechRef: http://whois.arin.net/rest/poc/IANA-IP-ARIN
|
166
|
+
|
167
|
+
OrgAbuseHandle: IANA-IP-ARIN
|
168
|
+
OrgAbuseName: Internet Corporation for Assigned Names and Number
|
169
|
+
OrgAbusePhone: +1-310-301-5820
|
170
|
+
OrgAbuseEmail: abuse@iana.org
|
171
|
+
OrgAbuseRef: http://whois.arin.net/rest/poc/IANA-IP-ARIN
|
172
|
+
|
173
|
+
#
|
174
|
+
# ARIN WHOIS data and services are subject to the Terms of Use
|
175
|
+
# available at: https://www.arin.net/whois_tou.html
|
176
|
+
#
|
178
177
|
|
179
178
|
----------------------------------------------------------------
|
180
|
-
>
|
179
|
+
> 74.146.62.218
|
181
180
|
>> US
|
182
181
|
>>> arin
|
183
182
|
----------------------------------------------------------------
|
184
183
|
#
|
185
184
|
# The following results may also be obtained via:
|
186
|
-
# http://whois.arin.net/rest/nets;
|
185
|
+
# http://whois.arin.net/rest/nets;handle=NET-74-144-0-0-1?showDetails=true&showARIN=true
|
187
186
|
#
|
188
187
|
|
189
|
-
NetRange:
|
190
|
-
CIDR:
|
191
|
-
OriginAS:
|
192
|
-
NetName:
|
193
|
-
NetHandle:
|
194
|
-
Parent:
|
188
|
+
NetRange: 74.144.0.0 - 74.159.255.255
|
189
|
+
CIDR: 74.144.0.0/12
|
190
|
+
OriginAS:
|
191
|
+
NetName: COMCAST-VOIP-3
|
192
|
+
NetHandle: NET-74-144-0-0-1
|
193
|
+
Parent: NET-74-0-0-0-0
|
195
194
|
NetType: Direct Allocation
|
196
|
-
RegDate:
|
197
|
-
Updated:
|
198
|
-
Ref: http://whois.arin.net/rest/net/
|
195
|
+
RegDate: 2006-06-28
|
196
|
+
Updated: 2010-02-01
|
197
|
+
Ref: http://whois.arin.net/rest/net/NET-74-144-0-0-1
|
199
198
|
|
199
|
+
OrgName: Comcast Cable Communications, LLC
|
200
|
+
OrgId: CCCS
|
201
|
+
Address: 1800 Bishops Gate Blvd
|
202
|
+
City: Mt Laurel
|
203
|
+
StateProv: NJ
|
204
|
+
PostalCode: 08054
|
205
|
+
Country: US
|
206
|
+
RegDate: 2001-09-18
|
207
|
+
Updated: 2008-10-04
|
208
|
+
Ref: http://whois.arin.net/rest/org/CCCS
|
200
209
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
210
|
+
OrgTechHandle: IC161-ARIN
|
211
|
+
OrgTechName: Comcast Cable Communications Inc
|
212
|
+
OrgTechPhone: +1-856-317-7200
|
213
|
+
OrgTechEmail: CNIPEO-Ip-registration@cable.comcast.com
|
214
|
+
OrgTechRef: http://whois.arin.net/rest/poc/IC161-ARIN
|
215
|
+
|
216
|
+
OrgAbuseHandle: NAPO-ARIN
|
217
|
+
OrgAbuseName: Network Abuse and Policy Observance
|
218
|
+
OrgAbusePhone: +1-856-317-7272
|
219
|
+
OrgAbuseEmail: abuse@comcast.net
|
220
|
+
OrgAbuseRef: http://whois.arin.net/rest/poc/NAPO-ARIN
|
221
|
+
|
222
|
+
#
|
223
|
+
# ARIN WHOIS data and services are subject to the Terms of Use
|
224
|
+
# available at: https://www.arin.net/whois_tou.html
|
225
|
+
#
|
226
|
+
|
227
|
+
----------------------------------------------------------------
|
228
|
+
> 144.36.232.162
|
229
|
+
>> US
|
230
|
+
>>> arin
|
231
|
+
----------------------------------------------------------------
|
232
|
+
#
|
233
|
+
# The following results may also be obtained via:
|
234
|
+
# http://whois.arin.net/rest/nets;handle=NET-144-0-0-0-0?showDetails=true&showARIN=true
|
235
|
+
#
|
236
|
+
|
237
|
+
NetRange: 144.0.0.0 - 144.255.255.255
|
238
|
+
CIDR: 144.0.0.0/8
|
239
|
+
OriginAS:
|
240
|
+
NetName: NET144
|
241
|
+
NetHandle: NET-144-0-0-0-0
|
242
|
+
Parent:
|
243
|
+
NetType: Early Registrations, Maintained by ARIN
|
244
|
+
RegDate: 1993-05-01
|
245
|
+
Updated: 2010-06-30
|
246
|
+
Ref: http://whois.arin.net/rest/net/NET-144-0-0-0-0
|
247
|
+
|
248
|
+
OrgName: Various Registries (Maintained by ARIN)
|
249
|
+
OrgId: VR-ARIN
|
250
|
+
Address: 3635 Concord Parkway, Suite 200
|
251
|
+
City: Chantilly
|
252
|
+
StateProv: VA
|
253
|
+
PostalCode: 20151
|
207
254
|
Country: US
|
208
|
-
RegDate:
|
209
|
-
Updated:
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
OrgTechEmail: arin-contact@google.com
|
216
|
-
OrgTechRef: http://whois.arin.net/rest/poc/ZG39-ARIN
|
217
|
-
|
218
|
-
RNOCHandle: ZG39-ARIN
|
219
|
-
RNOCName: Google Inc
|
220
|
-
RNOCPhone: +1-650-253-0000
|
221
|
-
RNOCEmail: arin-contact@google.com
|
222
|
-
RNOCRef: http://whois.arin.net/rest/poc/ZG39-ARIN
|
223
|
-
|
224
|
-
RAbuseHandle: ZG39-ARIN
|
225
|
-
RAbuseName: Google Inc
|
226
|
-
RAbusePhone: +1-650-253-0000
|
227
|
-
RAbuseEmail: arin-contact@google.com
|
228
|
-
RAbuseRef: http://whois.arin.net/rest/poc/ZG39-ARIN
|
229
|
-
|
230
|
-
RTechHandle: ZG39-ARIN
|
231
|
-
RTechName: Google Inc
|
232
|
-
RTechPhone: +1-650-253-0000
|
233
|
-
RTechEmail: arin-contact@google.com
|
234
|
-
RTechRef: http://whois.arin.net/rest/poc/ZG39-ARIN
|
255
|
+
RegDate: 1993-05-01
|
256
|
+
Updated: 2004-02-24
|
257
|
+
Comment: Address space was assigned by the InterNIC regardless of
|
258
|
+
Comment: geographic region. The registrations are now being maintained
|
259
|
+
Comment: by various registries, and the in-addr.arpa delegations are
|
260
|
+
Comment: being maintained by ARIN.
|
261
|
+
Ref: http://whois.arin.net/rest/org/VR-ARIN
|
235
262
|
|
236
263
|
#
|
237
264
|
# ARIN WHOIS data and services are subject to the Terms of Use
|
data/log/system.log
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
# Logfile created on
|
2
|
-
I, [2011-
|
3
|
-
I, [2011-
|
4
|
-
I, [2011-
|
5
|
-
I, [2011-
|
6
|
-
I, [2011-
|
7
|
-
I, [2011-
|
8
|
-
I, [2011-
|
9
|
-
I, [2011-
|
10
|
-
I, [2011-
|
11
|
-
I, [2011-
|
12
|
-
I, [2011-
|
13
|
-
I, [2011-
|
14
|
-
I, [2011-
|
15
|
-
I, [2011-
|
16
|
-
I, [2011-
|
17
|
-
I, [2011-06-19T22:56:07.553205 #2549] INFO -- : Ending ... >>> Sun Jun 19 22:56:07 -0400 2011
|
18
|
-
I, [2011-06-19T22:57:05.825931 #2555] INFO -- : Starting IP address test file ... >>> Sun Jun 19 22:57:05 -0400 2011
|
19
|
-
I, [2011-06-19T22:57:10.268695 #2555] INFO -- : Record count is 4
|
20
|
-
I, [2011-06-19T22:57:10.268870 #2555] INFO -- : Ending ... >>> Sun Jun 19 22:57:10 -0400 2011
|
1
|
+
# Logfile created on Tue Sep 06 21:35:33 -0400 2011 by logger.rb/22285
|
2
|
+
I, [2011-09-06T21:35:33.264994 #13379] INFO -- : Starting IP address test file ... >>> Tue Sep 06 21:35:33 -0400 2011
|
3
|
+
I, [2011-09-06T21:35:37.093585 #13379] INFO -- : Record count is 5
|
4
|
+
I, [2011-09-06T21:35:37.093758 #13379] INFO -- : Ending ... >>> Tue Sep 06 21:35:37 -0400 2011
|
5
|
+
I, [2011-09-06T22:55:05.071446 #2755] INFO -- : Starting IP address test file ... >>> Tue Sep 06 22:55:05 -0400 2011
|
6
|
+
I, [2011-09-06T22:55:06.798190 #2755] INFO -- : Record count is 5
|
7
|
+
I, [2011-09-06T22:55:06.798362 #2755] INFO -- : Ending ... >>> Tue Sep 06 22:55:06 -0400 2011
|
8
|
+
I, [2011-09-06T22:55:19.540951 #2756] INFO -- : Starting IP address test file ... >>> Tue Sep 06 22:55:19 -0400 2011
|
9
|
+
I, [2011-09-06T22:55:21.098044 #2756] INFO -- : Record count is 5
|
10
|
+
I, [2011-09-06T22:55:21.101869 #2756] INFO -- : Ending ... >>> Tue Sep 06 22:55:21 -0400 2011
|
11
|
+
I, [2011-09-06T23:06:48.997700 #7499] INFO -- : Starting IP address test file ... >>> Tue Sep 06 23:06:48 -0400 2011
|
12
|
+
I, [2011-09-06T23:06:50.715492 #7499] INFO -- : Record count is 5
|
13
|
+
I, [2011-09-06T23:06:50.715662 #7499] INFO -- : Ending ... >>> Tue Sep 06 23:06:50 -0400 2011
|
14
|
+
I, [2011-09-06T23:07:39.472948 #7554] INFO -- : Starting IP address test file ... >>> Tue Sep 06 23:07:39 -0400 2011
|
15
|
+
I, [2011-09-06T23:07:41.092055 #7554] INFO -- : Record count is 5
|
16
|
+
I, [2011-09-06T23:07:41.092267 #7554] INFO -- : Ending ... >>> Tue Sep 06 23:07:41 -0400 2011
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Logfile created on 2011-06-19 21:07:36 -0400 by logger.rb/25413
|
2
|
+
I, [2011-06-19T21:07:36.051026 #1168] INFO -- : starting ... >>> 2011-06-19 21:07:36 -0400
|
3
|
+
I, [2011-06-19T21:08:02.305872 #3676] INFO -- : starting ... >>> 2011-06-19 21:08:02 -0400
|
4
|
+
I, [2011-06-19T21:08:03.772274 #3676] INFO -- : Record count is 4
|
5
|
+
I, [2011-06-19T21:08:03.772274 #3676] INFO -- : ending ... >>> 2011-06-19 21:08:03 -0400
|
6
|
+
I, [2011-06-19T21:14:04.313707 #3816] INFO -- : starting ... >>> 2011-06-19 21:14:04 -0400
|
7
|
+
I, [2011-06-19T21:14:10.335317 #3816] INFO -- : Record count is 4
|
8
|
+
I, [2011-06-19T21:14:10.335317 #3816] INFO -- : ending ... >>> 2011-06-19 21:14:10 -0400
|
9
|
+
I, [2011-06-19T21:36:31.696191 #3208] INFO -- : Starting IP address test file ... >>> 2011-06-19 21:36:31 -0400
|
10
|
+
I, [2011-06-19T21:36:34.379396 #3208] INFO -- : Record count is 4
|
11
|
+
I, [2011-06-19T21:36:34.379396 #3208] INFO -- : Ending ... >>> 2011-06-19 21:36:34 -0400
|
12
|
+
I, [2011-06-19T22:43:07.127192 #2507] INFO -- : Starting IP address test file ... >>> Sun Jun 19 22:43:07 -0400 2011
|
13
|
+
I, [2011-06-19T22:43:16.796865 #2507] INFO -- : Record count is 10
|
14
|
+
I, [2011-06-19T22:43:16.797023 #2507] INFO -- : Ending ... >>> Sun Jun 19 22:43:16 -0400 2011
|
15
|
+
I, [2011-06-19T22:55:59.322407 #2549] INFO -- : Starting IP address test file ... >>> Sun Jun 19 22:55:59 -0400 2011
|
16
|
+
I, [2011-06-19T22:56:07.553043 #2549] INFO -- : Record count is 10
|
17
|
+
I, [2011-06-19T22:56:07.553205 #2549] INFO -- : Ending ... >>> Sun Jun 19 22:56:07 -0400 2011
|
18
|
+
I, [2011-06-19T22:57:05.825931 #2555] INFO -- : Starting IP address test file ... >>> Sun Jun 19 22:57:05 -0400 2011
|
19
|
+
I, [2011-06-19T22:57:10.268695 #2555] INFO -- : Record count is 4
|
20
|
+
I, [2011-06-19T22:57:10.268870 #2555] INFO -- : Ending ... >>> Sun Jun 19 22:57:10 -0400 2011
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Logfile created on Tue Aug 23 21:55:21 -0400 2011 by logger.rb/22285
|
2
|
+
I, [2011-08-23T21:55:21.285906 #2337] INFO -- : Starting IP address test file ... >>> Tue Aug 23 21:55:21 -0400 2011
|
3
|
+
I, [2011-08-23T21:55:22.845128 #2337] INFO -- : Record count is 5
|
4
|
+
I, [2011-08-23T21:55:22.845300 #2337] INFO -- : Ending ... >>> Tue Aug 23 21:55:22 -0400 2011
|
5
|
+
I, [2011-08-23T22:00:28.868131 #2361] INFO -- : Starting IP address test file ... >>> Tue Aug 23 22:00:28 -0400 2011
|
6
|
+
I, [2011-08-23T22:00:30.466053 #2361] INFO -- : Record count is 5
|
7
|
+
I, [2011-08-23T22:00:30.466226 #2361] INFO -- : Ending ... >>> Tue Aug 23 22:00:30 -0400 2011
|
@@ -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.
|
@@ -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
|
+
|
@@ -0,0 +1,189 @@
|
|
1
|
+
# This gem module provides a classes to find the right Regional Internet Registry
|
2
|
+
# for a given IP Address. The query method will navigate each major RIR until a
|
3
|
+
# response is found.
|
4
|
+
#
|
5
|
+
# Author:: Al Kivi <al.kivi@vizitrax.com>
|
6
|
+
# License:: MIT
|
7
|
+
|
8
|
+
module Vizi
|
9
|
+
# This class includes a set of methods to navigate and query the regional whois servers
|
10
|
+
class Gowhois
|
11
|
+
|
12
|
+
# This method will navigate each whois server until a response is found
|
13
|
+
def query (ipaddr)
|
14
|
+
s = "arin"
|
15
|
+
response = ruby_whois(ipaddr, s)
|
16
|
+
if response.index("(NET") # look for dual NET blocks in ARIN responses
|
17
|
+
t1 = response
|
18
|
+
netaddrs = response.scan(/\(NET-\w+\-\w+\-\w+\-\w+\-\w+\)/)
|
19
|
+
netaddr = netaddrs[netaddrs.length-1].scan(/NET-\w+\-\w+\-\w+\-\w+\-\w+/)
|
20
|
+
response = ruby_whois(netaddr[0], s)
|
21
|
+
end
|
22
|
+
if response.index("whois.ripe.net")
|
23
|
+
s = "ripe"
|
24
|
+
response = ruby_whois(ipaddr, s)
|
25
|
+
elsif response.index("whois.apnic.net")
|
26
|
+
s = "apnic"
|
27
|
+
response = ruby_whois(ipaddr, s)
|
28
|
+
elsif response.index("whois.lacnic.net")
|
29
|
+
s = "lacnic"
|
30
|
+
response = ruby_whois(ipaddr, s)
|
31
|
+
if response.length > 4000 # parse very long responses
|
32
|
+
lines = response.split(/\r\n/)
|
33
|
+
lines.delete_if { |e| e =~ /nserver:/ }
|
34
|
+
lines.delete_if { |e| e =~ /nsstat:/ }
|
35
|
+
lines.delete_if { |e| e =~ /nslastaa:/ }
|
36
|
+
lines.delete_if { |e| e =~ /inetrev:/ }
|
37
|
+
response=""
|
38
|
+
i=0
|
39
|
+
while i<lines.length
|
40
|
+
response = response+lines[i]+"\r\n"
|
41
|
+
i = i+1
|
42
|
+
end
|
43
|
+
end
|
44
|
+
elsif response.index("whois.afrinic.net")
|
45
|
+
s = "afrinic"
|
46
|
+
response = ruby_whois(ipaddr, s)
|
47
|
+
elsif response.length >250 and response.length < 500
|
48
|
+
str = response[100..250]
|
49
|
+
x = str.index("(")
|
50
|
+
y = str.index(")")
|
51
|
+
if x != nil and y != nil
|
52
|
+
net = str[x+1..y-1]
|
53
|
+
response = ruby_whois(net, s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
ccode = get_country(response)
|
57
|
+
return response, ccode, s
|
58
|
+
end
|
59
|
+
|
60
|
+
# This method will parse the response to find the two character country code
|
61
|
+
def get_country (response)
|
62
|
+
temp = response.upcase
|
63
|
+
temp.delete!("\t")
|
64
|
+
temp.delete!(" ")
|
65
|
+
x = temp.index("COUNTRY:")
|
66
|
+
ccode = nil
|
67
|
+
if x != nil
|
68
|
+
ccode = temp[x+8..x+9]
|
69
|
+
elsif temp.index(".BR")
|
70
|
+
ccode = "BR"
|
71
|
+
else
|
72
|
+
ccode ="?"
|
73
|
+
end
|
74
|
+
return ccode
|
75
|
+
end
|
76
|
+
|
77
|
+
# This method the ruby version of the whois command function
|
78
|
+
def ruby_whois (send_string, host)
|
79
|
+
# p send_string + " .. " + host
|
80
|
+
if host.index(".") == nil
|
81
|
+
host = "whois."+host+".net"
|
82
|
+
end
|
83
|
+
add_string = ""
|
84
|
+
add_string = "n " if host == "whois.arin.net"
|
85
|
+
add_string = "n ! " if send_string.index("NET") == 0
|
86
|
+
s = TCPSocket.open(host,43)
|
87
|
+
s.write(add_string+send_string+"\n")
|
88
|
+
ret = ""
|
89
|
+
while s.gets do
|
90
|
+
ret += $_
|
91
|
+
end
|
92
|
+
s.close
|
93
|
+
return ret
|
94
|
+
rescue # rescue logic if not found
|
95
|
+
ret="Not found"
|
96
|
+
return ret
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# This class will parse the response string from a Whois server
|
102
|
+
class Formatter
|
103
|
+
|
104
|
+
# This method will parse response string
|
105
|
+
def parse (contents, country, server)
|
106
|
+
name_list = ["COUNTRY","NETNAME","ORGNAME","ORG-NAME","CUSTNAME","OWNER","ADDRESS","DESCR","CITY","STATEPROV","POSTALCODE"]
|
107
|
+
country_list = ["GERMANY","UNITED KINGDOM","UK","ENGLAND","INDIA","NETHERLANDS","SPAIN","BELGIUM","PR CHINA","NORWAY"]
|
108
|
+
odd_list = ["EMAIL","CONTA","PHONE","ABUSE ","SENT ","SEND ","DATE ","ATTN ","INFRA","THIS ","ANTIA","*****","-----"]
|
109
|
+
|
110
|
+
# formatted_file = File.open('./log/formatted.log', 'a')
|
111
|
+
|
112
|
+
a = contents.upcase.split(/\n/)
|
113
|
+
i = -1
|
114
|
+
line = [nil,nil]
|
115
|
+
lastname = nil
|
116
|
+
addressflag = false
|
117
|
+
country_count = 0
|
118
|
+
da_count = 0
|
119
|
+
netname_count = 0
|
120
|
+
darray = []
|
121
|
+
outstring = ""
|
122
|
+
# formatted_file.puts '+ ------------------------------------------------------'
|
123
|
+
# formatted_file.puts '+ '+ country + ' - ' + server.upcase
|
124
|
+
# formatted_file.puts '+ ------------------------------------------------------'
|
125
|
+
while i < a.length-1
|
126
|
+
i = i + 1
|
127
|
+
line = [nil, nil]
|
128
|
+
goodline = true
|
129
|
+
current = a[i].chomp
|
130
|
+
if current.length < 2
|
131
|
+
goodline = false
|
132
|
+
else
|
133
|
+
goodline = false if current[0] == "%" or current[0] == "#"
|
134
|
+
end
|
135
|
+
if goodline
|
136
|
+
line = current.split(":")
|
137
|
+
if line[1].nil?
|
138
|
+
line[1] = ""
|
139
|
+
if lastname == "ADDRESS" and line[0] != line[0].lstrip
|
140
|
+
line[0] = lastname
|
141
|
+
end
|
142
|
+
else
|
143
|
+
addressflag = true if line[0] == "ADDRESS"
|
144
|
+
end
|
145
|
+
line[1] = line[1].lstrip.gsub(".","")
|
146
|
+
line[1] = line[1].lstrip.gsub(", ",",")
|
147
|
+
line[1] = line[1].lstrip.gsub(" ,",",")
|
148
|
+
line[1] = line[1].chomp(",")
|
149
|
+
country_count = country_count + 1 if line[0] == "COUNTRY"
|
150
|
+
da_count = da_count + 1 if line[0] == "DESCR" or line[0] == "ADDRESS"
|
151
|
+
netname_count = netname_count + 1 if line[0] == "NETNAME"
|
152
|
+
goodline = false if da_count > 10 or country_count > 4 or netname_count > 1
|
153
|
+
goodline = false if country_count > 1 and line[0] == "COUNTRY"
|
154
|
+
goodline = false if line[1][0] == "-"
|
155
|
+
goodline = false if country_list.index(line[1])
|
156
|
+
goodline = false if line[0] == "ADDRESS" and line[1] == country
|
157
|
+
goodline = false if odd_list.index(line[1][0..4])
|
158
|
+
goodline = false if addressflag and line[0] == "DESCR"
|
159
|
+
goodline = false if line[1].length < 2
|
160
|
+
goodline = false if darray.index(line[1])
|
161
|
+
darray << line[1] if goodline and (line[0] == "DESCR" or line[0] == "ADDRESS")
|
162
|
+
if goodline
|
163
|
+
country_count = country_count + 1 if line[0] == "COUNTRY"
|
164
|
+
da_count = da_count + 1 if line[0] == "DESCR" or line[0] == "ADDRESS"
|
165
|
+
end
|
166
|
+
else
|
167
|
+
line[0] = current
|
168
|
+
line[1] = ""
|
169
|
+
end
|
170
|
+
lastname = line[0]
|
171
|
+
if goodline
|
172
|
+
if name_list.index(line[0])
|
173
|
+
newline = line[0] + ': ' + line[1] + '\n'
|
174
|
+
# formatted_file.puts '+ ' + newline
|
175
|
+
outstring = outstring + newline
|
176
|
+
else
|
177
|
+
# formatted_file.puts '. ' + line[0] + ':: ' + line[1]
|
178
|
+
end
|
179
|
+
else
|
180
|
+
# formatted_file.puts '- ' + line[0]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
# formatted_file.puts '+ ' + country_count.to_s + ': ' + da_count.to_s
|
184
|
+
return outstring
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
Binary file
|
data/testit.rb
CHANGED
Binary file
|
data/vizi_whois.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
s.name = 'vizi_whois'
|
5
|
-
s.version = '0.
|
5
|
+
s.version = '0.2.0'
|
6
6
|
s.summary = "Global whois capability to select the right whois server and get response data"
|
7
7
|
s.description = "This gem module provides a classes to find the right Regional Internet Registry
|
8
8
|
for a given IP Address. The query method will navigate each major RIR until a response is found.
|
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s|
|
|
12
12
|
s.test_files = Dir.glob("test/*_test.rb")
|
13
13
|
s.author = "Al Kivi"
|
14
14
|
s.homepage = "http://www.vizitrax.com"
|
15
|
-
s.email = "al.kivi@
|
15
|
+
s.email = "al.kivi@yahoo.com"
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.required_ruby_version = '>= 1.8.2'
|
18
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vizi_whois
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Al Kivi
|
@@ -15,7 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-08 00:00:00 -05:00
|
19
|
+
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
21
22
|
description: |-
|
@@ -23,7 +24,7 @@ description: |-
|
|
23
24
|
for a given IP Address. The query method will navigate each major RIR until a response is found.
|
24
25
|
|
25
26
|
A second class allows the responses from various RIRs to be formatted to a common response format
|
26
|
-
email: al.kivi@
|
27
|
+
email: al.kivi@yahoo.com
|
27
28
|
executables: []
|
28
29
|
|
29
30
|
extensions: []
|
@@ -95,16 +96,25 @@ files:
|
|
95
96
|
- vizi_whois-0.1.0.gem
|
96
97
|
- vizi_whois.gemspec
|
97
98
|
- build_gem1.bat
|
99
|
+
- pkg/vizi_whois-0.1.0.gem
|
100
|
+
- pkg/vizi_whois-0.1.0/lib/vizi/geany_run_script.bat
|
101
|
+
- pkg/vizi_whois-0.1.0/lib/vizi/vizi_whois.rb
|
102
|
+
- pkg/vizi_whois-0.1.0/lib/vizi_whois.rb
|
103
|
+
- pkg/vizi_whois-0.1.0/README.rdoc
|
104
|
+
- pkg/vizi_whois-0.1.0/Rakefile
|
98
105
|
- build_gem3.bat
|
99
106
|
- README.rdoc
|
100
107
|
- Rakefile
|
108
|
+
- log/system.log.20110903
|
101
109
|
- log/system.log
|
102
110
|
- log/output.log
|
111
|
+
- log/system.log.20110820
|
103
112
|
- log/formatted.log
|
104
113
|
- test/parser_test.rb
|
105
114
|
- test/test_helper.rb
|
106
115
|
- testit.rb
|
107
116
|
- build_gem2.bat
|
117
|
+
has_rdoc: true
|
108
118
|
homepage: http://www.vizitrax.com
|
109
119
|
licenses: []
|
110
120
|
|
@@ -136,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
146
|
requirements: []
|
137
147
|
|
138
148
|
rubyforge_project:
|
139
|
-
rubygems_version: 1.
|
149
|
+
rubygems_version: 1.6.2
|
140
150
|
signing_key:
|
141
151
|
specification_version: 3
|
142
152
|
summary: Global whois capability to select the right whois server and get response data
|