jungler 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/LICENSE +22 -0
- data/README.md +0 -0
- data/bin/jungler +8 -0
- data/jungler.gemspec +25 -0
- data/lib/jungler.rb +50 -0
- data/lib/jungler/version.rb +4 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c12aa0078f3de13eab567e2cd7ccd6fdea6e9b3d
|
4
|
+
data.tar.gz: d9b870114652034b6f49bd705bebf832b0730e9a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bf6fc50d02f2e7222d5582188c764866aae76aafd7cf75a023c0753a36250f322b601c8de23312ebd80d08ca233977a994008d018f0a91b569c6194ab6207788
|
7
|
+
data.tar.gz: e17a43d63c2ff0bffbc79b5b43bdf795edba014ffd8866a365afddcd60310c38863b02bc5478878e3c498bbb2c5ca53b1a945fb5014608db6e400496dfb5c3ae
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Nicolas Collard
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
File without changes
|
data/bin/jungler
ADDED
data/jungler.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "jungler/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'jungler'
|
6
|
+
s.version = Jungler::VERSION.dup
|
7
|
+
s.date = '2015-07-24'
|
8
|
+
s.summary = "Gives hosting info from domain"
|
9
|
+
s.description = "Takes a domain in parameters and gives info about hosting"
|
10
|
+
s.authors = ["Nicolas Collard"]
|
11
|
+
s.email = 'niko@hito.be'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.homepage = 'https://github.com/Hito01/jungler'
|
14
|
+
|
15
|
+
s.add_dependency "net-dns", "~> 0.8"
|
16
|
+
s.add_dependency "net-ping", "~> 1.7"
|
17
|
+
s.add_dependency "sqlite3", "~> 1.3"
|
18
|
+
|
19
|
+
# s.files = ["lib/jungler.rb"]
|
20
|
+
s.files = `git ls-files`.split($\)
|
21
|
+
s.test_files = s.files.grep(/^spec/)
|
22
|
+
|
23
|
+
s.executables << 'jungler'
|
24
|
+
end
|
25
|
+
|
data/lib/jungler.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class Jungler
|
2
|
+
attr_accessor :domain
|
3
|
+
|
4
|
+
IP_REGEX = /IN\s+A\s+(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})/
|
5
|
+
NS_REGEX = /IN\s+NS\s+([\w-]*\.+[\w-]+\.+[\w-]+\.+)/
|
6
|
+
def initialize(domain)
|
7
|
+
@domain = domain
|
8
|
+
end
|
9
|
+
|
10
|
+
def stalk
|
11
|
+
corresponding_ip
|
12
|
+
ns_records
|
13
|
+
ping_status
|
14
|
+
end
|
15
|
+
|
16
|
+
def corresponding_ip
|
17
|
+
packet = Net::DNS::Resolver.start(@domain)
|
18
|
+
answer = packet.answer.join('')
|
19
|
+
ips = answer.scan(IP_REGEX)
|
20
|
+
ips.each do |ip|
|
21
|
+
ip = ip.first
|
22
|
+
puts "#{domain} is hosted on IP : #{ip}\n"
|
23
|
+
end
|
24
|
+
puts "-----------------------------------------"
|
25
|
+
end
|
26
|
+
|
27
|
+
def ns_records
|
28
|
+
packet = Net::DNS::Resolver.start(domain, Net::DNS::NS)
|
29
|
+
answer = packet.answer.join('')
|
30
|
+
nss = answer.scan(NS_REGEX)
|
31
|
+
i = 1
|
32
|
+
nss.each do |ns|
|
33
|
+
ns = ns.first
|
34
|
+
puts "Name server #{i} for domain #{@domain} : #{ns}\n"
|
35
|
+
i += 1
|
36
|
+
end
|
37
|
+
puts "-----------------------------------------"
|
38
|
+
end
|
39
|
+
|
40
|
+
def ping_status
|
41
|
+
Net::Ping::TCP.service_check = true
|
42
|
+
|
43
|
+
pt = Net::Ping::TCP.new(@domain)
|
44
|
+
if pt.ping
|
45
|
+
puts "#{@domain} is alive."
|
46
|
+
else
|
47
|
+
puts "#{@domain} seems to be dead or is not reachable."
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jungler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicolas Collard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: net-dns
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-ping
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
description: Takes a domain in parameters and gives info about hosting
|
56
|
+
email: niko@hito.be
|
57
|
+
executables:
|
58
|
+
- jungler
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- LICENSE
|
64
|
+
- README.md
|
65
|
+
- bin/jungler
|
66
|
+
- jungler.gemspec
|
67
|
+
- lib/jungler.rb
|
68
|
+
- lib/jungler/version.rb
|
69
|
+
homepage: https://github.com/Hito01/jungler
|
70
|
+
licenses:
|
71
|
+
- MIT
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 2.2.0
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: Gives hosting info from domain
|
93
|
+
test_files: []
|