dradis-pdf_export 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2b4fe7c789940f102135b59c9bac0ec1750250ccd1e8ae4f43ef511a88da2c24
4
+ data.tar.gz: 4d21172050f7db481935f411c159e6cddaef2e3bda5c5827a76ee10080bba7c8
5
+ SHA512:
6
+ metadata.gz: 68854d55c5b6c746dd7a1bc5f1e35ef5ba9dfbf2d775e7dfd5e28cec29e7e9985d277130b9164c4b7f5a4e1539f4f396754a7dad87f019fe80ddadfeb5aa8f12
7
+ data.tar.gz: f8a4e5a79538ed2bb548c1218784e70e95404f1aa9c5c1f6750f59e4e8196d4947de6785a7053dd7003399174f15509b690c6500f1434dc8bceaaa1ec38f1dce
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .bundle/
2
+ vendor/bundle/
3
+ Gemfile.lock
data/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ v4.1.0 (November 2021)
2
+ - No changes
3
+
4
+ v4.0.0 (July 2021)
5
+ - No changes
6
+
7
+ v3.22.0 (April 2021)
8
+ - No changes
9
+
10
+ v3.21.0 (February 2021)
11
+ - No changes
12
+
13
+ v3.20.0 (December 2020)
14
+ - No changes
15
+
16
+ v3.19.0 (September 2020)
17
+ - No changes
18
+
19
+ v3.18.0 (July 2020)
20
+ - No changes
21
+
22
+ v3.17.0 (May 2020)
23
+ - No changes
24
+
25
+ v3.16.0 (February 2020)
26
+ - No changes
27
+
28
+ v3.15.0 (November 2019)
29
+ - No changes
30
+
31
+ v3.14.0 (August 2019)
32
+ - No changes
33
+
34
+ v3.13.0 (June 2019)
35
+ - No changes
36
+
37
+ v3.12.0 (March 2019)
38
+ - No changes
39
+
40
+ v3.11.0 (November 2018)
41
+ - No changes
42
+
43
+ v3.10.0 (August 2018)
44
+ - No changes
45
+
46
+ v3.9.0 (January 2018)
47
+ - No changes
48
+
49
+ v3.8.0 (September 2017)
50
+ - No changes
51
+
52
+ v3.7.0 (July 2017)
53
+ - No changes
54
+
55
+ v3.6.0 (March 2017)
56
+ - No changes
@@ -0,0 +1,12 @@
1
+ [v#.#.#] ([month] [YYYY])
2
+ - [future tense verb] [feature]
3
+ - Upgraded gems:
4
+ - [gem]
5
+ - Bugs fixes:
6
+ - [future tense verb] [bug fix]
7
+ - Bug tracker items:
8
+ - [item]
9
+ - Security Fixes:
10
+ - High: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
11
+ - Medium: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
12
+ - Low: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,3 @@
1
+ This is a plugin for the Dradis Framework, please see:
2
+
3
+ https://github.com/dradis/dradisframework/blob/master/CONTRIBUTING.md
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dradis-html_export.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ This is a plugin for the Dradis Framework, please see:
2
+
3
+ https://github.com/dradis/dradisframework/blob/master/LICENSE
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # PDF export plugin for the Dradis Framework
2
+
3
+ [![Build Status](https://secure.travis-ci.org/dradis/dradis-pdf_export.png?branch=master)](http://travis-ci.org/dradis/dradis-pdf_export)
4
+
5
+
6
+ This plugin generates a PDF report from the notes in your [Dradis Framework](https://github.com/dradis/dradisframework) repository.
7
+
8
+ It uses the amazing [Prawn](https://github.com/prawnpdf/prawn) library to do the PDF heavy lifting.
9
+
10
+ The add-on requires [Dradis CE](https://dradisframework.org/) > 3.0, or [Dradis Pro](https://dradisframework.com/pro/).
11
+
12
+
13
+ ## More information
14
+
15
+ See the Dradis Framework's [README.md](https://github.com/dradis/dradisframework/blob/master/README.md)
16
+
17
+
18
+ ## Contributing
19
+
20
+ See the Dradis Framework's [CONTRIBUTING.md](https://github.com/dradis/dradisframework/blob/master/CONTRIBUTING.md)
21
+
22
+
23
+ ## License
24
+
25
+ Dradis Framework is released under [GNU General Public License version 2.0](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
26
+
27
+
28
+ ## Feature requests and bugs
29
+
30
+ Please use the [Dradis Framework issue tracker](https://github.com/dradis/dradis-ce/issues) for add-on improvements and bug reports.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
Binary file
@@ -0,0 +1,20 @@
1
+ module Dradis
2
+ module Plugins
3
+ module PdfExport
4
+
5
+ class BaseController < Dradis::Plugins::Export::BaseController
6
+ # This method cycles throw the notes in the reporting category and creates
7
+ # a simple PDF report with them.
8
+ def index
9
+ exporter = Dradis::Plugins::PdfExport::Exporter.new(export_options)
10
+ pdf = exporter.export
11
+
12
+ send_data pdf.render, filename: "dradis_report-#{Time.now.to_i}.pdf",
13
+ type: 'application/pdf',
14
+ disposition: 'inline'
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Dradis::Plugins::PdfExport::Engine.routes.draw do
2
+ root to: 'base#index'
3
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/dradis/plugins/pdf_export/version', __FILE__)
3
+ version = Dradis::Plugins::PdfExport::version
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.platform = Gem::Platform::RUBY
7
+ spec.name = "dradis-pdf_export"
8
+ spec.version = version
9
+ spec.required_ruby_version = '>= 1.9.3'
10
+ spec.license = 'GPL-2'
11
+
12
+ spec.authors = ['Daniel Martin']
13
+ spec.email = ["<etd@nomejortu.com>"]
14
+ spec.description = %q{Export to PDF plugin for the Dradis Framework}
15
+ spec.summary = %q{Dradis PDF export plugin}
16
+ spec.homepage = 'http://dradisframework.org'
17
+
18
+ spec.files = `git ls-files`.split($\)
19
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency 'dradis-plugins', '~> 4.0'
24
+ spec.add_dependency 'prawn', '~> 0.15.0'
25
+
26
+ spec.add_development_dependency 'capybara', '~> 1.1.3'
27
+ spec.add_development_dependency 'database_cleaner'
28
+ spec.add_development_dependency 'factory_girl_rails'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec-rails', '~> 2.11.0'
31
+ spec.add_development_dependency 'sqlite3'
32
+ end
@@ -0,0 +1,31 @@
1
+ module Dradis
2
+ module Plugins
3
+ module PdfExport
4
+
5
+ class Engine < ::Rails::Engine
6
+ # Standard Rails Engine stuff
7
+ isolate_namespace Dradis::Plugins::PdfExport
8
+
9
+ # use rspec for tests
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ end
13
+
14
+ # Connect to the Framework
15
+ include Dradis::Plugins::Base
16
+
17
+ # plugin_name 'HTML export'
18
+ provides :export
19
+ description 'Generate PDF reports'
20
+
21
+
22
+ initializer 'dradis-pdf_export.mount_engine' do
23
+ Rails.application.routes.append do
24
+ mount Dradis::Plugins::PdfExport::Engine => '/export/pdf'
25
+ end
26
+ end
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,170 @@
1
+ module Dradis
2
+ module Plugins
3
+ module PdfExport
4
+
5
+ class Processor < Prawn::Document
6
+ def initialize(args={})
7
+ super(top_margin: 70)
8
+
9
+ content_service = args[:content_service]
10
+
11
+ @author = 'Security Tester'
12
+ @email = 'tester@securitytesting.com'
13
+ @issues = content_service.all_issues
14
+ @notes = content_service.all_notes
15
+ @title = "Dradis Framework - v#{Dradis::CE::VERSION::STRING}"
16
+
17
+ sort_issues
18
+ end
19
+
20
+ def generate
21
+ cover_page
22
+ project_notes
23
+ summary_of_findings
24
+ detailed_findings
25
+ tool_list
26
+
27
+ # outline
28
+ end
29
+
30
+ private
31
+ def sort_issues
32
+ sorted = { info: [], low: [], medium: [], high: []}
33
+ @issues.each do |issue|
34
+ cvss = issue.fields['CVSSv2'].to_f;
35
+ case cvss
36
+ when 0..0.9
37
+ sorted[:info] << issue
38
+ when 1.0..3.9
39
+ sorted[:low] << issue
40
+ when 4.0..6.9
41
+ sorted[:medium] << issue
42
+ else
43
+ sorted[:high] << issue
44
+ end
45
+ end
46
+ @sorted = sorted[:high] + sorted[:medium] + sorted[:low] + sorted[:info]
47
+ end
48
+
49
+ def cover_page
50
+ move_down 50
51
+ image "#{Engine.config.paths['app/assets'].expanded.first}/logo_pdf.jpg", position: :center
52
+ move_down 20
53
+
54
+ text '<b><font size="24">Security Assessment Report</font></b>', inline_format: true, align: :center
55
+ move_down 20
56
+ text "BlackHat Arsenal 2018", align: :center
57
+
58
+
59
+ bounding_box([300, 150], width: 200, height: 150) do
60
+ # transparent(0.5) { stroke_bounds } # This will stroke on one page
61
+ text "<b>Author</b>: #{@author}", inline_format: :true
62
+ text "<b>Email</b>: #{@email}", inline_format: :true
63
+ text "<b>Date</b>: #{Time.now.strftime('%Y-%m-%d')}", inline_format: :true
64
+ # transparent(0.5) { stroke_bounds } # And this will stroke on the next
65
+ end
66
+ start_new_page
67
+ end
68
+
69
+ def project_notes
70
+ draw_header
71
+
72
+ text 'Project notes'
73
+ move_down 20
74
+
75
+ @notes.each do |note|
76
+ fields = note.fields
77
+ text "<b>#{fields['Title']}</b>", inline_format: true
78
+ text fields['Description']
79
+ end
80
+
81
+ start_new_page
82
+ end
83
+
84
+ def summary_of_findings
85
+ draw_header
86
+
87
+ text 'SUMMARY OF FINDINGS'
88
+ move_down 20
89
+
90
+ @sorted.each do |note|
91
+ fields = note.fields
92
+ text "• #{fields['Title']} (#{fields['CVSSv2']})"
93
+ end
94
+
95
+ start_new_page
96
+ end
97
+
98
+ def detailed_findings
99
+ draw_header
100
+
101
+ text 'DETAILED FINDINGS'
102
+ move_down 20
103
+
104
+ @sorted.each do |note|
105
+ fields = note.fields
106
+ text "<b>#{fields['Title']}</b> (#{fields['CVSSv2']})", inline_format: true
107
+ text fields['Description']
108
+
109
+ move_down 20
110
+ text "<b>Mitigation:</b>", inline_format: true
111
+ text fields['Mitigation']
112
+ start_new_page
113
+ end
114
+ end
115
+
116
+ def tool_list
117
+ draw_header
118
+
119
+ text 'TOOLS USED'
120
+ move_down 20
121
+
122
+ data = [
123
+ ['Name', 'Description']
124
+ ]
125
+
126
+ data << ['Dradis Framework', "Collaboration and reporting framework\nhttp://dradisframework.org" ]
127
+
128
+ table data, header: true, position: :center
129
+ end
130
+
131
+ def outline
132
+ outline.define do
133
+ section('Report Content', destination: 2) do
134
+ page title: 'Summary of Findings', destination: 2
135
+ page title: 'Tool List', destination: 3
136
+ end
137
+ end
138
+ end
139
+
140
+ def draw_header
141
+ fill_color 'efefef'
142
+ fill_rectangle [bounds.left-50, bounds.top + 100], bounds.width + 100, 87
143
+ fill_color '00000'
144
+
145
+ box = bounding_box [bounds.left-50, bounds.top+50], :width => (bounds.width + 100) do
146
+
147
+ font "Helvetica"
148
+ text "Security Assessment Report", align: :center
149
+ move_down 20
150
+
151
+ stroke_color 'dadada'
152
+ stroke_horizontal_rule
153
+ stroke_color '000000'
154
+
155
+ end
156
+ move_down 40
157
+ end
158
+
159
+ end
160
+
161
+ class Exporter < Dradis::Plugins::Export::Base
162
+ def export()
163
+ pdf = Processor.new(content_service: content_service)
164
+ pdf.generate
165
+ pdf
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,19 @@
1
+ module Dradis
2
+ module Plugins
3
+ module PdfExport
4
+ # Returns the version of the currently loaded Frontend as a <tt>Gem::Version</tt>
5
+ def self.gem_version
6
+ Gem::Version.new VERSION::STRING
7
+ end
8
+
9
+ module VERSION
10
+ MAJOR = 4
11
+ MINOR = 1
12
+ TINY = 0
13
+ PRE = nil
14
+
15
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'gem_version'
2
+
3
+ module Dradis
4
+ module Plugins
5
+ module PdfExport
6
+ # Returns the version of the currently loaded HtmlExport as a
7
+ # <tt>Gem::Version</tt>.
8
+ def self.version
9
+ gem_version
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ require 'dradis/plugins/pdf_export/engine'
2
+ require 'dradis/plugins/pdf_export/exporter'
3
+ require 'dradis/plugins/pdf_export/version'
4
+
5
+ module Dradis
6
+ module Plugins
7
+ module PdfExport
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ # Hook to the framework base clases
2
+ require 'dradis-plugins'
3
+
4
+ # Load supporting classes
5
+ require 'prawn'
6
+
7
+ # Load this add-on's engine
8
+ require "dradis/plugins/pdf_export"
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dradis-pdf_export
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Martin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dradis-plugins
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: prawn
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.15.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.15.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: capybara
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: database_cleaner
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl_rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.11.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.11.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Export to PDF plugin for the Dradis Framework
126
+ email:
127
+ - "<etd@nomejortu.com>"
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - CHANGELOG.md
134
+ - CHANGELOG.template
135
+ - CONTRIBUTING.md
136
+ - Gemfile
137
+ - LICENSE
138
+ - README.md
139
+ - Rakefile
140
+ - app/assets/images/logo_pdf.jpg
141
+ - app/controllers/dradis/plugins/pdf_export/base_controller.rb
142
+ - config/routes.rb
143
+ - dradis-pdf_export.gemspec
144
+ - lib/dradis-pdf_export.rb
145
+ - lib/dradis/plugins/pdf_export.rb
146
+ - lib/dradis/plugins/pdf_export/engine.rb
147
+ - lib/dradis/plugins/pdf_export/exporter.rb
148
+ - lib/dradis/plugins/pdf_export/gem_version.rb
149
+ - lib/dradis/plugins/pdf_export/version.rb
150
+ homepage: http://dradisframework.org
151
+ licenses:
152
+ - GPL-2
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 1.9.3
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubygems_version: 3.1.6
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: Dradis PDF export plugin
173
+ test_files: []