hostdig 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +4 -0
- data/Rakefile +1 -0
- data/bin/digger +47 -0
- data/hostdig.gemspec +20 -0
- data/lib/hostdig.rb +5 -0
- data/lib/hostdig/digtool.rb +11 -0
- data/lib/hostdig/version.rb +3 -0
- metadata +76 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/digger
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'optparse'
|
|
4
|
+
require 'hostdig/digtool'
|
|
5
|
+
|
|
6
|
+
options = {}
|
|
7
|
+
|
|
8
|
+
optparse = OptionParser.new do | opts |
|
|
9
|
+
opts.banner = "Usage: digger.rb host [options]"
|
|
10
|
+
options[:type] = nil
|
|
11
|
+
options[:outfile] = nil
|
|
12
|
+
|
|
13
|
+
opts.on('-t','--type TYPE', 'Specify record type to request. e.g. A, MX, CNAME, TXT ...') do |type|
|
|
14
|
+
options[:type] = type
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
opts.on('-o','--outfile [FILE]', 'Write output to FILE. If left blank, output will write to a file matching the hostname') do |file|
|
|
18
|
+
options[:outfile] = file.nil? ? :default : file
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
opts.on('-h', '--help', 'Display help') do
|
|
22
|
+
puts opts
|
|
23
|
+
exit
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
optparse.parse!
|
|
28
|
+
|
|
29
|
+
if ARGV[0].nil?
|
|
30
|
+
puts "ERROR: no host provided"
|
|
31
|
+
puts optparse.help
|
|
32
|
+
exit 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
host = ARGV[0]
|
|
36
|
+
|
|
37
|
+
options[:type] = "A" if options[:type].nil?
|
|
38
|
+
options[:outfile] = host if options[:outfile] == :default
|
|
39
|
+
|
|
40
|
+
mydig = HostDig::DigTool.new
|
|
41
|
+
result = mydig.dig(host, options[:type])
|
|
42
|
+
|
|
43
|
+
if options[:outfile].nil?
|
|
44
|
+
puts result
|
|
45
|
+
else
|
|
46
|
+
File.open(options[:outfile], 'w') {|f| f.write(result)}
|
|
47
|
+
end
|
data/hostdig.gemspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "hostdig/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "hostdig"
|
|
7
|
+
s.version = HostDig::VERSION
|
|
8
|
+
s.authors = ["Josh Cody"]
|
|
9
|
+
s.email = ["joshcody@taklbox.com"]
|
|
10
|
+
s.homepage = ""
|
|
11
|
+
s.summary = %q{Lookup DNS records for a host}
|
|
12
|
+
s.description = %q{Simple tool for querying DNS servers for host information}
|
|
13
|
+
|
|
14
|
+
s.rubyforge_project = "hostdig"
|
|
15
|
+
|
|
16
|
+
s.files = `git ls-files`.split("\n")
|
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
|
+
s.require_paths = ["lib"]
|
|
20
|
+
end
|
data/lib/hostdig.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: hostdig
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Josh Cody
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-07-13 00:00:00 -07:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
22
|
+
description: Simple tool for querying DNS servers for host information
|
|
23
|
+
email:
|
|
24
|
+
- joshcody@taklbox.com
|
|
25
|
+
executables:
|
|
26
|
+
- digger
|
|
27
|
+
extensions: []
|
|
28
|
+
|
|
29
|
+
extra_rdoc_files: []
|
|
30
|
+
|
|
31
|
+
files:
|
|
32
|
+
- .gitignore
|
|
33
|
+
- Gemfile
|
|
34
|
+
- README.md
|
|
35
|
+
- Rakefile
|
|
36
|
+
- bin/digger
|
|
37
|
+
- hostdig.gemspec
|
|
38
|
+
- lib/hostdig.rb
|
|
39
|
+
- lib/hostdig/digtool.rb
|
|
40
|
+
- lib/hostdig/version.rb
|
|
41
|
+
has_rdoc: true
|
|
42
|
+
homepage: ""
|
|
43
|
+
licenses: []
|
|
44
|
+
|
|
45
|
+
post_install_message:
|
|
46
|
+
rdoc_options: []
|
|
47
|
+
|
|
48
|
+
require_paths:
|
|
49
|
+
- lib
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
|
+
none: false
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
hash: 3
|
|
56
|
+
segments:
|
|
57
|
+
- 0
|
|
58
|
+
version: "0"
|
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
|
+
none: false
|
|
61
|
+
requirements:
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
hash: 3
|
|
65
|
+
segments:
|
|
66
|
+
- 0
|
|
67
|
+
version: "0"
|
|
68
|
+
requirements: []
|
|
69
|
+
|
|
70
|
+
rubyforge_project: hostdig
|
|
71
|
+
rubygems_version: 1.6.2
|
|
72
|
+
signing_key:
|
|
73
|
+
specification_version: 3
|
|
74
|
+
summary: Lookup DNS records for a host
|
|
75
|
+
test_files: []
|
|
76
|
+
|