active_stix 0.1.21 → 0.1.22

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/active_stix/application.js +1 -0
  3. data/app/assets/stylesheets/active_stix/application.scss +3 -0
  4. data/app/controllers/active_stix/attack_patterns_controller.rb +2 -1
  5. data/app/controllers/active_stix/campaigns_controller.rb +7 -1
  6. data/app/helpers/active_stix/attack_patterns_helper.rb +17 -0
  7. data/app/models/active_stix/threat_actor.rb +8 -0
  8. data/app/views/active_stix/attack_patterns/show.html.erb +105 -122
  9. data/app/views/active_stix/campaigns/_form.html.erb +39 -19
  10. data/app/views/active_stix/campaigns/edit.html.erb +1 -4
  11. data/app/views/active_stix/campaigns/new.html.erb +1 -2
  12. data/app/views/active_stix/campaigns/show.html.erb +0 -3
  13. data/app/views/active_stix/email_messages/show.html.erb +2 -2
  14. data/app/views/active_stix/threat_actors/show.html.erb +49 -4
  15. data/app/views/layouts/active_stix/application.html.erb +0 -2
  16. data/config/routes.rb +3 -2
  17. data/lib/active_stix/engine.rb +2 -0
  18. data/lib/active_stix/version.rb +1 -1
  19. metadata +17 -33
  20. data/app/assets/stylesheets/active_stix/application.css +0 -15
  21. data/app/assets/stylesheets/active_stix/artifacts.css +0 -4
  22. data/app/assets/stylesheets/active_stix/attack_patterns.css +0 -4
  23. data/app/assets/stylesheets/active_stix/bcc_refs.css +0 -4
  24. data/app/assets/stylesheets/active_stix/bundled_objects.css +0 -4
  25. data/app/assets/stylesheets/active_stix/bundles.css +0 -4
  26. data/app/assets/stylesheets/active_stix/campaigns.css +0 -4
  27. data/app/assets/stylesheets/active_stix/course_of_actions.css +0 -4
  28. data/app/assets/stylesheets/active_stix/cyber_observables.css +0 -4
  29. data/app/assets/stylesheets/active_stix/email_messages.css +0 -4
  30. data/app/assets/stylesheets/active_stix/external_references.css +0 -4
  31. data/app/assets/stylesheets/active_stix/files.css +0 -4
  32. data/app/assets/stylesheets/active_stix/identities.css +0 -4
  33. data/app/assets/stylesheets/active_stix/indicator_labels.css +0 -4
  34. data/app/assets/stylesheets/active_stix/indicators.css +0 -4
  35. data/app/assets/stylesheets/active_stix/intrusion_sets.css +0 -4
  36. data/app/assets/stylesheets/active_stix/kill_chain_phases.css +0 -4
  37. data/app/assets/stylesheets/active_stix/kill_chains.css +0 -4
  38. data/app/assets/stylesheets/active_stix/malwares.css +0 -4
  39. data/app/assets/stylesheets/active_stix/marking_definitions.css +0 -4
  40. data/app/assets/stylesheets/active_stix/observed_data.css +0 -4
  41. data/app/assets/stylesheets/active_stix/open_vocabularies.css +0 -4
  42. data/app/assets/stylesheets/active_stix/phases.css +0 -4
  43. data/app/assets/stylesheets/active_stix/recipients.css +0 -4
  44. data/app/assets/stylesheets/active_stix/relationships.css +0 -4
  45. data/app/assets/stylesheets/active_stix/reports.css +0 -4
  46. data/app/assets/stylesheets/active_stix/threat_actors.css +0 -4
  47. data/app/assets/stylesheets/active_stix/tools.css +0 -4
  48. data/app/assets/stylesheets/active_stix/urls.css +0 -4
  49. data/app/assets/stylesheets/active_stix/users.css +0 -4
  50. data/app/assets/stylesheets/scaffold.css +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a290e6e3484bb7a5d41b37ecfe3318dc8e060e2923b71cd645c49f43260a79d1
4
- data.tar.gz: 71455f220d20bd56839b4f417185e73a723a4205ed07429144b604672d19685a
3
+ metadata.gz: 1afeaea40eb5ee5e0ef0106e50c42a85e839b0cea193317fcc95ef55b0626f57
4
+ data.tar.gz: 1dd3682d8dad6ee976fb984cc1e59a652dba0902a4fa2c34ca44b0b21d5f0307
5
5
  SHA512:
6
- metadata.gz: 9f122f3e499505a0e97685c45df0dad8177a378d53f8debc2b682a109db7b34973647a1cba56cd2a242b253948acd5b87c5b006f8566e2b72f1d384429816b06
7
- data.tar.gz: 4957b544a6d76c0c01a72afd15393fcd7fae11d10dd3da0b294d683aa6421afe057af09d1d893ead20b1ad908c357ce60b9befa231ba3ce19b0967b73bedaf08
6
+ metadata.gz: d8ab3c50687d87fd208a81dd7451fbde39f8d731d3adb763177697f7ba4a3587481130f5280c3c0efa19fe108f021c4f2b7dc0b8d4e882fda69f55b6eb6824c1
7
+ data.tar.gz: 91f7d641b997b5bfdd4e97b204f97fd84b12f7706ef8b35a6d2fa54bc0ff37c946b10dc2de65939bfacad2a2b1e1c4777f0c6b7a8f1786c390ce6840d34e69a7
@@ -13,3 +13,4 @@
13
13
  //= require rails-ujs
14
14
  //= require activestorage
15
15
  //= require_tree .
16
+
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require bootstrap-datepicker
3
+ */
@@ -1,5 +1,6 @@
1
1
  class ActiveStix::AttackPatternsController < ApplicationController
2
2
  before_action :set_attack_pattern, only: [:show, :edit, :update, :destroy, :data]
3
+
3
4
  def index
4
5
  end
5
6
 
@@ -10,10 +11,10 @@ class ActiveStix::AttackPatternsController < ApplicationController
10
11
  end
11
12
 
12
13
  def show
13
- #@attack_pattern = ActiveStix::AttackPattern.find(params[:id])
14
14
  end
15
15
 
16
16
  private
17
+
17
18
  # Use callbacks to share common setup or constraints between actions.
18
19
  def set_attack_pattern
19
20
  @attack_pattern = ActiveStix::AttackPattern.find(params[:id])
@@ -1,5 +1,6 @@
1
1
  class ActiveStix::CampaignsController < ApplicationController
2
2
  before_action :set_stix_campaign, only: [:show, :edit, :update, :destroy]
3
+ before_action :set_threat_actor
3
4
 
4
5
  # GET /stix/campaigns
5
6
  # GET /stix/campaigns.json
@@ -28,7 +29,8 @@ class ActiveStix::CampaignsController < ApplicationController
28
29
 
29
30
  respond_to do |format|
30
31
  if @campaign.save
31
- format.html { redirect_to @campaign, notice: 'Campaign was successfully created.' }
32
+ ActiveStix::Relationship.relate(@campaign, @threat_actor, "attributed-to")
33
+ format.html { redirect_to [@threat_actor, @campaign], notice: 'Campaign was successfully created.' }
32
34
  format.json { render :show, status: :created, location: @campaign }
33
35
  else
34
36
  format.html { render :new }
@@ -67,6 +69,10 @@ class ActiveStix::CampaignsController < ApplicationController
67
69
  @campaign = ActiveStix::Campaign.find(params[:id])
68
70
  end
69
71
 
72
+ def set_threat_actor
73
+ @threat_actor = ActiveStix::ThreatActor.find(params[:threat_actor_id])
74
+ end
75
+
70
76
  # Never trust parameters from the scary internet, only allow the white list through.
71
77
  def stix_campaign_params
72
78
  params.require(:campaign).permit(:name, :description, :first_seen, :last_seen, :objective)
@@ -1,4 +1,21 @@
1
1
  module ActiveStix
2
2
  module AttackPatternsHelper
3
+
4
+ def mitigation_description
5
+ mitigation = @attack_pattern.target_relationships.where("relationship_type='mitigates'").first
6
+ return unless mitigation
7
+ source = mitigation.source
8
+ return unless source
9
+ description = source.description
10
+ markdown.render(description).html_safe if description
11
+ end
12
+
13
+ def detection_description
14
+ # detection = @attack_pattern.detections.first.description
15
+ # return unless detection
16
+ # description = detection.description || ""
17
+ # markdown.render(description).html_safe
18
+ ""
19
+ end
3
20
  end
4
21
  end
@@ -28,6 +28,14 @@ class ActiveStix::ThreatActor < ApplicationRecord
28
28
  intrusion_sets
29
29
  end
30
30
 
31
+ def malwares
32
+ m = []
33
+ ActiveStix::Relationship.where(target: self, relationship_type: "attributed-to", source_type: "ActiveStix::Malware").each do |rel|
34
+ intrusion_sets << rel.source
35
+ end
36
+ intrusion_sets
37
+ end
38
+
31
39
  def self.find_or_create_attribution(organization)
32
40
  threat_actor = organization.threat_groups.first
33
41
  if threat_actor.nil?
@@ -1,140 +1,123 @@
1
- <p id="notice"><%= notice %></p>
1
+ <div class="container-fluid">
2
+ <% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, fenced_code_blocks: true) %>
2
3
 
3
- <% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, fenced_code_blocks: true) %>
4
-
5
- <% if @attack_pattern.external_references.collect {|x| x.source_name }.include?("mitre-attack") %>
6
- <div>
7
- <div style="max-width:70%; margin-left:2%;color:black">
8
- <h2><%= @attack_pattern.name %></h2>
9
- <br>
10
- <strong style="color:black">Description:</strong>
11
- <br>
12
- <div style="margin-left:1%;color:black">
13
- <%= markdown.render(@attack_pattern.description).html_safe %>
14
- </div>
15
- <br>
16
- <br>
17
-
18
- <strong style="color:black">Examples</strong>
19
- <br>
20
- <table style="margin-left:1%;border:1px solid black;color:black">
21
- <tr bgcolor="#F0F0F0">
22
- <th style="border:1px solid black">Name</th>
23
- <th style="border:1px solid black">Description</th>
24
- </tr>
4
+ <% if @attack_pattern.external_references.collect {|x| x.source_name}.include?("mitre-attack") %>
5
+ <div>
6
+ <div>
7
+ <h2><%= @attack_pattern.name %></h2>
8
+ <br>
9
+ <strong>Description:</strong>
10
+ <br>
11
+ <div>
12
+ <%= markdown.render(@attack_pattern.description).html_safe %>
13
+ </div>
14
+ <br>
15
+ <br>
25
16
 
26
- <% @attack_pattern.target_relationships.where("relationship_type = 'uses'").each do | rel | %>
27
- <!-- make sure stix tools objects aren't included in the list -->
28
- <% next if rel.source.name.include?("--") %>
17
+ <strong>Examples</strong>
18
+ <br>
19
+ <table>
29
20
  <tr>
30
- <td style="border:1px solid black;color:black"> <%= rel.source.name %> </td>
31
- <td style="border:1px solid black;color:black"> <%= markdown.render(rel.description).html_safe %></td>
21
+ <th>Name</th>
22
+ <th>Description</th>
32
23
  </tr>
33
- <% end %>
34
- </table>
35
- <br>
36
- <br>
37
-
38
- <strong style="color:black">Mitigation:</strong>
39
- <br>
40
- <div style="margin-left:1%;color:black">
41
- <%= markdown.render(@attack_pattern.target_relationships.where("relationship_type='mitigates'").first.source.description).html_safe %>
42
- </div>
43
- <br>
44
- <br>
45
24
 
25
+ <% @attack_pattern.target_relationships.where("relationship_type = 'uses'").each do |rel| %>
26
+ <!-- make sure stix tools objects aren't included in the list -->
27
+ <% next if rel.source.name.include?("--") %>
28
+ <tr>
29
+ <td> <%= rel.source.name %> </td>
30
+ <td> <%= markdown.render(rel.description).html_safe if rel.description %></td>
31
+ </tr>
32
+ <% end %>
33
+ </table>
34
+ <br>
35
+ <br>
46
36
 
47
- <strong style="color:black">Detection:</strong>
48
- <br>
49
- <div style="margin-left:1%;color:black">
50
- <%= markdown.render(@attack_pattern.detections.first.description).html_safe %>
51
- </div>
52
- <br>
53
- <br>
37
+ <strong>Mitigation:</strong>
38
+ <br>
39
+ <div>
40
+ <%= mitigation_description %>
41
+ </div>
42
+ <br>
43
+ <br>
54
44
 
55
- <div style="position:absolute;top:150px;right:100px;width:300px;height:400px;border:1px solid black;padding:10px;color:black">
56
- <strong>ID:</strong>
57
- <%= @attack_pattern.external_references.find_by("source_name = 'mitre-attack'").external_id %>
58
- <br>
59
- <Strong>Tactic:</Strong>
60
- <%= @attack_pattern.phases.first.name %>
61
- <br>
62
- <Strong>Platform:</Strong>
63
- <% platform_array = [] %>
64
- <% @attack_pattern.platforms.each do | plat | %>
65
- <% platform_array << plat.platform %>
66
- <% end %>
67
- <%= platform_array.join(", ") %>
68
45
 
46
+ <strong>Detection:</strong>
47
+ <br>
48
+ <div>
49
+ <%= detection_description %>
50
+ </div>
51
+ <br>
69
52
  <br>
70
- <Strong>Permissions Required:</Strong>
71
- <% perm_array = [] %>
72
- <% @attack_pattern.permissions_requireds.each do | perm | %>
73
- <% perm_array << perm.permission %>
74
- <% end %>
75
- <%= perm_array.join(", ") %>
76
- <br>
77
- <Strong>Data Sources:</Strong>
78
- <% src_array = [] %>
79
- <% platform_array = [] %>
80
- <% @attack_pattern.data_sources.each do | src | %>
81
- <% src_array << src.source %>
82
- <% end %>
83
- <%= src_array.join(", ") %>
84
- <br>
85
- <Strong>Version:</Strong>
86
- <%= @attack_pattern.versions.first.version %>
87
53
 
54
+ <div>
55
+ <strong>ID:</strong>
56
+ <%= @attack_pattern.external_references.find_by("source_name = 'mitre-attack'").external_id %>
57
+ <br>
58
+ <Strong>Tactic:</Strong>
59
+ <%= @attack_pattern.phases.first.name %>
60
+ <br>
61
+ <Strong>Platform:</Strong>
62
+
63
+ <br>
64
+ <Strong>Permissions Required:</Strong>
65
+ <br>
66
+ <Strong>Data Sources:</Strong>
67
+
68
+ </div>
88
69
  </div>
89
70
  </div>
90
- </div>
91
- <% elsif @attack_pattern.external_references.collect {|x| x.source_name }.include?("mitre-pre-attack") %>
92
- <div>
93
- <div style="max-width:70%; margin-left:2%;color:black">
94
- <h2><%= @attack_pattern.name %></h2>
95
- <br>
96
- <strong style="color:black">Description:</strong>
97
- <br>
98
- <div style="margin-left:1%;color:black">
99
- <%= markdown.render(@attack_pattern.description).html_safe %>
100
- </div>
101
- <br>
102
- <strong style="color:black">Detection:</strong>
103
- <br>
104
- <div style="margin-left:1%;">
105
- <strong>Detectable by Common Defenses (Yes/No/Partial):</strong> <%= @attack_pattern.detectable_by_common_defenses.first.detectable %>
106
- </div>
107
-
108
- <br>
109
- <div style="margin-left:1%">
110
- <strong>Explanation:</strong> <%= @attack_pattern.detectable_by_common_defenses_explanations.first.explanation %>
111
- </div>
112
-
113
- <br>
114
- <strong>Difficulty for the Adversary:</strong>
115
- <div style="margin-left:1%;">
116
- <strong>Easy for the Adversary (Yes/No):</strong> <%= @attack_pattern.difficulty_for_adversaries.first.difficulty %>
117
- </div>
118
-
119
- <br>
120
- <div style="margin-left:1%">
121
- <strong>Explanation:</strong> <%= @attack_pattern.difficulty_for_adversary_explanations.first.explanation %>
122
- </div>
71
+ <% elsif @attack_pattern.external_references.collect {|x| x.source_name}.include?("mitre-pre-attack") %>
72
+ <div>
73
+ <div>
74
+ <h2><%= @attack_pattern.name %></h2>
75
+ <br>
76
+ <strong>Description:</strong>
77
+ <br>
78
+ <div>
79
+ <%= markdown.render(@attack_pattern.description).html_safe %>
80
+ </div>
81
+ <br>
82
+ <strong>Detection:</strong>
83
+ <br>
84
+ <div>
85
+ <strong>Detectable by Common Defenses
86
+ (Yes/No/Partial):</strong> <%= @attack_pattern.detectable_by_common_defenses.first.detectable %>
87
+ </div>
123
88
 
124
- <div style="position:absolute;top:150px;right:100px;width:300px;height:300px;border:1px solid black;padding:10px;color:black">
125
- <strong>ID:</strong>
126
- <%= @attack_pattern.external_references.find_by("source_name = 'mitre-pre-attack'").external_id %>
127
89
  <br>
128
- <Strong>Tactic:</Strong>
129
- <%= @attack_pattern.phases.first.name %>
90
+ <div>
91
+ <strong>Explanation:</strong> <%= @attack_pattern.detectable_by_common_defenses_explanations.first.explanation %>
92
+ </div>
93
+
130
94
  <br>
131
- <Strong>Version:</Strong>
132
- <%= @attack_pattern.versions.first.version %>
95
+ <strong>Difficulty for the Adversary:</strong>
96
+ <div>
97
+ <strong>Easy for the Adversary
98
+ (Yes/No):</strong> <%= @attack_pattern.difficulty_for_adversaries.first.difficulty %>
99
+ </div>
133
100
 
101
+ <br>
102
+ <div>
103
+ <strong>Explanation:</strong> <%= @attack_pattern.difficulty_for_adversary_explanations.first.explanation %>
104
+ </div>
105
+
106
+ <div>
107
+ <strong>ID:</strong>
108
+ <%= @attack_pattern.external_references.find_by("source_name = 'mitre-pre-attack'").external_id %>
109
+ <br>
110
+ <Strong>Tactic:</Strong>
111
+ <%= @attack_pattern.phases.first.name %>
112
+ <br>
113
+ <Strong>Version:</Strong>
114
+ <%= @attack_pattern.versions.first.version %>
115
+
116
+ </div>
134
117
  </div>
135
- </div>
136
118
 
137
- </div>
138
- <% else %>
139
- <%= "Error" %>
140
- <% end %>
119
+ </div>
120
+ <% else %>
121
+ <%= "Error" %>
122
+ <% end %>
123
+ </div>
@@ -1,39 +1,59 @@
1
- <%= form_with(model: campaign, local: true) do |form| %>
1
+ <%= form_with(model: campaign, url: stix.threat_actor_campaigns_path(threat_actor, campaign), local: true) do |form| %>
2
2
  <% if campaign.errors.any? %>
3
3
  <div id="error_explanation">
4
4
  <h2><%= pluralize(campaign.errors.count, "error") %> prohibited this campaign from being saved:</h2>
5
5
 
6
6
  <ul>
7
- <% campaign.errors.full_messages.each do |message| %>
8
- <li><%= message %></li>
9
- <% end %>
7
+ <% campaign.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
10
  </ul>
11
11
  </div>
12
12
  <% end %>
13
13
 
14
- <div class="field">
15
- <%= form.label :name %>
16
- <%= form.text_field :name %>
14
+ <div class="form-group row">
15
+ <div class="field">
16
+ <%= form.label :name, class: "col-sm-2 col-form-label" %>
17
+ <div class="col-sm-10">
18
+ <%= form.text_field :name, class: "form-control" %>
19
+ </div>
20
+ </div>
17
21
  </div>
18
22
 
19
- <div class="field">
20
- <%= form.label :description %>
21
- <%= form.text_field :description %>
23
+ <div class="form-group row">
24
+ <div class="field">
25
+ <%= form.label :description, class: "col-sm-2 col-form-label" %>
26
+ <div class="col-sm-10">
27
+ <%= form.text_field :description, class: "form-control" %>
28
+ </div>
29
+ </div>
22
30
  </div>
23
31
 
24
- <div class="field">
25
- <%= form.label :first_seen %>
26
- <%= form.text_field :first_seen %>
32
+ <div class="form-group row">
33
+ <div class="field">
34
+ <%= form.label :first_seen, class: "col-sm-2 col-form-label" %>
35
+ <div class="col-sm-10">
36
+ <%= form.text_field :first_seen, "data-provide" => 'datepicker' %>
37
+ </div>
38
+ </div>
27
39
  </div>
28
40
 
29
- <div class="field">
30
- <%= form.label :last_seen %>
31
- <%= form.text_field :last_seen %>
41
+ <div class="form-group row">
42
+ <div class="field">
43
+ <%= form.label :last_seen, class: "col-sm-2 col-form-label" %>
44
+ <div class="col-sm-10">
45
+ <%= form.text_field :last_seen, "data-provide" => 'datepicker' %>
46
+ </div>
47
+ </div>
32
48
  </div>
33
49
 
34
- <div class="field">
35
- <%= form.label :objective %>
36
- <%= form.text_field :objective %>
50
+ <div class="form-group row">
51
+ <div class="field">
52
+ <%= form.label :objective, class: "col-sm-2 col-form-label" %>
53
+ <div class="col-sm-10">
54
+ <%= form.text_field :objective, class: "form-control" %>
55
+ </div>
56
+ </div>
37
57
  </div>
38
58
 
39
59
  <div class="actions">
@@ -1,6 +1,3 @@
1
1
  <h1>Editing Stix Campaign</h1>
2
2
 
3
- <%= render 'form', campaign: @campaign %>
4
-
5
- <%= link_to 'Show', @campaign %> |
6
- <%= link_to 'Back', campaigns_path %>
3
+ <%= render 'form', threat_actor: @threat_actor, campaign: @campaign %>
@@ -1,5 +1,4 @@
1
1
  <h1>New Stix Campaign</h1>
2
2
 
3
- <%= render 'form', campaign: @campaign %>
3
+ <%= render 'form', threat_actor: @threat_actor, campaign: @campaign %>
4
4
 
5
- <%= link_to 'Back', campaigns_path %>
@@ -24,6 +24,3 @@
24
24
  <strong>Objective:</strong>
25
25
  <%= @campaign.objective %>
26
26
  </p>
27
-
28
- <%= link_to 'Edit', edit_campaign_path(@campaign) %> |
29
- <%= link_to 'Back', campaigns_path %>
@@ -150,11 +150,11 @@
150
150
  </div>
151
151
  <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
152
152
  <% if Mail.new(@email_message.eml.raw_source).html_part == nil %>
153
- <p style="margin-left:2%">No HTML content</p>
153
+ <p>No HTML content</p>
154
154
  <% elsif @email_message.eml.html_safe == true %>
155
155
  <%= Mail.new(@email_message.eml.raw_source).html_part.body.decoded.force_encoding('UTF-8').html_safe %>
156
156
  <% else %>
157
- <p style="margin-left:2%">Unsafe to render HTML</p>
157
+ <p>Unsafe to render HTML</p>
158
158
  <% end %>
159
159
  </div>
160
160
  </div>
@@ -1,4 +1,49 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <%= link_to 'Edit', edit_threat_actor_path(@threat_actor) %> |
4
- <%= link_to 'Back', threat_actors_path %>
1
+ <div class="page-content page-container" id="page-content">
2
+ <div class="padding">
3
+ <div class="row container d-flex justify-content-center">
4
+ <div class="col-md-12">
5
+ <div class="card">
6
+ <div class="card-body text-center">
7
+ <div>
8
+ <img src="https://img.icons8.com/bubbles/100/000000/administrator-male.png" class="img-lg rounded-circle mb-4" alt="profile image">
9
+ <h4><%= @threat_actor.name %></h4>
10
+ <p class="text-muted mb-0"><%= @threat_actor.description %></p>
11
+ </div>
12
+ <%= link_to "See dossier", active_attack.playbook_path(@threat_actor.id), class: "btn btn-info btn-sm mt-3 mb-4" %>
13
+ <div class="border-top pt-3">
14
+ <div class="row">
15
+ <div class="col-4">
16
+ <h6>
17
+ Campaigns
18
+ <%= link_to stix.new_threat_actor_campaign_path(@threat_actor), class: "d-flex align-items-center text-muted", "aria-label" => "Add a new report" do %>
19
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle">
20
+ <circle cx="12" cy="12" r="10"></circle>
21
+ <line x1="12" y1="8" x2="12" y2="16"></line>
22
+ <line x1="8" y1="12" x2="16" y2="12"></line>
23
+ </svg>
24
+ <% end %>
25
+ </h6>
26
+ <% @threat_actor.campaigns.each do |campaign| %>
27
+ <%= link_to stix.edit_threat_actor_campaign_path(@threat_actor, campaign) do %>
28
+ <div class="row">
29
+ <%= campaign.name %><%= octicon "pencil" %>
30
+ <% end %>
31
+ </div>
32
+ <% end %>
33
+ </div>
34
+ <div class="col-4">
35
+ <h6><%= @threat_actor.malwares.count %></h6>
36
+ <p>Malwares</p>
37
+ </div>
38
+ <div class="col-4">
39
+ <h6><%= @threat_actor.intrusion_sets.count %></h6>
40
+ <p>Intrusion Sets</p>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
@@ -5,8 +5,6 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <%= stylesheet_link_tag "active_stix/application", media: "all" %>
9
- <%= javascript_include_tag "active_stix/application" %>
10
8
  </head>
11
9
  <body>
12
10
 
@@ -5,7 +5,9 @@ ActiveStix::Engine.routes.draw do
5
5
  resources :users
6
6
  resources :urls
7
7
  resources :tools
8
- resources :threat_actors
8
+ resources :threat_actors do
9
+ resources :campaigns
10
+ end
9
11
  resources :reports
10
12
  resources :relationships
11
13
  resources :recipients
@@ -33,7 +35,6 @@ ActiveStix::Engine.routes.draw do
33
35
  resources :email_messages
34
36
  resources :cyber_observables
35
37
  resources :course_of_actions
36
- resources :campaigns
37
38
  resources :bundles
38
39
  resources :bundled_objects
39
40
  end
@@ -1,3 +1,5 @@
1
+ require 'redcarpet'
2
+
1
3
  module ActiveStix
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace ActiveStix
@@ -1,3 +1,3 @@
1
1
  module ActiveStix
2
- VERSION = '0.1.21'
2
+ VERSION = '0.1.22'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_stix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-11 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 6.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: redcarpet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.5.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.5.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: pg
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -79,37 +93,7 @@ files:
79
93
  - app/assets/javascripts/active_stix/tools.js
80
94
  - app/assets/javascripts/active_stix/urls.js
81
95
  - app/assets/javascripts/active_stix/users.js
82
- - app/assets/stylesheets/active_stix/application.css
83
- - app/assets/stylesheets/active_stix/artifacts.css
84
- - app/assets/stylesheets/active_stix/attack_patterns.css
85
- - app/assets/stylesheets/active_stix/bcc_refs.css
86
- - app/assets/stylesheets/active_stix/bundled_objects.css
87
- - app/assets/stylesheets/active_stix/bundles.css
88
- - app/assets/stylesheets/active_stix/campaigns.css
89
- - app/assets/stylesheets/active_stix/course_of_actions.css
90
- - app/assets/stylesheets/active_stix/cyber_observables.css
91
- - app/assets/stylesheets/active_stix/email_messages.css
92
- - app/assets/stylesheets/active_stix/external_references.css
93
- - app/assets/stylesheets/active_stix/files.css
94
- - app/assets/stylesheets/active_stix/identities.css
95
- - app/assets/stylesheets/active_stix/indicator_labels.css
96
- - app/assets/stylesheets/active_stix/indicators.css
97
- - app/assets/stylesheets/active_stix/intrusion_sets.css
98
- - app/assets/stylesheets/active_stix/kill_chain_phases.css
99
- - app/assets/stylesheets/active_stix/kill_chains.css
100
- - app/assets/stylesheets/active_stix/malwares.css
101
- - app/assets/stylesheets/active_stix/marking_definitions.css
102
- - app/assets/stylesheets/active_stix/observed_data.css
103
- - app/assets/stylesheets/active_stix/open_vocabularies.css
104
- - app/assets/stylesheets/active_stix/phases.css
105
- - app/assets/stylesheets/active_stix/recipients.css
106
- - app/assets/stylesheets/active_stix/relationships.css
107
- - app/assets/stylesheets/active_stix/reports.css
108
- - app/assets/stylesheets/active_stix/threat_actors.css
109
- - app/assets/stylesheets/active_stix/tools.css
110
- - app/assets/stylesheets/active_stix/urls.css
111
- - app/assets/stylesheets/active_stix/users.css
112
- - app/assets/stylesheets/scaffold.css
96
+ - app/assets/stylesheets/active_stix/application.scss
113
97
  - app/controllers/active_stix/application_controller.rb
114
98
  - app/controllers/active_stix/artifacts_controller.rb
115
99
  - app/controllers/active_stix/attack_patterns_controller.rb
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,80 +0,0 @@
1
- body {
2
- background-color: #fff;
3
- color: #333;
4
- margin: 33px;
5
- }
6
-
7
- body, p, ol, ul, td {
8
- font-family: verdana, arial, helvetica, sans-serif;
9
- font-size: 13px;
10
- line-height: 18px;
11
- }
12
-
13
- pre {
14
- background-color: #eee;
15
- padding: 10px;
16
- font-size: 11px;
17
- }
18
-
19
- a {
20
- color: #000;
21
- }
22
-
23
- a:visited {
24
- color: #666;
25
- }
26
-
27
- a:hover {
28
- color: #fff;
29
- background-color: #000;
30
- }
31
-
32
- th {
33
- padding-bottom: 5px;
34
- }
35
-
36
- td {
37
- padding: 0 5px 7px;
38
- }
39
-
40
- div.field,
41
- div.actions {
42
- margin-bottom: 10px;
43
- }
44
-
45
- #notice {
46
- color: green;
47
- }
48
-
49
- .field_with_errors {
50
- padding: 2px;
51
- background-color: red;
52
- display: table;
53
- }
54
-
55
- #error_explanation {
56
- width: 450px;
57
- border: 2px solid red;
58
- padding: 7px 7px 0;
59
- margin-bottom: 20px;
60
- background-color: #f0f0f0;
61
- }
62
-
63
- #error_explanation h2 {
64
- text-align: left;
65
- font-weight: bold;
66
- padding: 5px 5px 5px 15px;
67
- font-size: 12px;
68
- margin: -7px -7px 0;
69
- background-color: #c00;
70
- color: #fff;
71
- }
72
-
73
- #error_explanation ul li {
74
- font-size: 12px;
75
- list-style: square;
76
- }
77
-
78
- label {
79
- display: block;
80
- }