nmapr 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5bd6794967d9a5a9e78ab43fd30f5fb48da24d8f
4
+ data.tar.gz: 88063b0ef6ec9858951a6c7f2b71e2b0036fe9a1
5
+ SHA512:
6
+ metadata.gz: 74f7a9187aefdabac08626d6c2e25cde72efe4715b787613e8d2cc9be8c84d46e5b2ada62d0a6e301b8078cc7c3f165b37c47a7d3e247b49e1a72f92547b7b2e
7
+ data.tar.gz: 268a9e3005ce69c578d1a1190ecdf665af1017ce4a9b780a6c687f98e9ab60d48c961b310f56431826da3e6fa4eeda7b89e10870212685920b68703d630bab78
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.15.0
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at kgruber1@emich.edu. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in nmapr.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Kent Gruber
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # Nmapr
2
+
3
+ A friendly Ruby DSL to [nmap](https://nmap.org/).
4
+
5
+ ## Installation
6
+
7
+ $ gem install nmapr
8
+
9
+ ## Usage
10
+
11
+ Build a `nmap` scan command in friendly, readable way.
12
+
13
+ ```ruby
14
+ Nmapr.scan :cmd do
15
+ target '192.168.0.2'
16
+ ports :common
17
+ sequential
18
+ detect :os
19
+ verbose
20
+ end
21
+ # => "nmap 192.168.0.2 -p 1-1024 -r -O -v"
22
+ ```
23
+
24
+ Run those commands.
25
+
26
+ ```ruby
27
+ result = Nmapr.scan :run do
28
+ targets 'localhost'
29
+ ports 22, 24
30
+ detect :version
31
+ end
32
+
33
+ # Check stdout, stderr and status of command.
34
+ result[:stdout]
35
+ result[:stderr]
36
+ result[:status]
37
+ ```
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
42
+
43
+ ## Code of Conduct
44
+
45
+ Everyone interacting in the Nmapr project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/nmapr/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nmapr"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'nmapr'
3
+ require 'pry'
4
+
5
+ binding.pry
@@ -0,0 +1,28 @@
1
+ require 'open3'
2
+ require "nmapr/version"
3
+ require "nmapr/scanner"
4
+
5
+ module Nmapr
6
+ def self.scan(type = :object, &block)
7
+ scan = Scanner.new
8
+ scan.instance_eval(&block)
9
+ case type
10
+ when :object
11
+ scan
12
+ when :cmd
13
+ scan.to_cmd
14
+ when :run
15
+ run(scan.to_cmd)
16
+ end
17
+ end
18
+
19
+ def self.run(cmd)
20
+ results = Hash.new
21
+ stdout, stderr, status = Open3.capture3(cmd)
22
+ results[:stdout] = stdout
23
+ results[:stderr] = stderr
24
+ results[:status] = status
25
+ return results unless block_given?
26
+ yield results
27
+ end
28
+ end
@@ -0,0 +1,12 @@
1
+ module Nmapr
2
+
3
+ module Builders
4
+ module Argument
5
+
6
+ def add_argument(arg)
7
+ @arguments << " " << arg
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ require_relative "command.rb"
2
+ require_relative "argument.rb"
@@ -0,0 +1,29 @@
1
+ module Nmapr
2
+
3
+ module Builders
4
+ module Command
5
+
6
+ def to_cmd(type = :normal)
7
+ if @ports.empty?
8
+ ports = ""
9
+ else
10
+ ports = " -p " << @ports.join(",")
11
+ end
12
+ case type
13
+ when :split
14
+ @targets.each do |target|
15
+ next if @not_targets.include?(target)
16
+ "nmap " << target << @arguments
17
+ end
18
+ when :normal
19
+ if @not_targets.empty?
20
+ "nmap " << @targets.join(",") << ports << @arguments
21
+ else
22
+ "nmap " << @targets.join(",") << ports << @arguments << " --exclude " << @not_targets.join(",")
23
+ end
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ module Nmapr
2
+ module Options
3
+ module Debugging
4
+ def debug
5
+ add_argument("-d")
6
+ end
7
+ def open
8
+ add_argument("--open")
9
+ end
10
+ def packet_trace
11
+ add_argument("--packet-trace")
12
+ end
13
+ def reason
14
+ add_argument("--reason")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,37 @@
1
+ module Nmapr
2
+ module Options
3
+ module Detection
4
+
5
+ def version_intensity(type)
6
+ case type
7
+ when Integer
8
+ add_argument("--version-intensity " << type.to_s)
9
+ when :light
10
+ add_argument("--version-light")
11
+ when :all
12
+ add_argument("--version-all")
13
+ end
14
+ end
15
+
16
+ def version_trace
17
+ add_argument("--version-trace")
18
+ end
19
+
20
+ def detect(type, value = false)
21
+ case type
22
+ when :os
23
+ add_argument("-O")
24
+ case value
25
+ when :promising
26
+ add_argument("--osscan-limit")
27
+ when :aggressive
28
+ add_argument("--osscan-guess")
29
+ end
30
+ when :version
31
+ add_argument("-sV")
32
+ version_intensity(value) if value
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ module Nmapr
2
+ module Options
3
+ module DNS
4
+ def dns(type, value = false)
5
+ case type
6
+ when :disable
7
+ add_argument("-n")
8
+ when false
9
+ dns(:disable)
10
+ when :reverse
11
+ add_argument("-R")
12
+ when true
13
+ reverse(:reverse)
14
+ when :system
15
+ add_argument("--system-dns")
16
+ when :server
17
+ add_argument("--dns-servers " << value)
18
+ when :servers
19
+ add_argument("--dns-servers " << value.join(","))
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,80 @@
1
+ module Nmapr
2
+ module Options
3
+ module Evasion
4
+
5
+ def fragment
6
+ add_argument("-f")
7
+ end
8
+
9
+ def interface(value)
10
+ add_argument("-e " << value)
11
+ end
12
+
13
+ def mtu(value)
14
+ add_argument("-mtu " << value.to_s)
15
+ end
16
+
17
+ def ttl(value)
18
+ add_argument("-ttl " << value.to_s)
19
+ end
20
+
21
+ def decoy(value)
22
+ add_argument("-D " << value)
23
+ end
24
+
25
+ def decoys(value)
26
+ add_argument("-D " << value.join(","))
27
+ end
28
+
29
+ def spoof(type, value)
30
+ case type
31
+ when :ip
32
+ add_argument("-S " << value)
33
+ when :mac
34
+ add_argument("--spoof-mac " << value)
35
+ end
36
+ end
37
+
38
+ def bad_sum
39
+ add_argument("--badsum")
40
+ end
41
+
42
+ def adler32
43
+ add_argument("--adler32")
44
+ end
45
+
46
+ def proxy(value)
47
+ add_argument("--proxies " << value)
48
+ end
49
+
50
+ def proxies(type)
51
+ case type
52
+ when String
53
+ proxy(type)
54
+ when Array
55
+ add_argument("--proxies " << type.join(","))
56
+ end
57
+ end
58
+
59
+ def source_port(value)
60
+ add_argument("--source-port " << value.to_s)
61
+ end
62
+
63
+ def data(type = :hex, value)
64
+ case type
65
+ when :hex
66
+ add_argument("--data " << value)
67
+ when :string
68
+ add_argument("--data-string " << value.to_s)
69
+ when :length
70
+ add_argument("--data-length " << value.to_s)
71
+ end
72
+ end
73
+
74
+ def randomize
75
+ add_argument("--randomize-hosts")
76
+ end
77
+
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,59 @@
1
+ module Nmapr
2
+ module Options
3
+ module Miscellaneos
4
+ def ipv6
5
+ add_argument("-6")
6
+ end
7
+
8
+ def privileged
9
+ add_argument("--privileged")
10
+ end
11
+
12
+ def unprivileged
13
+ add_argument("--unprivileged")
14
+ end
15
+
16
+ def release_memory
17
+ add_argument("--release-memory")
18
+ end
19
+
20
+ def aggressive
21
+ add_argument("-A")
22
+ end
23
+
24
+ def timing(value)
25
+ add_argument("-T" << value.to_s)
26
+ end
27
+
28
+ def ip_protocol
29
+ add_argument("-sO")
30
+ end
31
+
32
+ def just_list
33
+ add_argument("-sL")
34
+ end
35
+
36
+ alias list just_list
37
+
38
+ def fast
39
+ add_argument("-F")
40
+ end
41
+
42
+ def script(value, args = false)
43
+ if args
44
+ add_argument("--script-args " << args)
45
+ end
46
+ add_argument("--script " << value)
47
+ end
48
+
49
+ def send(type)
50
+ case type
51
+ when :eth
52
+ add_argument("--send-eth")
53
+ when :ip
54
+ add_argument("--send-ip")
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,14 @@
1
+ require_relative "ping.rb"
2
+ require_relative "targets.rb"
3
+ require_relative "dns.rb"
4
+ require_relative "tcp.rb"
5
+ require_relative "udp.rb"
6
+ require_relative "sctp.rb"
7
+ require_relative "ports.rb"
8
+ require_relative "detection.rb"
9
+ require_relative "evasion.rb"
10
+ require_relative "output.rb"
11
+ require_relative "verbose.rb"
12
+ require_relative "debugging.rb"
13
+ require_relative "miscellaneos.rb"
14
+ require_relative "performance.rb"
@@ -0,0 +1,20 @@
1
+ module Nmapr
2
+ module Options
3
+ module Output
4
+ def output(type, value)
5
+ case type
6
+ when :file
7
+ add_argument("-oN " << value)
8
+ when :xml
9
+ add_argument("-oX " << value)
10
+ when :leet
11
+ add_argument("-oS " << value)
12
+ when :grepable
13
+ add_argument("-oG " << value)
14
+ when :all
15
+ add_argument("-oA " << value)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,62 @@
1
+ module Nmapr
2
+ module Options
3
+ module Performance
4
+
5
+ def hostgroup(type, value)
6
+ case type
7
+ when :min
8
+ add_argument("--min-hostgroup " << value.to_s)
9
+ when :max
10
+ add_argument("--max-hostgroup " << value.to_s)
11
+ end
12
+ end
13
+
14
+ def parallelism(type, value)
15
+ case type
16
+ when :min
17
+ add_argument("--min-parallelism " << value.to_s)
18
+ when :max
19
+ add_argument("--max-parallelism " << value.to_s)
20
+ end
21
+ end
22
+
23
+ def round_trip_timeout(type, value)
24
+ case type
25
+ when :min
26
+ add_argument("--min-rtt-timeout" << value.to_s)
27
+ when :max
28
+ add_argument("--max-rtt-timeout " << value.to_s)
29
+ when :initial
30
+ add_argument("--initial-rtt-timeout " << value.to_s)
31
+ end
32
+ end
33
+
34
+ def delay(type, value)
35
+ case type
36
+ when :min
37
+ add_argument("--scan-delay " << value.to_s)
38
+ when :max
39
+ add_argument("--max-scan-delay " << value.to_s)
40
+ end
41
+ end
42
+
43
+ def rate(type, value)
44
+ case type
45
+ when :min
46
+ add_argument("--min-rate" << value.to_s)
47
+ when :max
48
+ add_argument("--max-rate" << value.to_s)
49
+ end
50
+ end
51
+
52
+ def host_timeout(value)
53
+ add_argument("--max-hostgroup " << value.to_s)
54
+ end
55
+
56
+ def retries(value)
57
+ add_argument("--max-retries " << value.to_s)
58
+ end
59
+
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,36 @@
1
+ module Nmapr
2
+ module Options
3
+ module Ping
4
+ def ping(type)
5
+ case type
6
+ when :disable
7
+ add_argument("-PN")
8
+ when false
9
+ add_argument("-PN")
10
+ when :only
11
+ add_argument("-sn")
12
+ when true
13
+ add_argument("-sn")
14
+ when :udp
15
+ add_argument("-PU")
16
+ when :tcp_syn
17
+ add_argument("-PS")
18
+ when :tcp_ack
19
+ add_argument("-PA")
20
+ when :sctp_init
21
+ add_argument("-PY")
22
+ when :icmp_echo
23
+ add_argument("-PE")
24
+ when :icmp_timestamp
25
+ add_argument("-PP")
26
+ when :icmp_address_mask
27
+ add_argument("-PM")
28
+ when :ip_protocol
29
+ add_argument("-PO")
30
+ when :arp
31
+ add_argument("-PR")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
1
+ module Nmapr
2
+ module Options
3
+ module Ports
4
+ def port(arg)
5
+ @ports << arg
6
+ end
7
+
8
+ def sequential
9
+ add_argument("-r")
10
+ end
11
+
12
+ def port_ratio(value)
13
+ add_argument("--port-ratio " << value.to_s)
14
+ end
15
+
16
+ def ports(*args)
17
+ args.each do |arg|
18
+ case arg
19
+ when :common
20
+ @ports << "1-1024"
21
+ when :all
22
+ @ports << "*"
23
+ when :top
24
+ add_argument("--top-ports")
25
+ when Integer
26
+ @ports << arg.to_s
27
+ when String
28
+ @ports << arg
29
+ when Array
30
+ ports(arg)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ module Nmapr
2
+ module Options
3
+ module SCTP
4
+ def sctp(type = :init)
5
+ case type
6
+ when :init
7
+ add_argument("-sY")
8
+ when :cookie_echo
9
+ add_argument("-sZ")
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,42 @@
1
+ module Nmapr
2
+ module Options
3
+ module Targets
4
+ def target(arg)
5
+ @targets << arg
6
+ end
7
+
8
+ def target_file(arg)
9
+ add_argument("-iL " << arg)
10
+ end
11
+
12
+ def exclude_file(arg)
13
+ add_argument("--excludefile " << arg)
14
+ end
15
+
16
+ def exclude(*args)
17
+ args.each do |arg|
18
+ case arg
19
+ when String
20
+ @not_targets << arg
21
+ when Array
22
+ arg.each { |a| exclude(a) }
23
+ end
24
+ end
25
+ end
26
+
27
+ def targets(*args)
28
+ args.each do |arg|
29
+ case arg
30
+ when String
31
+ target(arg)
32
+ when Array
33
+ arg.each { |a| targets(a) }
34
+ end
35
+ end
36
+ end
37
+
38
+ alias ips targets
39
+ alias hosts targets
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,31 @@
1
+ module Nmapr
2
+ module Options
3
+ module TCP
4
+ def tcp(type, value = false)
5
+ case type
6
+ when :syn
7
+ add_argument("-sS")
8
+ when :connect
9
+ add_argument("-sT")
10
+ when :null
11
+ add_argument("-sN")
12
+ when :fin
13
+ add_argument("-sF")
14
+ when :ack
15
+ add_argument("-sA")
16
+ when :rpc
17
+ add_argument("-sR")
18
+ when :window
19
+ add_argument("-sW")
20
+ when :maimon
21
+ add_argument("-sM")
22
+ when :xmas
23
+ # Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree.
24
+ add_argument("-sX")
25
+ when :custom
26
+ add_argument("--scanflags " << value) if value.is_a? String
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,9 @@
1
+ module Nmapr
2
+ module Options
3
+ module UDP
4
+ def udp
5
+ add_argument("-sU")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ module Nmapr
2
+ module Options
3
+ module Verbose
4
+ def verbose(value = 1)
5
+ case value
6
+ when :slightly
7
+ verbose(1)
8
+ when :moderately
9
+ verbose(2)
10
+ when :very
11
+ verbose(3)
12
+ when Integer
13
+ verbosity = ""
14
+ value.times do
15
+ verbosity << "v"
16
+ end
17
+ add_argument("-" << verbosity)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ require_relative "options/options.rb"
2
+ require_relative "builders/builders.rb"
3
+
4
+ module Nmapr
5
+
6
+ # A scanner class to take care of a generic nmap scan.
7
+ class Scanner
8
+ include Options::Ping
9
+ include Options::Targets
10
+ include Options::Ports
11
+ include Options::TCP
12
+ include Options::UDP
13
+ include Options::SCTP
14
+ include Options::DNS
15
+ include Options::Detection
16
+ include Options::Evasion
17
+ include Options::Output
18
+ include Options::Verbose
19
+ include Options::Debugging
20
+ include Options::Miscellaneos
21
+ include Options::Performance
22
+ include Builders::Argument
23
+ include Builders::Command
24
+
25
+ def initialize
26
+ @targets = []
27
+ @not_targets = []
28
+ @ports = []
29
+ @arguments = ""
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,25 @@
1
+ module Nmapr
2
+ module Targets
3
+ def random_target
4
+ random_targets(1)
5
+ end
6
+
7
+ def random_targets(number)
8
+ @targets = ["-iR " << number.to_s]
9
+ end
10
+
11
+ def target(arg)
12
+ @targets << arg
13
+ end
14
+
15
+ def targets(*args)
16
+ args.each do |argument|
17
+ if argument.is_a? String
18
+ @targets << argument
19
+ elsif argument.is_a? Array
20
+ @targets += argument
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Nmapr
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "nmapr/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nmapr"
8
+ spec.version = Nmapr::VERSION
9
+ spec.authors = ["Kent 'picat' Gruber"]
10
+ spec.email = ["kgruber1@emich.edu"]
11
+
12
+ spec.summary = %q{Your friendly neighborhood Ruby DSL to Nmap for network explortation.}
13
+ #spec.description = %q{TODO: Write a longer description or delete this line.}
14
+ spec.homepage = "https://github.com/picatz/nmapr"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.15"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nmapr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kent 'picat' Gruber
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-07-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - kgruber1@emich.edu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - examples/debug.rb
73
+ - lib/nmapr.rb
74
+ - lib/nmapr/builders/argument.rb
75
+ - lib/nmapr/builders/builders.rb
76
+ - lib/nmapr/builders/command.rb
77
+ - lib/nmapr/options/debugging.rb
78
+ - lib/nmapr/options/detection.rb
79
+ - lib/nmapr/options/dns.rb
80
+ - lib/nmapr/options/evasion.rb
81
+ - lib/nmapr/options/miscellaneos.rb
82
+ - lib/nmapr/options/options.rb
83
+ - lib/nmapr/options/output.rb
84
+ - lib/nmapr/options/performance.rb
85
+ - lib/nmapr/options/ping.rb
86
+ - lib/nmapr/options/ports.rb
87
+ - lib/nmapr/options/sctp.rb
88
+ - lib/nmapr/options/targets.rb
89
+ - lib/nmapr/options/tcp.rb
90
+ - lib/nmapr/options/udp.rb
91
+ - lib/nmapr/options/verbose.rb
92
+ - lib/nmapr/scanner.rb
93
+ - lib/nmapr/targets.rb
94
+ - lib/nmapr/version.rb
95
+ - nmapr.gemspec
96
+ homepage: https://github.com/picatz/nmapr
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.6.8
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: Your friendly neighborhood Ruby DSL to Nmap for network explortation.
120
+ test_files: []