rangescan 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/rangescan +2 -1
- data/lib/rangescan/cli.rb +9 -0
- data/lib/rangescan/scanner.rb +15 -5
- data/lib/rangescan/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 643ca26936dec4a00aabc6551e9cea7c87cecfda46d5055c26f1c3e3c967893b
|
4
|
+
data.tar.gz: 6f034dcd1e4d5c59b36baec5ea6e4911aba47d88cd462d92a33898194b871839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2ce5509d388bc2d8026a8d9534339c5428bb974751d4e48ca73964d517a6de38665b8fb070247ee28cab5203b3bbad495890b6576bee1a89bb0008437130a1b
|
7
|
+
data.tar.gz: '098beb8cbee3e0f21302a2cffbaa83f9bdae11b9d80270517e7c92210bb8bf0db8050e337f180ba31a128e2cb4d858405f6e0ea0e4604905c54790abfcb27bef'
|
data/exe/rangescan
CHANGED
data/lib/rangescan/cli.rb
CHANGED
@@ -13,6 +13,7 @@ module RangeScan
|
|
13
13
|
method_option :user_agent, type: :string, desc: "User Agent"
|
14
14
|
method_option :verify_ssl, type: :boolean, desc: "Whether to verify SSL or not"
|
15
15
|
method_option :max_concurrency, type: :numeric, desc: "Concurrency limit for HTTP requests to scan"
|
16
|
+
method_option :headers, type: :hash, default: {}, desc: "Custom headers"
|
16
17
|
def scan(ip_with_subnet_mask, regexp = ".")
|
17
18
|
symbolized_options = symbolize_hash_keys(options)
|
18
19
|
range = Range.new(ip_with_subnet_mask)
|
@@ -26,10 +27,18 @@ module RangeScan
|
|
26
27
|
puts JSON.pretty_generate(filtered)
|
27
28
|
end
|
28
29
|
|
30
|
+
default_command :scan
|
31
|
+
|
29
32
|
no_commands do
|
30
33
|
def symbolize_hash_keys(hash)
|
31
34
|
hash.map { |k, v| [k.to_sym, v] }.to_h
|
32
35
|
end
|
33
36
|
end
|
37
|
+
|
38
|
+
class << self
|
39
|
+
def exit_on_failure?
|
40
|
+
true
|
41
|
+
end
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
data/lib/rangescan/scanner.rb
CHANGED
@@ -11,6 +11,7 @@ require "rangescan/monkey_patch"
|
|
11
11
|
module RangeScan
|
12
12
|
class Scanner
|
13
13
|
attr_reader :context
|
14
|
+
attr_reader :headers
|
14
15
|
attr_reader :host
|
15
16
|
attr_reader :max_concurrency
|
16
17
|
attr_reader :port
|
@@ -21,19 +22,28 @@ module RangeScan
|
|
21
22
|
attr_reader :user_agent
|
22
23
|
attr_reader :verify_ssl
|
23
24
|
|
24
|
-
def initialize(
|
25
|
+
def initialize(
|
26
|
+
headers: {},
|
27
|
+
host: nil,
|
28
|
+
max_concurrency: nil,
|
29
|
+
port: nil,
|
30
|
+
scheme: "http",
|
31
|
+
timeout: 5,
|
32
|
+
user_agent: nil,
|
33
|
+
verify_ssl: true
|
34
|
+
)
|
35
|
+
@headers = headers
|
25
36
|
@host = host
|
26
37
|
@port = port || (scheme == "http" ? 80 : 443)
|
27
|
-
@timeout = timeout
|
28
38
|
@scheme = scheme
|
39
|
+
@timeout = timeout
|
29
40
|
@user_agent = user_agent
|
30
|
-
|
31
41
|
@verify_ssl = verify_ssl
|
32
42
|
|
33
43
|
@ssl_context = OpenSSL::SSL::SSLContext.new
|
34
44
|
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE unless verify_ssl
|
35
45
|
|
36
|
-
@max_concurrency = max_concurrency || Etc.nprocessors *
|
46
|
+
@max_concurrency = max_concurrency || Etc.nprocessors * 8
|
37
47
|
end
|
38
48
|
|
39
49
|
def url_for(ipv4)
|
@@ -78,7 +88,7 @@ module RangeScan
|
|
78
88
|
private
|
79
89
|
|
80
90
|
def default_request_headers
|
81
|
-
@default_request_headers ||= { "host" => host, "user-agent" => user_agent }.compact
|
91
|
+
@default_request_headers ||= headers.merge({ "host" => host, "user-agent" => user_agent }.compact)
|
82
92
|
end
|
83
93
|
|
84
94
|
def ssl_options
|
data/lib/rangescan/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rangescan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu Niseki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|