Skip to content

Commit 4d00608

Browse files
authored
Merge pull request #104 from mitre/asff_mapper
2 parents 88bd047 + 11ee337 commit 4d00608

19 files changed

+2420
-83
lines changed

.github/workflows/build.yml

+12
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,15 @@ jobs:
8686
jq 'del(.version, .platform.release)' scoutsuite_output.json > scoutsuite_output_jq.json
8787
jq 'del(.version, .platform.release)' ./sample_jsons/scoutsuite_mapper/scoutsuite_hdf.json > scoutsuite_sample.json
8888
diff scoutsuite_sample.json scoutsuite_output_jq.json
89+
- name: Test asff mapper
90+
run: |
91+
heimdall_tools asff_mapper -i ./sample_jsons/asff_mapper/sample_input_jsons/asff_sample.json --sh ./sample_jsons/asff_mapper/sample_input_jsons/aws_cis_standard.json -o asff_output.json
92+
jq 'del(.version, .platform.release)' asff_output.json > asff_output_jq.json
93+
jq 'del(.version, .platform.release)' ./sample_jsons/asff_mapper/asff_hdf.json > asff_sample.json
94+
diff asff_sample.json asff_output_jq.json
95+
- name: Test prowler mapper
96+
run: |
97+
heimdall_tools prowler_mapper -i ./sample_jsons/prowler_mapper/sample_input_jsons/prowler_sample.asff-json -o prowler_output.json
98+
jq 'del(.version, .platform.release)' prowler_output.json > prowler_output_jq.json
99+
jq 'del(.version, .platform.release)' ./sample_jsons/prowler_mapper/prowler_hdf.json > prowler_sample.json
100+
diff prowler_sample.json prowler_output_jq.json

.rubocop_todo.yml

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2021-06-07 20:33:06 UTC using RuboCop version 1.16.0.
3+
# on 2021-08-10 22:03:51 UTC using RuboCop version 1.14.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -13,18 +13,13 @@ Gemspec/RequiredRubyVersion:
1313
Exclude:
1414
- 'heimdall_tools.gemspec'
1515

16-
# Offense count: 1
16+
# Offense count: 2
1717
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
1818
Lint/DuplicateBranch:
1919
Exclude:
20+
- 'lib/heimdall_tools/asff_mapper.rb'
2021
- 'lib/heimdall_tools/dbprotect_mapper.rb'
2122

22-
# Offense count: 1
23-
# Configuration parameters: MaximumRangeSize.
24-
Lint/MissingCopEnableDirective:
25-
Exclude:
26-
- 'lib/heimdall_tools/nessus_mapper.rb'
27-
2823
# Offense count: 1
2924
Lint/RequireParentheses:
3025
Exclude:
@@ -37,10 +32,10 @@ Lint/UnusedMethodArgument:
3732
Exclude:
3833
- 'lib/heimdall_tools/hdf.rb'
3934

40-
# Offense count: 37
35+
# Offense count: 50
4136
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
4237
Metrics/AbcSize:
43-
Max: 124
38+
Max: 165
4439

4540
# Offense count: 5
4641
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
@@ -53,17 +48,17 @@ Metrics/BlockLength:
5348
Metrics/BlockNesting:
5449
Max: 5
5550

56-
# Offense count: 9
51+
# Offense count: 10
5752
# Configuration parameters: CountComments, CountAsOne.
5853
Metrics/ClassLength:
5954
Max: 175
6055

61-
# Offense count: 10
56+
# Offense count: 13
6257
# Configuration parameters: IgnoredMethods.
6358
Metrics/CyclomaticComplexity:
64-
Max: 17
59+
Max: 30
6560

66-
# Offense count: 40
61+
# Offense count: 45
6762
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
6863
Metrics/MethodLength:
6964
Max: 56
@@ -73,10 +68,10 @@ Metrics/MethodLength:
7368
Metrics/ParameterLists:
7469
Max: 18
7570

76-
# Offense count: 8
71+
# Offense count: 11
7772
# Configuration parameters: IgnoredMethods.
7873
Metrics/PerceivedComplexity:
79-
Max: 17
74+
Max: 30
8075

8176
# Offense count: 3
8277
Naming/AccessorMethodName:
@@ -98,10 +93,11 @@ Naming/VariableName:
9893
Exclude:
9994
- 'lib/heimdall_tools/burpsuite_mapper.rb'
10095

101-
# Offense count: 12
96+
# Offense count: 15
10297
# Configuration parameters: AllowedVariables.
10398
Style/GlobalVars:
10499
Exclude:
100+
- 'lib/heimdall_tools/asff_mapper.rb'
105101
- 'lib/heimdall_tools/jfrog_xray_mapper.rb'
106102
- 'lib/heimdall_tools/nessus_mapper.rb'
107103
- 'lib/heimdall_tools/nikto_mapper.rb'

README.md

+90-52
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55

66
HeimdallTools supplies several methods to convert output from various tools to "Heimdall Data Format"(HDF) format to be viewable in Heimdall. The current converters are:
77

8-
1. [**aws_config_mapper**](#aws_config_mapper) - assess, audit, and evaluate AWS resources
9-
1. [**burpsuite_mapper**](#burpsuite_mapper) - commercial dynamic analysis tool
10-
1. [**dbprotect_mapper**](#dbprotect_mapper) - database vulnerability scanner
11-
1. [**fortify_mapper**](#fortify_mapper) - commercial static code analysis tool
12-
1. [**jfrog_xray_mapper**](#jfrog_xray_mapper) - package vulnerability scanner
13-
1. [**nessus_mapper**](#nessus_mapper) - commercial security scanner (supports compliance and vulnerability scans from Tenable.sc and Tenable.io)
14-
1. [**netsparker_mapper**](#netsparker_mapper) - web application security scanner
15-
1. [**nikto_mapper**](#nikto_mapper) - open-source web server scanner
16-
1. [**sarif_mapper**](#sarif_mapper) - static analysis results interchange format
8+
1. [**asff_mapper**](#asff_mapper) - custom findings format for AWS Security Hub
9+
1. [**aws_config_mapper**](#aws_config_mapper) - assess, audit, and evaluate AWS resources
10+
1. [**burpsuite_mapper**](#burpsuite_mapper) - commercial dynamic analysis tool
11+
1. [**dbprotect_mapper**](#dbprotect_mapper) - database vulnerability scanner
12+
1. [**fortify_mapper**](#fortify_mapper) - commercial static code analysis tool
13+
1. [**jfrog_xray_mapper**](#jfrog_xray_mapper) - package vulnerability scanner
14+
1. [**nessus_mapper**](#nessus_mapper) - commercial security scanner (supports compliance and vulnerability scans from Tenable.sc and Tenable.io)
15+
1. [**netsparker_mapper**](#netsparker_mapper) - web application security scanner
16+
1. [**nikto_mapper**](#nikto_mapper) - open-source web server scanner
17+
1. [**prowler_mapper**](#prowler_mapper) - assess, audit, harden, and facilitate incidence response for AWS resources
18+
1. [**sarif_mapper**](#sarif_mapper) - static analysis results interchange format
1719
1. [**scoutsuite_mapper**](#scoutsuite_mapper) - multi-cloud security auditing tool
1820
1. [**snyk_mapper**](#snyk_mapper) - commercial package vulnerability scanner
1921
1. [**sonarqube_mapper**](#sonarqube_mapper) - open-source static code analysis tool
2022
1. [**xccdf_results_mapper**](#xccdf_results_mapper) - extensible configuration checklist description results format
21-
1. [*scc_mapper](#xccdf_results_mapper) - scap compliance checker format
23+
1. [**scc_mapper**](#xccdf_results_mapper) - scap compliance checker format
2224
1. [**zap_mapper**](#zap_mapper) - OWASP ZAP - open-source dynamic code analysis tool
2325

2426
## Want to recommend a mapper for another tool? Please use these steps:
@@ -84,6 +86,27 @@ For Docker usage, replace the `heimdall_tools` command with the correct Docker c
8486

8587
Note that all of the above Docker commands will mount your current directory on the Docker container. Ensure that you have navigated to the directory you intend to convert files in before executing the command.
8688

89+
## asff_mapper
90+
91+
asff_mapper translates AWS Security Finding Format results from JSON to HDF-formatted JSON so as to be viewable on Heimdall
92+
93+
Note: The following commands are examples to extract data via the AWS CLI that need to be fed to the mapper:
94+
95+
Output|Use|Command
96+
---|---|---
97+
ASFF json|All the findings that will be fed into the mapper|aws securityhub get-findings > asff.json
98+
AWS SecurityHub enabled standards json|Get all the enabled standards so you can get their identifiers|aws securityhub get-enabled-standards > asff_standards.json
99+
AWS SecurityHub standard controls json|Get all the controls for a standard that will be fed into the mapper|aws securityhub describe-standards-controls --standards-subscription-arn "arn:aws:securityhub:us-east-1:123456789123:subscription/cis-aws-foundations-benchmark/v/1.2.0" > asff_cis_standard.json
100+
101+
USAGE: heimdall_tools asff_mapper -i <asff-finding-json> [--sh <standard-1-json> ... <standard-n-json>] -o <hdf-scan-results-json>
102+
103+
FLAGS:
104+
-i --input -j --json <asff-finding-json> : path to ASFF findings file.
105+
--sh --securityhub-standards --input-securityhub-standards : array of paths to AWS SecurityHub standard files.
106+
-o --output <hdf-scan-results-json> : path to output scan-results json.
107+
108+
example: heimdall_tools asff_mapper -i asff_findings.json --sh aws_standard.json cis_standard.json -o asff_hdf.json
109+
87110
## aws_config_mapper
88111

89112
aws_config_mapper pulls Ruby AWS SDK data to translate AWS Config Rule results into HDF format json to be viewable in Heimdall
@@ -99,8 +122,8 @@ aws_config_mapper pulls Ruby AWS SDK data to translate AWS Config Rule results i
99122
USAGE: heimdall_tools aws_config_mapper [OPTIONS] -o
100123

101124
FLAGS:
102-
-o --output : path to output scan-results json.
103-
-V --verbose : verbose run [optional].
125+
-o --output : path to output scan-results json.
126+
-V --verbose : verbose run [optional].
104127

105128
example: heimdall_tools aws_config_mapper -o aws_config_results_hdf.json
106129

@@ -111,9 +134,9 @@ burpsuite_mapper translates an BurpSuite Pro exported XML results file into HDF
111134
USAGE: heimdall_tools burpsuite_mapper [OPTIONS] -x -o
112135

113136
FLAGS:
114-
-x : path to BurpSuitePro exported XML results file.
115-
-o --output : path to output scan-results json.
116-
-V --verbose : verbose run [optional].
137+
-x : path to BurpSuitePro exported XML results file.
138+
-o --output : path to output scan-results json.
139+
-V --verbose : verbose run [optional].
117140

118141
example: heimdall_tools burpsuite_mapper -x burpsuite_results.xml -o scan_results.json
119142

@@ -124,9 +147,9 @@ dbprotect_mapper translates DBProtect report in `Check Results Details` format X
124147
USAGE: heimdall_tools dbprotect_mapper [OPTIONS] -x -o
125148

126149
FLAGS:
127-
-x : path to DBProtect report XML file.
128-
-o --output : path to output scan-results json.
129-
-V --verbose : verbose run [optional].
150+
-x : path to DBProtect report XML file.
151+
-o --output : path to output scan-results json.
152+
-V --verbose : verbose run [optional].
130153

131154
example: heimdall_tools dbprotect_mapper -x check_results_details_report.xml -o db_protect_hdf.json
132155

@@ -137,9 +160,9 @@ fortify_mapper translates an Fortify results FVDL file into HDF format json to b
137160
USAGE: heimdall_tools fortify_mapper [OPTIONS] -f -o
138161

139162
FLAGS:
140-
-f --fvdl : path to Fortify Scan FVDL file.
141-
-o --output : path to output scan-results json.
142-
-V --verbose : verbose run [optional].
163+
-f --fvdl : path to Fortify Scan FVDL file.
164+
-o --output : path to output scan-results json.
165+
-V --verbose : verbose run [optional].
143166

144167
example: heimdall_tools fortify_mapper -f audit.fvdl -o scan_results.json
145168

@@ -150,9 +173,9 @@ jfrog_xray_mapper translates an JFrog Xray results JSON file into HDF format JSO
150173
USAGE: heimdall_tools jfrog_xray_mapper [OPTIONS] -j -o
151174

152175
FLAGS:
153-
-j : path to xray results JSON file.
154-
-o --output : path to output scan-results json.
155-
-V --verbose : verbose run [optional].
176+
-j : path to xray results JSON file.
177+
-o --output : path to output scan-results json.
178+
-V --verbose : verbose run [optional].
156179

157180
example: heimdall_tools jfrog_xray_mapper -j xray_results.json -o xray_results_hdf.json
158181

@@ -166,9 +189,9 @@ Note: A separate HDF JSON file is generated for each host reported in the Nessus
166189
USAGE: heimdall_tools nessus_mapper [OPTIONS] -x -o
167190

168191
FLAGS:
169-
-x : path to Nessus-exported XML results file.
170-
-o --output_prefix : path to output scan-results json.
171-
-V --verbose : verbose run [optional].
192+
-x : path to Nessus-exported XML results file.
193+
-o --output_prefix : path to output scan-results json.
194+
-V --verbose : verbose run [optional].
172195

173196
example: heimdall_tools nessus_mapper -x nessus-results.xml -o test-env
174197

@@ -181,9 +204,9 @@ The current iteration only works with Netsparker Enterprise Vulnerabilities Scan
181204
USAGE: heimdall_tools netsparker_mapper [OPTIONS] -x -o
182205

183206
FLAGS:
184-
-x : path to netsparker results XML file.
185-
-o --output : path to output scan-results json.
186-
-V --verbose : verbose run [optional].
207+
-x : path to netsparker results XML file.
208+
-o --output : path to output scan-results json.
209+
-V --verbose : verbose run [optional].
187210

188211
example: heimdall_tools netsparker_mapper -x netsparker_results.xml -o netsparker_hdf.json
189212

@@ -196,22 +219,36 @@ Note: Current this mapper only support single target Nikto Scans.
196219
USAGE: heimdall_tools nikto_mapper [OPTIONS] -x -o
197220

198221
FLAGS:
199-
-j : path to Nikto results JSON file.
200-
-o --output_prefix : path to output scan-results json.
201-
-V --verbose : verbose run [optional].
222+
-j : path to Nikto results JSON file.
223+
-o --output_prefix : path to output scan-results json.
224+
-V --verbose : verbose run [optional].
202225

203226
example: heimdall_tools nikto_mapper -j nikto_results.json -o nikto_results.json
204227

228+
## prowler_mapper
229+
230+
prowler_mapper translates Prowler-derived AWS Security Finding Format results from concatenated JSON blobs to HDF-formatted JSON so as to be viewable on Heimdall
231+
232+
Note: Currently this mapper only supports Prowler's ASFF output format.
233+
234+
USAGE: heimdall_tools prowler_mapper -i <prowler-asff-json> -o <hdf-scan-results-json>
235+
236+
FLAGS:
237+
-i --input -j --json <prowler-asff-json> : path to Prowler ASFF findings file.
238+
-o --output <hdf-scan-results-json> : path to output scan-results json.
239+
240+
example: heimdall_tools prowler_mapper -i prowler_results.js -o prowler_hdf.json
241+
205242
## sarif_mapper
206243

207244
sarif_mapper translates a SARIF JSON file into HDF format JSON to be viewable in Heimdall
208245

209246
USAGE: heimdall_tools sarif_mapper [OPTIONS] -j -o
210247

211248
FLAGS:
212-
-j : path to SARIF results JSON file.
213-
-o --output_prefix : path to output scan-results json.
214-
-V --verbose : verbose run [optional].
249+
-j : path to SARIF results JSON file.
250+
-o --output_prefix : path to output scan-results json.
251+
-V --verbose : verbose run [optional].
215252

216253
example: heimdall_tools sarif_mapper -j sarif_results.json -o sarif_results_hdf.json
217254

@@ -224,8 +261,8 @@ Note: Currently this mapper only supports AWS.
224261
USAGE: heimdall_tools scoutsuite_mapper -i -o
225262

226263
FLAGS:
227-
-i --input -j --javascript : path to Scout Suite results Javascript file.
228-
-o --output : path to output scan-results json.
264+
-i --input -j --javascript : path to Scout Suite results Javascript file.
265+
-o --output : path to output scan-results json.
229266

230267
example: heimdall_tools scoutsuite_mapper -i scoutsuite_results.js -o scoutsuite_hdf.json
231268

@@ -238,9 +275,9 @@ Note: A separate HDF JSON is generated for each project reported in the Snyk Rep
238275
USAGE: heimdall_tools snyk_mapper [OPTIONS] -x -o
239276

240277
FLAGS:
241-
-j : path to Snyk results JSON file.
242-
-o --output_prefix : path to output scan-results json.
243-
-V --verbose : verbose run [optional].
278+
-j : path to Snyk results JSON file.
279+
-o --output_prefix : path to output scan-results json.
280+
-V --verbose : verbose run [optional].
244281

245282
example: heimdall_tools snyk_mapper -j snyk_results.json -o output-file-prefix
246283

@@ -251,11 +288,11 @@ sonarqube_mapper pulls SonarQube results, for the specified project, from the AP
251288
USAGE: heimdall_tools sonarqube_mapper [OPTIONS] -n -u -o
252289

253290
FLAGS:
254-
-n --name : Project Key of the project in SonarQube
255-
-u --api_url : url of the SonarQube Server API. Typically ends with /api.
256-
--auth : username:password or token [optional].
257-
-o --output : path to output scan-results json.
258-
-V --verbose : verbose run [optional].
291+
-n --name : Project Key of the project in SonarQube
292+
-u --api_url : url of the SonarQube Server API. Typically ends with /api.
293+
--auth : username:password or token [optional].
294+
-o --output : path to output scan-results json.
295+
-V --verbose : verbose run [optional].
259296

260297
example:
261298

@@ -272,8 +309,8 @@ xccdf_results_mapper translates an XCCDF_Results XML scan into HDF format json t
272309
USAGE: heimdall_tools xccdf_results_mapper [OPTIONS] -x -o
273310

274311
FLAGS:
275-
-x : path to XCCDF-Results XML file.
276-
-o --output : path to output scan-results json.
312+
-x : path to XCCDF-Results XML file.
313+
-o --output : path to output scan-results json.
277314

278315
example: heimdall_tools xccdf_results_mapper -x xccdf_results.xml -o scan_results.json
279316

@@ -284,10 +321,10 @@ zap_mapper translates OWASP ZAP results Json to HDF format Json be viewed on Hei
284321
USAGE: heimdall_tools zap_mapper [OPTIONS] -j -n -o
285322

286323
FLAGS:
287-
-j --json : path to OWASP ZAP results JSON file.
288-
-n --name : URL of the site being evaluated.
289-
-o --output : path to output scan-results json.
290-
-V --verbose : verbose run [optional].
324+
-j --json : path to OWASP ZAP results JSON file.
325+
-n --name : URL of the site being evaluated.
326+
-o --output : path to output scan-results json.
327+
-V --verbose : verbose run [optional].
291328

292329
example: heimdall_tools zap_mapper -j zap_results.json -n site_name -o scan_results.json
293330

@@ -355,6 +392,7 @@ To release a new version, update the version number in `version.rb` according to
355392

356393
### Authors
357394

395+
- Author:: Amndeep Singh Mann [Amndeep7](https://github.com/Amndeep7)
358396
- Author:: Rony Xavier [rx294](https://github.com/rx294)
359397
- Author:: Dan Mirsky [mirskiy](https://github.com/mirskiy)
360398

heimdall_tools.gemspec

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Gem::Specification.new do |spec|
1515
rescue StandardError
1616
'0.0.0.1.ENOGVB'
1717
end
18-
spec.authors = ['Robert Thew', 'Rony Xavier', 'Aaron Lippold']
18+
spec.authors = ['Robert Thew', 'Rony Xavier', 'Amndeep Singh Mann', 'Aaron Lippold']
1919
spec.email = ['[email protected]']
20-
spec.summary = 'Convert Forify, Openzap and Sonarqube results to HDF'
20+
spec.summary = 'Convert a variety of security product results to HDF'
2121
spec.description = 'Converter utils that can be included as a gem or used from the command line'
2222
spec.homepage = 'https://github.com/mitre/heimdall_tools'
2323
spec.license = 'Apache-2.0'
@@ -29,8 +29,10 @@ Gem::Specification.new do |spec|
2929
spec.require_paths = ['lib']
3030

3131
spec.add_runtime_dependency 'aws-sdk-configservice', '~> 1'
32+
spec.add_runtime_dependency 'aws-sdk-securityhub', '~> 1'
3233
spec.add_runtime_dependency 'csv', '~> 3.1'
3334
spec.add_runtime_dependency 'git-lite-version-bump', '>= 0.17.2'
35+
spec.add_runtime_dependency 'htmlentities', '~> 4.3.4'
3436
spec.add_runtime_dependency 'httparty', '~> 0.18.0'
3537
spec.add_runtime_dependency 'json', '~> 2.3'
3638
spec.add_runtime_dependency 'nokogiri', '~> 1.11'

0 commit comments

Comments
 (0)