peplum-nmap 0.2.1 → 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/lib/peplum/nmap/payload.rb +9 -17
- data/lib/peplum/nmap/services/info.rb +2 -2
- data/lib/peplum/nmap/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: d908da9a53e5a64f52446ad732503d62744dfa2a20632d28b0e3b2273cc2dc18
|
4
|
+
data.tar.gz: a816397bc1c7685af4159eeaf32b2604e0dd25bea19ae33589ba18f08ee9c607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6faf1368cb4627eb22b992bd19023f6318d4a24fa5ebf56095de003b36bda6fc54b092dfb45e9740e06bbf69cc549a60724131bfbaf9eddd02ec2d637025139
|
7
|
+
data.tar.gz: 9023be58238b489c87403d2c542badb755e61db8b5c4a64032fcfd90b5710287d5eb040eea4781e745c94498feb91c0d1a6d05b7b97dab96f87253d32129e900
|
data/lib/peplum/nmap/payload.rb
CHANGED
@@ -6,6 +6,7 @@ module Peplum
|
|
6
6
|
class Nmap
|
7
7
|
|
8
8
|
module Payload
|
9
|
+
include Peplum::Application::Payload
|
9
10
|
|
10
11
|
DEFAULT_OPTIONS = {
|
11
12
|
'output_normal' => '/dev/null',
|
@@ -22,30 +23,22 @@ module Payload
|
|
22
23
|
|
23
24
|
def run( targets, options )
|
24
25
|
# Do it this way so we'll be able to have progress reports per scanned host.
|
25
|
-
|
26
|
+
targets.map do |target|
|
26
27
|
_run options.merge( targets: target, output_xml: SCAN_REPORT )
|
27
28
|
|
28
29
|
report = report_from_xml( SCAN_REPORT )
|
29
|
-
next if
|
30
|
+
next if report.empty?
|
30
31
|
|
31
32
|
Nmap::Application.master.info.update report
|
32
33
|
report
|
33
|
-
end.compact
|
34
|
+
end.compact
|
34
35
|
end
|
35
36
|
|
36
|
-
def
|
37
|
+
def split( targets, chunks )
|
37
38
|
@hosts ||= self.live_hosts( targets )
|
38
39
|
@hosts.chunk( chunks ).reject(&:empty?)
|
39
40
|
end
|
40
41
|
|
41
|
-
def merge( data )
|
42
|
-
report = { 'hosts' => {} }
|
43
|
-
data.each do |d|
|
44
|
-
report['hosts'].merge! d['hosts']
|
45
|
-
end
|
46
|
-
report
|
47
|
-
end
|
48
|
-
|
49
42
|
private
|
50
43
|
|
51
44
|
def live_hosts( targets )
|
@@ -56,7 +49,7 @@ module Payload
|
|
56
49
|
hosts = hosts_from_xml( PING_REPORT )
|
57
50
|
|
58
51
|
# Seed the progress data with the live hosts
|
59
|
-
hosts.each { |h| Services::Info.progress_data[
|
52
|
+
hosts.each { |h| Services::Info.progress_data[h] ||= {} }
|
60
53
|
|
61
54
|
hosts
|
62
55
|
end
|
@@ -93,12 +86,11 @@ module Payload
|
|
93
86
|
report_data = {}
|
94
87
|
::Nmap::XML.open( xml ) do |xml|
|
95
88
|
xml.each_host do |host|
|
96
|
-
report_data[
|
97
|
-
report_data['hosts'][host.ip] = host_to_hash( host )
|
89
|
+
report_data[host.ip] = host_to_hash( host )
|
98
90
|
|
99
|
-
report_data[
|
91
|
+
report_data[host.ip]['ports'] = {}
|
100
92
|
host.each_port do |port|
|
101
|
-
report_data[
|
93
|
+
report_data[host.ip]['ports'][port.number] = port_to_hash( port )
|
102
94
|
end
|
103
95
|
end
|
104
96
|
end
|
@@ -6,7 +6,7 @@ class Info
|
|
6
6
|
|
7
7
|
class <<self
|
8
8
|
def progress_data
|
9
|
-
@progress_data ||= {
|
9
|
+
@progress_data ||= {}
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -15,7 +15,7 @@ class Info
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def update( data )
|
18
|
-
self.class.progress_data
|
18
|
+
self.class.progress_data.merge! Payload.merge( [self.class.progress_data, data] )
|
19
19
|
nil
|
20
20
|
end
|
21
21
|
|
data/lib/peplum/nmap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peplum-nmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Laskos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: peplum
|