rangescan 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rangescan.rb +1 -0
- data/lib/rangescan/scanner.rb +9 -3
- data/lib/rangescan/utils.rb +17 -0
- data/lib/rangescan/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1d88f06375987da13e9983620c34abb676dfe2b12b3e6b6f6f1f8f85468b7e1
|
4
|
+
data.tar.gz: dde41f60761ce812ee29210468c4c685381a0c7431ff0d1e88be841e88500de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c33c2d5f53ca8328b5c04df66cb8856dadf13662ee0477576bd56682d4e223083682fec64f3206deb86ce1065a52ab2fd016d93617f5f5b70190b4ebfbd2a202
|
7
|
+
data.tar.gz: e92a5a7cab860c07d571187cb140260d5ba0510d1ac63077b9c41c8e3608a5b2b11893dfbc6cba75835e2e2e5c34bbd569e883e72b8fc16d875d43d139e6756f
|
data/lib/rangescan.rb
CHANGED
data/lib/rangescan/scanner.rb
CHANGED
@@ -24,6 +24,12 @@ module RangeScan
|
|
24
24
|
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE unless verify_ssl
|
25
25
|
end
|
26
26
|
|
27
|
+
def url_for(ipv4)
|
28
|
+
return "#{scheme}://#{ipv4}" if (port == 80 && scheme == "http") || (port == 443 && scheme == "https")
|
29
|
+
|
30
|
+
"#{scheme}://#{ipv4}:#{port}"
|
31
|
+
end
|
32
|
+
|
27
33
|
def scan(ipv4s)
|
28
34
|
Parallel.map(ipv4s) do |ipv4|
|
29
35
|
get ipv4
|
@@ -41,7 +47,7 @@ module RangeScan
|
|
41
47
|
end
|
42
48
|
|
43
49
|
def get(ipv4)
|
44
|
-
url =
|
50
|
+
url = url_for(ipv4)
|
45
51
|
|
46
52
|
begin
|
47
53
|
res = HTTP.timeout(timeout).headers(default_headers).get(url, ssl_options)
|
@@ -49,8 +55,8 @@ module RangeScan
|
|
49
55
|
url: url,
|
50
56
|
ipv4: ipv4,
|
51
57
|
code: res.code,
|
52
|
-
headers: res.headers
|
53
|
-
body: res.body.to_s
|
58
|
+
headers: Utils.to_utf8(res.headers),
|
59
|
+
body: Utils.to_utf8(res.body.to_s)
|
54
60
|
}
|
55
61
|
rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError
|
56
62
|
nil
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RangeScan
|
4
|
+
class Utils
|
5
|
+
class << self
|
6
|
+
def to_utf8(obj)
|
7
|
+
return obj.dup.force_encoding(Encoding::UTF_8) if obj.is_a?(String)
|
8
|
+
|
9
|
+
obj.map do |k, v|
|
10
|
+
k = k.dup.force_encoding(Encoding::UTF_8) if k.is_a?(String)
|
11
|
+
v = v.dup.force_encoding(Encoding::UTF_8) if v.is_a?(String)
|
12
|
+
[k, v]
|
13
|
+
end.to_h
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
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.1.
|
4
|
+
version: 0.1.3
|
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-06-
|
11
|
+
date: 2020-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/rangescan/matcher.rb
|
174
174
|
- lib/rangescan/range.rb
|
175
175
|
- lib/rangescan/scanner.rb
|
176
|
+
- lib/rangescan/utils.rb
|
176
177
|
- lib/rangescan/version.rb
|
177
178
|
- rangescan.gemspec
|
178
179
|
homepage: https://github.com/ninoseki/rangescan
|