peplum-nmap 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/rest.rb +3 -0
- data/examples/rpc.rb +4 -1
- data/lib/peplum/nmap/payload.rb +17 -4
- data/lib/peplum/nmap/services/info.rb +26 -0
- data/lib/peplum/nmap/services/rest_proxy.rb +17 -0
- data/lib/peplum/nmap/version.rb +1 -1
- data/lib/peplum/nmap.rb +7 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 909d1bf87e2c6e01c356fdd5052b04c65ab7aa0146793f879351117c717c163f
|
4
|
+
data.tar.gz: d859d987045778ad52e30253c345ac5a7e7dfd45a4e540a5a3b04d184284703c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a87fb1b4e7b775e6ed9039238f023754c6c9ade3252f56955d1a34081c8991f239f016983e7f3206ad8209e2f23b5cee5e58c5a1e381baa47928b0ae4448203
|
7
|
+
data.tar.gz: 50f0c401b91396fe690b9368e21b3cd97198e01d7b27aaf8a15218b32ca0f3e5144fe78d59009a0b5f99708aa5b5a3e61f4e1e50c8b5cb27e739b841568f66a0
|
data/examples/rest.rb
CHANGED
@@ -39,6 +39,9 @@ request :post, 'instances', {
|
|
39
39
|
instance_id = response_data['id']
|
40
40
|
|
41
41
|
while sleep( 1 )
|
42
|
+
request :get, "instances/#{instance_id}/info/progress"
|
43
|
+
ap response_data
|
44
|
+
|
42
45
|
# Continue looping while instance status is 'busy'.
|
43
46
|
request :get, "instances/#{instance_id}"
|
44
47
|
break if !response_data['busy']
|
data/examples/rpc.rb
CHANGED
data/lib/peplum/nmap/payload.rb
CHANGED
@@ -21,11 +21,19 @@ module Payload
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run( targets, options )
|
24
|
-
|
25
|
-
|
24
|
+
# Do it this way so we'll be able to have progress reports per scanned host.
|
25
|
+
merge( targets.map do |target|
|
26
|
+
_run options.merge( targets: target, output_xml: SCAN_REPORT )
|
27
|
+
|
28
|
+
report = report_from_xml( SCAN_REPORT )
|
29
|
+
next if !report.include?('hosts')
|
30
|
+
|
31
|
+
Nmap::Application.master.info.update report
|
32
|
+
report
|
33
|
+
end.compact )
|
26
34
|
end
|
27
35
|
|
28
|
-
def
|
36
|
+
def split( targets, chunks )
|
29
37
|
@hosts ||= self.live_hosts( targets )
|
30
38
|
@hosts.chunk( chunks ).reject(&:empty?)
|
31
39
|
end
|
@@ -45,7 +53,12 @@ module Payload
|
|
45
53
|
ping: true,
|
46
54
|
output_xml: PING_REPORT
|
47
55
|
|
48
|
-
hosts_from_xml( PING_REPORT )
|
56
|
+
hosts = hosts_from_xml( PING_REPORT )
|
57
|
+
|
58
|
+
# Seed the progress data with the live hosts
|
59
|
+
hosts.each { |h| Services::Info.progress_data['hosts'][h] ||= {} }
|
60
|
+
|
61
|
+
hosts
|
49
62
|
end
|
50
63
|
|
51
64
|
def set_default_options( nmap )
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Peplum
|
2
|
+
class Nmap
|
3
|
+
module Services
|
4
|
+
|
5
|
+
class Info
|
6
|
+
|
7
|
+
class <<self
|
8
|
+
def progress_data
|
9
|
+
@progress_data ||= { 'hosts' => {} }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def progress
|
14
|
+
self.class.progress_data
|
15
|
+
end
|
16
|
+
|
17
|
+
def update( data )
|
18
|
+
self.class.progress_data['hosts'].merge! Payload.merge( [self.class.progress_data, data] )['hosts']
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Peplum
|
2
|
+
class Nmap
|
3
|
+
module Services
|
4
|
+
module RESTProxy
|
5
|
+
def self.registered( app )
|
6
|
+
|
7
|
+
app.get '/progress' do
|
8
|
+
instance_for( params[:instance] ) do |instance|
|
9
|
+
json instance.info.progress
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/peplum/nmap/version.rb
CHANGED
data/lib/peplum/nmap.rb
CHANGED
@@ -11,6 +11,13 @@ class Nmap
|
|
11
11
|
class Error < Peplum::Error; end
|
12
12
|
|
13
13
|
class Application < Peplum::Application
|
14
|
+
|
15
|
+
require_relative "nmap/services/info"
|
16
|
+
instance_service_for :info, Services::Info
|
17
|
+
|
18
|
+
require_relative "nmap/services/rest_proxy"
|
19
|
+
rest_service_for :info, Services::RESTProxy
|
20
|
+
|
14
21
|
def payload
|
15
22
|
Payload
|
16
23
|
end
|
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.2.
|
4
|
+
version: 0.2.2
|
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
|
@@ -53,6 +53,8 @@ files:
|
|
53
53
|
- examples/rpc.rb
|
54
54
|
- lib/peplum/nmap.rb
|
55
55
|
- lib/peplum/nmap/payload.rb
|
56
|
+
- lib/peplum/nmap/services/info.rb
|
57
|
+
- lib/peplum/nmap/services/rest_proxy.rb
|
56
58
|
- lib/peplum/nmap/version.rb
|
57
59
|
- peplum-nmap.gemspec
|
58
60
|
homepage: http://ecsypno.com/
|