peplum-nmap 0.2.2 → 0.3.1
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 +8 -16
- data/lib/peplum/nmap/services/info.rb +2 -2
- data/lib/peplum/nmap/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22db0b582b78dd84d8581db7bc36a706f3a5a329413f21c668e0dca7a7956bc
|
4
|
+
data.tar.gz: ba7609f7daaed784432fa341bd3fe2579bf3cc83f5797a78ad659a2cf1258def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff6ed52c578a1b8de3eae2af817b30eafe8ac288899cd3e7998d5fafe695386e8991f7278202eaa0b848ad0f81cb2e652955073fc0969df81e95eb95ccabcdd
|
7
|
+
data.tar.gz: 2290ff495e066f2a5a473b0c2e7fc9b653c4748470c60e3078059490b22641a59ac3bb99c227580afa12bb291c00a079b49b531e34ebedcb8028dd11f12bab1a
|
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,15 +23,15 @@ 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
37
|
def split( targets, chunks )
|
@@ -38,14 +39,6 @@ module Payload
|
|
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! data
|
19
19
|
nil
|
20
20
|
end
|
21
21
|
|
data/lib/peplum/nmap/version.rb
CHANGED