peplum-nmap 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 909d1bf87e2c6e01c356fdd5052b04c65ab7aa0146793f879351117c717c163f
4
- data.tar.gz: d859d987045778ad52e30253c345ac5a7e7dfd45a4e540a5a3b04d184284703c
3
+ metadata.gz: d908da9a53e5a64f52446ad732503d62744dfa2a20632d28b0e3b2273cc2dc18
4
+ data.tar.gz: a816397bc1c7685af4159eeaf32b2604e0dd25bea19ae33589ba18f08ee9c607
5
5
  SHA512:
6
- metadata.gz: 4a87fb1b4e7b775e6ed9039238f023754c6c9ade3252f56955d1a34081c8991f239f016983e7f3206ad8209e2f23b5cee5e58c5a1e381baa47928b0ae4448203
7
- data.tar.gz: 50f0c401b91396fe690b9368e21b3cd97198e01d7b27aaf8a15218b32ca0f3e5144fe78d59009a0b5f99708aa5b5a3e61f4e1e50c8b5cb27e739b841568f66a0
6
+ metadata.gz: c6faf1368cb4627eb22b992bd19023f6318d4a24fa5ebf56095de003b36bda6fc54b092dfb45e9740e06bbf69cc549a60724131bfbaf9eddd02ec2d637025139
7
+ data.tar.gz: 9023be58238b489c87403d2c542badb755e61db8b5c4a64032fcfd90b5710287d5eb040eea4781e745c94498feb91c0d1a6d05b7b97dab96f87253d32129e900
@@ -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
- merge( targets.map do |target|
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 !report.include?('hosts')
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['hosts'][h] ||= {} }
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['hosts'] ||= {}
97
- report_data['hosts'][host.ip] = host_to_hash( host )
89
+ report_data[host.ip] = host_to_hash( host )
98
90
 
99
- report_data['hosts'][host.ip]['ports'] = {}
91
+ report_data[host.ip]['ports'] = {}
100
92
  host.each_port do |port|
101
- report_data['hosts'][host.ip]['ports'][port.number] = port_to_hash( port )
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 ||= { 'hosts' => {} }
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['hosts'].merge! Payload.merge( [self.class.progress_data, data] )['hosts']
18
+ self.class.progress_data.merge! Payload.merge( [self.class.progress_data, data] )
19
19
  nil
20
20
  end
21
21
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Peplum
4
4
  class Nmap
5
- VERSION = "0.2.2"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peplum-nmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tasos Laskos