dradis-plugins 3.6.0 → 3.7.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 +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/dradis/plugins/content_service/base.rb +2 -0
- data/lib/dradis/plugins/content_service/core.rb +3 -2
- data/lib/dradis/plugins/content_service/issues.rb +6 -3
- data/lib/dradis/plugins/content_service/nodes.rb +41 -0
- data/lib/dradis/plugins/content_service/properties.rb +9 -0
- data/lib/dradis/plugins/gem_version.rb +2 -2
- data/lib/dradis/plugins/thor_helper.rb +20 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4465a6abfcfcc1f72c2507db25a1fec1c078539
|
4
|
+
data.tar.gz: 451a8b3b7676968c4f2cd9640ed975b02cb31d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38544da5415a6f1107a641b549e20b088767a58c040e97842a3f314813d2563fb313ceeaeb0dc2e60060760928d6f6cff23a1d2d55109a49674cbd31261e9b34
|
7
|
+
data.tar.gz: 918e42243f03461549f368abf0e2f59ce60a6dcf0428ed56bd3b77645d5c94d41fdbc12e6374c78eb2f38ef44c811e66c3709a888ece8866059b7258c1a992a2
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
## Dradis Framework 3.
|
1
|
+
## Dradis Framework 3.7 (July, 2017) ##
|
2
|
+
|
3
|
+
* Add ContentService#all_properties method to access the current project's
|
4
|
+
document properties.
|
5
|
+
|
6
|
+
* Don't lose :plugin and :plugin_id from ContentService#create_issue due to
|
7
|
+
excessive input length.
|
8
|
+
|
9
|
+
## Dradis Framework 3.6 (April 6, 2017) ##
|
2
10
|
|
3
11
|
* Split the ContentService into multiple modules.
|
4
12
|
|
@@ -5,6 +5,7 @@ require 'dradis/plugins/content_service/evidence'
|
|
5
5
|
require 'dradis/plugins/content_service/issues'
|
6
6
|
require 'dradis/plugins/content_service/nodes'
|
7
7
|
require 'dradis/plugins/content_service/notes'
|
8
|
+
require 'dradis/plugins/content_service/properties'
|
8
9
|
|
9
10
|
module Dradis::Plugins::ContentService
|
10
11
|
class Base
|
@@ -16,6 +17,7 @@ module Dradis::Plugins::ContentService
|
|
16
17
|
include Issues
|
17
18
|
include Nodes
|
18
19
|
include Notes
|
20
|
+
include Properties if defined?(Dradis::Pro)
|
19
21
|
|
20
22
|
ActiveSupport.run_load_hooks(:content_service, self)
|
21
23
|
end
|
@@ -28,6 +28,7 @@ module Dradis::Plugins::ContentService
|
|
28
28
|
field = args[:field]
|
29
29
|
text = args[:text]
|
30
30
|
msg = args[:msg]
|
31
|
+
tail = "..." + args[:tail].to_s
|
31
32
|
|
32
33
|
logger.error{ "Trying to rescue from a :length error" }
|
33
34
|
|
@@ -36,11 +37,11 @@ module Dradis::Plugins::ContentService
|
|
36
37
|
msg = "#[Title]#\nTruncation warning!\n\n"
|
37
38
|
msg << "#[Error]#\np(alert alert-error). The plugin tried to store content that was too big for the DB. Review the source to ensure no important data was lost.\n\n"
|
38
39
|
msg << text
|
39
|
-
model.send("#{field}=", msg.truncate(65300))
|
40
|
+
model.send("#{field}=", msg.truncate(65300, omission: tail))
|
40
41
|
else
|
41
42
|
# bail
|
42
43
|
msg = "#[Title]#\n#{msg}\n\n"
|
43
|
-
msg << "#[Description]#\nbc. #{
|
44
|
+
msg << "#[Description]#\nbc. #{model.errors.inspect}\n\n"
|
44
45
|
model.send("#{field}=", msg)
|
45
46
|
end
|
46
47
|
if model.valid?
|
@@ -19,8 +19,10 @@ module Dradis::Plugins::ContentService
|
|
19
19
|
return issue_cache[cache_key] if issue_cache.key?(cache_key)
|
20
20
|
|
21
21
|
# we inject the source Plugin and unique ID into the issue's text
|
22
|
-
|
23
|
-
|
22
|
+
plugin_details =
|
23
|
+
"\n\n#[plugin]#\n#{uuid[0]}\n" \
|
24
|
+
"\n\n#[plugin_id]#\n#{uuid[1]}\n"
|
25
|
+
text << plugin_details
|
24
26
|
|
25
27
|
issue = Issue.new(text: text) do |i|
|
26
28
|
i.author = default_author
|
@@ -35,7 +37,8 @@ module Dradis::Plugins::ContentService
|
|
35
37
|
model: issue,
|
36
38
|
field: :text,
|
37
39
|
text: text,
|
38
|
-
msg: 'Error in create_issue()'
|
40
|
+
msg: 'Error in create_issue()',
|
41
|
+
tail: plugin_details
|
39
42
|
)
|
40
43
|
end
|
41
44
|
|
@@ -2,6 +2,21 @@ module Dradis::Plugins::ContentService
|
|
2
2
|
module Nodes
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
def reporting_nodes
|
6
|
+
nodes = []
|
7
|
+
|
8
|
+
nodes |= nodes_from_evidence
|
9
|
+
nodes |= nodes_from_properties
|
10
|
+
|
11
|
+
# Note that the below sorting would the non-IP nodes first, then the IP
|
12
|
+
# nodes, and will sort them by each octet.
|
13
|
+
#
|
14
|
+
# See:
|
15
|
+
# http://stackoverflow.com/questions/13996033/sorting-an-array-in-ruby-special-case
|
16
|
+
# http://tech.maynurd.com/archives/124
|
17
|
+
nodes.sort_by! { |node| node.label.split('.').map(&:to_i) }
|
18
|
+
end
|
19
|
+
|
5
20
|
def create_node(args={})
|
6
21
|
label = args[:label] || default_node_label
|
7
22
|
parent = args[:parent] || default_node_parent
|
@@ -35,5 +50,31 @@ module Dradis::Plugins::ContentService
|
|
35
50
|
def default_node_type
|
36
51
|
@default_node_type ||= Node::Types::DEFAULT
|
37
52
|
end
|
53
|
+
|
54
|
+
|
55
|
+
# Private: this method returns a list of nodes associated with Evidence
|
56
|
+
# instances. When a node is affected by multiple issues, or multiple pieces
|
57
|
+
# of evidence, we just want a single reference to it.
|
58
|
+
#
|
59
|
+
# Returns and Array with a unique collection of Nodes.
|
60
|
+
def nodes_from_evidence
|
61
|
+
all_issues.
|
62
|
+
includes(:evidence, evidence: :node).
|
63
|
+
collect(&:evidence).
|
64
|
+
# Each Issue can have 0, 1 or more Evidence
|
65
|
+
map { |evidence_collection| evidence_collection.collect(&:node) }.
|
66
|
+
flatten.
|
67
|
+
uniq
|
68
|
+
end
|
69
|
+
|
70
|
+
# Private: this method returns a list of nodes in the project that have some
|
71
|
+
# properties associated with them. Typically properties are used for HOST
|
72
|
+
# type nodes, and even if they have no issues / evidence associated, we want
|
73
|
+
# to include them in the report.
|
74
|
+
#
|
75
|
+
# Returns and Array with a unique collection of Nodes.
|
76
|
+
def nodes_from_properties
|
77
|
+
Node.user_nodes.where('properties IS NOT NULL AND properties != \'{}\'')
|
78
|
+
end
|
38
79
|
end
|
39
80
|
end
|
@@ -2,9 +2,28 @@ module Dradis
|
|
2
2
|
module Plugins
|
3
3
|
# Helper methods for plugin Thor tasks
|
4
4
|
module ThorHelper
|
5
|
+
attr_accessor :task_options, :logger
|
6
|
+
|
5
7
|
def detect_and_set_project_scope
|
6
8
|
;
|
7
9
|
end
|
10
|
+
|
11
|
+
def task_options
|
12
|
+
@task_options ||= { logger: logger }
|
13
|
+
end
|
14
|
+
|
15
|
+
def logger
|
16
|
+
@logger ||= default_logger
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
private
|
21
|
+
def default_logger
|
22
|
+
STDOUT.sync = true
|
23
|
+
logger = Logger.new(STDOUT)
|
24
|
+
logger.level = Logger::DEBUG
|
25
|
+
logger
|
26
|
+
end
|
8
27
|
end
|
9
28
|
end
|
10
|
-
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/dradis/plugins/content_service/issues.rb
|
82
82
|
- lib/dradis/plugins/content_service/nodes.rb
|
83
83
|
- lib/dradis/plugins/content_service/notes.rb
|
84
|
+
- lib/dradis/plugins/content_service/properties.rb
|
84
85
|
- lib/dradis/plugins/engine.rb
|
85
86
|
- lib/dradis/plugins/export.rb
|
86
87
|
- lib/dradis/plugins/export/base.rb
|
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
126
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.6.8
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: Plugin manager for the Dradis Framework project.
|