charon 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +5 -0
- data/LICENSE +29 -0
- data/README.md +47 -0
- data/Rakefile +13 -0
- data/charon.gemspec +27 -0
- data/lib/charon.rb +7 -0
- data/lib/charon/resolver.rb +57 -0
- data/lib/charon/tlds.rb +3969 -0
- data/lib/charon/version.rb +4 -0
- data/test/test_main.rb +45 -0
- metadata +69 -0
data/test/test_main.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
$TESTING = true
|
2
|
+
require 'rubygems'
|
3
|
+
require 'minitest/pride'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'charon'
|
6
|
+
|
7
|
+
describe 'Charon' do
|
8
|
+
describe 'Resolver' do
|
9
|
+
it 'recognize a valid ip address' do
|
10
|
+
assert Charon::Resolver.is_address? '127.0.0.1'
|
11
|
+
assert Charon::Resolver.is_address? '127.0.0.255'
|
12
|
+
|
13
|
+
assert Charon::Resolver.is_address?('127.0.0.300') == false
|
14
|
+
assert Charon::Resolver.is_address?('127.0.0.1.com') == false
|
15
|
+
assert Charon::Resolver.is_address?('www.127.0.0.1') == false
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'reverse an ip address' do
|
19
|
+
assert_equal '1.0.0.127', Charon::Resolver.fix_name('127.0.0.1')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'remove the subdomain from an url' do
|
23
|
+
assert_equal 'google.com', Charon::Resolver.fix_name('www.google.com')
|
24
|
+
assert_equal 'www.com', Charon::Resolver.fix_name('www.com')
|
25
|
+
assert_equal 'test.2000.hu', Charon::Resolver.fix_name('test.2000.hu')
|
26
|
+
assert_equal 'test.2000.hu', Charon::Resolver.fix_name('www.test.2000.hu')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'have no records for clean address' do
|
30
|
+
assert_nil Charon::Resolver.query '127.0.0.1'
|
31
|
+
assert_nil Charon::Resolver.query '173.194.35.48'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'have records for spam address' do
|
35
|
+
code, list = Charon::Resolver.query '103.24.238.0'
|
36
|
+
assert_equal 2, code
|
37
|
+
assert_equal 'Block List', list
|
38
|
+
|
39
|
+
code, list = Charon::Resolver.query '184.22.36.32'
|
40
|
+
assert_equal 2, code
|
41
|
+
assert_equal 'Block List', list
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: charon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simone Margaritelli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.0.0
|
27
|
+
description: A Ruby library to query the Zen service on SpamHaus.org
|
28
|
+
email: evilsocket@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/charon/resolver.rb
|
34
|
+
- lib/charon/tlds.rb
|
35
|
+
- lib/charon/version.rb
|
36
|
+
- lib/charon.rb
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- charon.gemspec
|
41
|
+
- Gemfile
|
42
|
+
- test/test_main.rb
|
43
|
+
homepage: http://github.com/evilsocket/charon
|
44
|
+
licenses:
|
45
|
+
- BSD
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options:
|
49
|
+
- --charset=UTF-8
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.0.6
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: A Ruby library to query the Zen service on SpamHaus.org
|
68
|
+
test_files:
|
69
|
+
- test/test_main.rb
|