mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
CyBOK
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,11 @@
|
||||
require 'erb'
|
||||
require 'nori'
|
||||
require 'youtube_images'
|
||||
# if you want to regenerate the indexes you need to install this additional gem:
|
||||
# gem 'youtube_images'
|
||||
require 'dig-deep'
|
||||
|
||||
# if you want to regenerate the indexes you need to install these additional gems:
|
||||
# gem 'youtube_images'
|
||||
# gem 'dig-deep'
|
||||
|
||||
require_relative '../helpers/print.rb'
|
||||
require_relative '../helpers/constants.rb'
|
||||
@@ -24,6 +26,8 @@ end
|
||||
|
||||
KA_TOPIC_SCENARIOS_HASH = Hash.new { |h, k| h[k] = h.dup.clear }
|
||||
SCENARIOS_HASH = {}
|
||||
SCENARIOS_FULL_HASH = {}
|
||||
|
||||
KA_TOPIC_VIDEO_HASH = Hash.new { |h, k| h[k] = h.dup.clear }
|
||||
VIDEO_HASH = {}
|
||||
parser = Nori.new()
|
||||
@@ -32,6 +36,7 @@ scenarios.each { |scenario|
|
||||
|
||||
scenario_hash = parser.parse(File.read("#{scenarios_dir}/#{scenario}"))
|
||||
if scenario_hash && scenario_hash['scenario']
|
||||
(SCENARIOS_FULL_HASH[scenario] ||= []) << scenario_hash['scenario']
|
||||
if (scenario_hash['scenario']['CyBOK'].kind_of?(Array))
|
||||
scenario_hash['scenario']['CyBOK'].each {|cybok_entry|
|
||||
ka = cybok_entry['@KA']
|
||||
@@ -40,7 +45,6 @@ scenarios.each { |scenario|
|
||||
(@ka_topic_hash["#{ka} #{topic}"] ||= []) << scenario
|
||||
KA_TOPIC_SCENARIOS_HASH[ka][topic][scenario] = "-"
|
||||
(SCENARIOS_HASH[scenario] ||= []) << cybok_entry
|
||||
|
||||
}
|
||||
elsif (scenario_hash['scenario']['CyBOK'])
|
||||
# KA_HASH[scenario] << scenario
|
||||
|
||||
@@ -40,11 +40,34 @@ KA_TOPIC_SCENARIOS_HASH.each{|ka,hash|
|
||||
SCENARIOS_HASH.each{|scenario,array|
|
||||
%>
|
||||
## <%= scenario %>
|
||||
|
||||
### Details
|
||||
|
||||
| Key | Data |
|
||||
| --- | --- |
|
||||
|Name | <%= SCENARIOS_FULL_HASH[scenario][0]["name"].to_s %> |
|
||||
|Description | <%= SCENARIOS_FULL_HASH[scenario][0]["description"].to_s.delete('#').gsub(/\n/,'</br>') %>|
|
||||
|Type | <%= SCENARIOS_FULL_HASH[scenario][0]["type"].to_s.gsub(/"|\[|\]/, '').gsub(',',';') %> |
|
||||
|Author | <%= SCENARIOS_FULL_HASH[scenario][0]["author"].to_s %> |
|
||||
|Linked videos| <%= SCENARIOS_FULL_HASH[scenario][0].dig_deep(:url).to_s.gsub(/"|\[|\]/, '').gsub(',',';') %>|
|
||||
|VM names| <%=
|
||||
systems = SCENARIOS_FULL_HASH[scenario][0].dig_deep(:system_name).to_s.gsub(/"|\[|\]/, '').gsub(',',';') %> |
|
||||
|
||||
|
||||
|
||||
### CyBOK KAs, Topics, and Keywords
|
||||
| KA | Topic | Keywords
|
||||
| --- | --- | --- |
|
||||
<%array.each{|arr| -%>
|
||||
| <%= arr["@KA"] %> | <%= arr["@topic"] %> | <%= arr["keyword"].to_s.gsub(/"|\[|\]/, '').gsub(',',';') %> |<%
|
||||
} %>
|
||||
|
||||
|
||||
Command to start scenario:
|
||||
|
||||
```ruby secgen.rb -s scenario/<%= scenario %> run```
|
||||
|
||||
[View source](scenarios/<%= scenario %>)
|
||||
|
||||
<%
|
||||
} %>
|
||||
|
||||
Reference in New Issue
Block a user