active_stix 0.1.21
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +32 -0
- data/app/assets/config/active_stix_manifest.js +2 -0
- data/app/assets/javascripts/active_stix/application.js +15 -0
- data/app/assets/javascripts/active_stix/artifacts.js +2 -0
- data/app/assets/javascripts/active_stix/attack_patterns.js +2 -0
- data/app/assets/javascripts/active_stix/bcc_refs.js +2 -0
- data/app/assets/javascripts/active_stix/bundled_objects.js +2 -0
- data/app/assets/javascripts/active_stix/bundles.js +2 -0
- data/app/assets/javascripts/active_stix/campaigns.js +2 -0
- data/app/assets/javascripts/active_stix/course_of_actions.js +2 -0
- data/app/assets/javascripts/active_stix/cyber_observables.js +2 -0
- data/app/assets/javascripts/active_stix/email_messages.js +2 -0
- data/app/assets/javascripts/active_stix/external_references.js +2 -0
- data/app/assets/javascripts/active_stix/files.js +2 -0
- data/app/assets/javascripts/active_stix/identities.js +2 -0
- data/app/assets/javascripts/active_stix/indicator_labels.js +2 -0
- data/app/assets/javascripts/active_stix/indicators.js +2 -0
- data/app/assets/javascripts/active_stix/intrusion_sets.js +2 -0
- data/app/assets/javascripts/active_stix/kill_chain_phases.js +2 -0
- data/app/assets/javascripts/active_stix/kill_chains.js +2 -0
- data/app/assets/javascripts/active_stix/malwares.js +2 -0
- data/app/assets/javascripts/active_stix/marking_definitions.js +2 -0
- data/app/assets/javascripts/active_stix/observed_data.js +2 -0
- data/app/assets/javascripts/active_stix/open_vocabularies.js +2 -0
- data/app/assets/javascripts/active_stix/phases.js +2 -0
- data/app/assets/javascripts/active_stix/recipients.js +2 -0
- data/app/assets/javascripts/active_stix/relationships.js +2 -0
- data/app/assets/javascripts/active_stix/reports.js +2 -0
- data/app/assets/javascripts/active_stix/threat_actors.js +2 -0
- data/app/assets/javascripts/active_stix/tools.js +2 -0
- data/app/assets/javascripts/active_stix/urls.js +2 -0
- data/app/assets/javascripts/active_stix/users.js +2 -0
- data/app/assets/stylesheets/active_stix/application.css +15 -0
- data/app/assets/stylesheets/active_stix/artifacts.css +4 -0
- data/app/assets/stylesheets/active_stix/attack_patterns.css +4 -0
- data/app/assets/stylesheets/active_stix/bcc_refs.css +4 -0
- data/app/assets/stylesheets/active_stix/bundled_objects.css +4 -0
- data/app/assets/stylesheets/active_stix/bundles.css +4 -0
- data/app/assets/stylesheets/active_stix/campaigns.css +4 -0
- data/app/assets/stylesheets/active_stix/course_of_actions.css +4 -0
- data/app/assets/stylesheets/active_stix/cyber_observables.css +4 -0
- data/app/assets/stylesheets/active_stix/email_messages.css +4 -0
- data/app/assets/stylesheets/active_stix/external_references.css +4 -0
- data/app/assets/stylesheets/active_stix/files.css +4 -0
- data/app/assets/stylesheets/active_stix/identities.css +4 -0
- data/app/assets/stylesheets/active_stix/indicator_labels.css +4 -0
- data/app/assets/stylesheets/active_stix/indicators.css +4 -0
- data/app/assets/stylesheets/active_stix/intrusion_sets.css +4 -0
- data/app/assets/stylesheets/active_stix/kill_chain_phases.css +4 -0
- data/app/assets/stylesheets/active_stix/kill_chains.css +4 -0
- data/app/assets/stylesheets/active_stix/malwares.css +4 -0
- data/app/assets/stylesheets/active_stix/marking_definitions.css +4 -0
- data/app/assets/stylesheets/active_stix/observed_data.css +4 -0
- data/app/assets/stylesheets/active_stix/open_vocabularies.css +4 -0
- data/app/assets/stylesheets/active_stix/phases.css +4 -0
- data/app/assets/stylesheets/active_stix/recipients.css +4 -0
- data/app/assets/stylesheets/active_stix/relationships.css +4 -0
- data/app/assets/stylesheets/active_stix/reports.css +4 -0
- data/app/assets/stylesheets/active_stix/threat_actors.css +4 -0
- data/app/assets/stylesheets/active_stix/tools.css +4 -0
- data/app/assets/stylesheets/active_stix/urls.css +4 -0
- data/app/assets/stylesheets/active_stix/users.css +4 -0
- data/app/assets/stylesheets/scaffold.css +80 -0
- data/app/controllers/active_stix/application_controller.rb +5 -0
- data/app/controllers/active_stix/artifacts_controller.rb +62 -0
- data/app/controllers/active_stix/attack_patterns_controller.rb +27 -0
- data/app/controllers/active_stix/bcc_refs_controller.rb +62 -0
- data/app/controllers/active_stix/bundled_objects_controller.rb +62 -0
- data/app/controllers/active_stix/bundles_controller.rb +11 -0
- data/app/controllers/active_stix/campaigns_controller.rb +74 -0
- data/app/controllers/active_stix/course_of_actions_controller.rb +62 -0
- data/app/controllers/active_stix/cyber_observables_controller.rb +62 -0
- data/app/controllers/active_stix/email_addresses_controller.rb +74 -0
- data/app/controllers/active_stix/email_messages_controller.rb +26 -0
- data/app/controllers/active_stix/external_references_controller.rb +62 -0
- data/app/controllers/active_stix/files_controller.rb +74 -0
- data/app/controllers/active_stix/identities_controller.rb +128 -0
- data/app/controllers/active_stix/indicator_labels_controller.rb +62 -0
- data/app/controllers/active_stix/indicators_controller.rb +62 -0
- data/app/controllers/active_stix/intrusion_sets_controller.rb +62 -0
- data/app/controllers/active_stix/kill_chain_phases_controller.rb +62 -0
- data/app/controllers/active_stix/kill_chains_controller.rb +62 -0
- data/app/controllers/active_stix/malwares_controller.rb +62 -0
- data/app/controllers/active_stix/marking_definitions_controller.rb +62 -0
- data/app/controllers/active_stix/observed_data_controller.rb +62 -0
- data/app/controllers/active_stix/open_vocabularies_controller.rb +62 -0
- data/app/controllers/active_stix/phases_controller.rb +62 -0
- data/app/controllers/active_stix/recipients_controller.rb +62 -0
- data/app/controllers/active_stix/relationships_controller.rb +62 -0
- data/app/controllers/active_stix/reports_controller.rb +62 -0
- data/app/controllers/active_stix/threat_actors_controller.rb +75 -0
- data/app/controllers/active_stix/tools_controller.rb +62 -0
- data/app/controllers/active_stix/urls_controller.rb +62 -0
- data/app/controllers/active_stix/user_accounts_controller.rb +74 -0
- data/app/controllers/active_stix/users_controller.rb +62 -0
- data/app/helpers/active_stix/application_helper.rb +4 -0
- data/app/helpers/active_stix/artifacts_helper.rb +4 -0
- data/app/helpers/active_stix/attack_patterns_helper.rb +4 -0
- data/app/helpers/active_stix/bcc_refs_helper.rb +4 -0
- data/app/helpers/active_stix/bundled_objects_helper.rb +4 -0
- data/app/helpers/active_stix/bundles_helper.rb +4 -0
- data/app/helpers/active_stix/campaigns_helper.rb +4 -0
- data/app/helpers/active_stix/course_of_actions_helper.rb +4 -0
- data/app/helpers/active_stix/cyber_observables_helper.rb +4 -0
- data/app/helpers/active_stix/email_messages_helper.rb +4 -0
- data/app/helpers/active_stix/external_references_helper.rb +4 -0
- data/app/helpers/active_stix/files_helper.rb +4 -0
- data/app/helpers/active_stix/identities_helper.rb +4 -0
- data/app/helpers/active_stix/indicator_labels_helper.rb +4 -0
- data/app/helpers/active_stix/indicators_helper.rb +4 -0
- data/app/helpers/active_stix/intrusion_sets_helper.rb +4 -0
- data/app/helpers/active_stix/kill_chain_phases_helper.rb +4 -0
- data/app/helpers/active_stix/kill_chains_helper.rb +4 -0
- data/app/helpers/active_stix/malwares_helper.rb +4 -0
- data/app/helpers/active_stix/marking_definitions_helper.rb +4 -0
- data/app/helpers/active_stix/observed_data_helper.rb +4 -0
- data/app/helpers/active_stix/open_vocabularies_helper.rb +4 -0
- data/app/helpers/active_stix/phases_helper.rb +4 -0
- data/app/helpers/active_stix/recipients_helper.rb +4 -0
- data/app/helpers/active_stix/relationships_helper.rb +4 -0
- data/app/helpers/active_stix/reports_helper.rb +4 -0
- data/app/helpers/active_stix/threat_actors_helper.rb +4 -0
- data/app/helpers/active_stix/tools_helper.rb +4 -0
- data/app/helpers/active_stix/urls_helper.rb +4 -0
- data/app/helpers/active_stix/users_helper.rb +4 -0
- data/app/jobs/active_stix/application_job.rb +4 -0
- data/app/mailers/active_stix/application_mailer.rb +6 -0
- data/app/models/active_stix/application_record.rb +5 -0
- data/app/models/active_stix/artifact.rb +23 -0
- data/app/models/active_stix/attack_pattern.rb +150 -0
- data/app/models/active_stix/bcc_ref.rb +6 -0
- data/app/models/active_stix/bundle.rb +108 -0
- data/app/models/active_stix/bundled_object.rb +4 -0
- data/app/models/active_stix/campaign.rb +65 -0
- data/app/models/active_stix/cc_ref.rb +6 -0
- data/app/models/active_stix/course_of_action.rb +54 -0
- data/app/models/active_stix/cyber_observable.rb +4 -0
- data/app/models/active_stix/email_address.rb +27 -0
- data/app/models/active_stix/email_message.rb +339 -0
- data/app/models/active_stix/external_reference.rb +48 -0
- data/app/models/active_stix/file.rb +2 -0
- data/app/models/active_stix/identity.rb +141 -0
- data/app/models/active_stix/indicator.rb +58 -0
- data/app/models/active_stix/indicator_label.rb +4 -0
- data/app/models/active_stix/intrusion_set.rb +69 -0
- data/app/models/active_stix/kill_chain.rb +7 -0
- data/app/models/active_stix/kill_chain_phase.rb +6 -0
- data/app/models/active_stix/label.rb +17 -0
- data/app/models/active_stix/label_malware.rb +4 -0
- data/app/models/active_stix/label_report.rb +4 -0
- data/app/models/active_stix/label_tool.rb +4 -0
- data/app/models/active_stix/malware.rb +98 -0
- data/app/models/active_stix/marking_definition.rb +21 -0
- data/app/models/active_stix/markup.rb +6 -0
- data/app/models/active_stix/object_marking.rb +11 -0
- data/app/models/active_stix/observed_datum.rb +67 -0
- data/app/models/active_stix/open_vocabulary.rb +8 -0
- data/app/models/active_stix/phase.rb +41 -0
- data/app/models/active_stix/recipient.rb +4 -0
- data/app/models/active_stix/reference_item.rb +4 -0
- data/app/models/active_stix/relationship.rb +95 -0
- data/app/models/active_stix/report.rb +93 -0
- data/app/models/active_stix/report_object.rb +9 -0
- data/app/models/active_stix/threat_actor.rb +139 -0
- data/app/models/active_stix/to_ref.rb +6 -0
- data/app/models/active_stix/tool.rb +112 -0
- data/app/models/active_stix/url.rb +15 -0
- data/app/models/active_stix/user.rb +4 -0
- data/app/models/active_stix/user_account.rb +3 -0
- data/app/views/active_stix/artifacts/_form.html.erb +57 -0
- data/app/views/active_stix/artifacts/edit.html.erb +6 -0
- data/app/views/active_stix/artifacts/index.html.erb +41 -0
- data/app/views/active_stix/artifacts/new.html.erb +5 -0
- data/app/views/active_stix/artifacts/show.html.erb +44 -0
- data/app/views/active_stix/attack_patterns/_form.html.erb +37 -0
- data/app/views/active_stix/attack_patterns/edit.html.erb +2 -0
- data/app/views/active_stix/attack_patterns/index.html.erb +2 -0
- data/app/views/active_stix/attack_patterns/new.html.erb +2 -0
- data/app/views/active_stix/attack_patterns/show.html.erb +140 -0
- data/app/views/active_stix/bcc_refs/_form.html.erb +27 -0
- data/app/views/active_stix/bcc_refs/edit.html.erb +6 -0
- data/app/views/active_stix/bcc_refs/index.html.erb +29 -0
- data/app/views/active_stix/bcc_refs/new.html.erb +5 -0
- data/app/views/active_stix/bcc_refs/show.html.erb +14 -0
- data/app/views/active_stix/bundles/index.html.erb +1 -0
- data/app/views/active_stix/bundles/show.html.erb +7 -0
- data/app/views/active_stix/campaigns/_form.html.erb +42 -0
- data/app/views/active_stix/campaigns/_stix_campaign.json.jbuilder +2 -0
- data/app/views/active_stix/campaigns/edit.html.erb +6 -0
- data/app/views/active_stix/campaigns/index.html.erb +35 -0
- data/app/views/active_stix/campaigns/index.json.jbuilder +1 -0
- data/app/views/active_stix/campaigns/new.html.erb +5 -0
- data/app/views/active_stix/campaigns/show.html.erb +29 -0
- data/app/views/active_stix/campaigns/show.json.jbuilder +1 -0
- data/app/views/active_stix/email_messages/_form.html.erb +62 -0
- data/app/views/active_stix/email_messages/_stix_email_message.json.jbuilder +2 -0
- data/app/views/active_stix/email_messages/edit.html.erb +6 -0
- data/app/views/active_stix/email_messages/index.html.erb +43 -0
- data/app/views/active_stix/email_messages/index.json.jbuilder +1 -0
- data/app/views/active_stix/email_messages/new.html.erb +5 -0
- data/app/views/active_stix/email_messages/show.html.erb +165 -0
- data/app/views/active_stix/email_messages/show.json.jbuilder +1 -0
- data/app/views/active_stix/files/_form.html.erb +92 -0
- data/app/views/active_stix/files/_stix_file.json.jbuilder +2 -0
- data/app/views/active_stix/files/edit.html.erb +6 -0
- data/app/views/active_stix/files/index.html.erb +55 -0
- data/app/views/active_stix/files/index.json.jbuilder +1 -0
- data/app/views/active_stix/files/new.html.erb +5 -0
- data/app/views/active_stix/files/show.html.erb +79 -0
- data/app/views/active_stix/files/show.json.jbuilder +1 -0
- data/app/views/active_stix/identities/_form.html.erb +27 -0
- data/app/views/active_stix/identities/_individual.html.erb +100 -0
- data/app/views/active_stix/identities/_organization.html.erb +72 -0
- data/app/views/active_stix/identities/_received_email_messages.html.erb +27 -0
- data/app/views/active_stix/identities/_sent_email_messages.html.erb +27 -0
- data/app/views/active_stix/identities/_threat_icons.html.erb +3 -0
- data/app/views/active_stix/identities/edit.html.erb +2 -0
- data/app/views/active_stix/identities/index.html.erb +37 -0
- data/app/views/active_stix/identities/new.html.erb +5 -0
- data/app/views/active_stix/identities/show.html.erb +15 -0
- data/app/views/active_stix/layouts/active_stix/application.html.erb +16 -0
- data/app/views/active_stix/recipients/_form.html.erb +27 -0
- data/app/views/active_stix/recipients/edit.html.erb +6 -0
- data/app/views/active_stix/recipients/index.html.erb +29 -0
- data/app/views/active_stix/recipients/new.html.erb +5 -0
- data/app/views/active_stix/recipients/show.html.erb +14 -0
- data/app/views/active_stix/threat_actors/_form.html.erb +32 -0
- data/app/views/active_stix/threat_actors/_stix_threat_actor.json.jbuilder +2 -0
- data/app/views/active_stix/threat_actors/edit.html.erb +6 -0
- data/app/views/active_stix/threat_actors/flags.html.erb +184 -0
- data/app/views/active_stix/threat_actors/index.html.erb +26 -0
- data/app/views/active_stix/threat_actors/index.json.jbuilder +1 -0
- data/app/views/active_stix/threat_actors/new.html.erb +5 -0
- data/app/views/active_stix/threat_actors/show.html.erb +4 -0
- data/app/views/active_stix/threat_actors/show.json.jbuilder +1 -0
- data/app/views/layouts/active_stix/application.html.erb +16 -0
- data/config/routes.rb +39 -0
- data/db/migrate/20191204200025_create_active_stix_bundled_objects.rb +11 -0
- data/db/migrate/20191204213707_create_active_stix_bundles.rb +10 -0
- data/db/migrate/20191204213802_create_active_stix_campaigns.rb +15 -0
- data/db/migrate/20191204213926_create_active_stix_course_of_actions.rb +12 -0
- data/db/migrate/20191204214020_create_active_stix_cyber_observables.rb +11 -0
- data/db/migrate/20191204214955_create_active_stix_email_messages.rb +20 -0
- data/db/migrate/20191204215029_create_active_stix_external_references.rb +12 -0
- data/db/migrate/20191204215302_create_active_stix_files.rb +23 -0
- data/db/migrate/20191204215419_create_active_stix_identities.rb +13 -0
- data/db/migrate/20191204215542_create_active_stix_indicator_labels.rb +10 -0
- data/db/migrate/20191204215637_create_active_stix_indicators.rb +16 -0
- data/db/migrate/20191204215849_create_active_stix_intrusion_sets.rb +15 -0
- data/db/migrate/20191204215929_create_active_stix_kill_chain_phases.rb +10 -0
- data/db/migrate/20191204215951_create_active_stix_kill_chains.rb +9 -0
- data/db/migrate/20191204220149_create_active_stix_malwares.rb +12 -0
- data/db/migrate/20191204220539_create_active_stix_marking_definitions.rb +12 -0
- data/db/migrate/20191204220853_create_active_stix_observed_data.rb +12 -0
- data/db/migrate/20191204220917_create_active_stix_open_vocabularies.rb +9 -0
- data/db/migrate/20191204220952_create_active_stix_phases.rb +11 -0
- data/db/migrate/20191204221129_create_active_stix_recipients.rb +10 -0
- data/db/migrate/20191204221227_create_active_stix_relationships.rb +16 -0
- data/db/migrate/20191204221323_create_active_stix_report_objects.rb +11 -0
- data/db/migrate/20191204221359_create_active_stix_reports.rb +14 -0
- data/db/migrate/20191204221425_create_active_stix_threat_actors.rb +11 -0
- data/db/migrate/20191204221454_create_active_stix_tools.rb +12 -0
- data/db/migrate/20191204221639_create_active_stix_urls.rb +9 -0
- data/db/migrate/20191204221849_create_active_stix_users.rb +22 -0
- data/db/migrate/20191205182234_create_active_stix_bcc_refs.rb +10 -0
- data/db/migrate/20191205182255_create_active_stix_cc_refs.rb +10 -0
- data/db/migrate/20191205182316_create_active_stix_to_refs.rb +10 -0
- data/db/migrate/20191212203611_add_spec_version_to_bundles.rb +5 -0
- data/db/migrate/20191212215136_create_active_stix_attack_patterns.rb +12 -0
- data/db/migrate/20191212220222_create_active_stix_reference_items.rb +11 -0
- data/db/migrate/20191213135204_create_active_stix_labels.rb +10 -0
- data/db/migrate/20191213140951_create_active_stix_markups.rb +11 -0
- data/db/migrate/20191221210537_fix_observed_data.rb +6 -0
- data/db/migrate/20191221223602_create_active_stix_artifacts.rb +16 -0
- data/db/migrate/20191223075550_change_artifact_ref_to_string.rb +5 -0
- data/db/migrate/20191223154000_add_stix_id_to_email_messages.rb +5 -0
- data/db/migrate/20200114162245_add_labels_to_active_stix_identities.rb +5 -0
- data/db/migrate/20200404223006_add_aliases_to_tools.rb +5 -0
- data/db/migrate/20200404223047_add_aliases_to_attack_patterns.rb +5 -0
- data/db/migrate/20200404223158_add_aliases_to_malwares.rb +5 -0
- data/db/migrate/20200404223210_add_aliases_to_threat_actors.rb +5 -0
- data/lib/active_stix.rb +8 -0
- data/lib/active_stix/engine.rb +13 -0
- data/lib/active_stix/version.rb +3 -0
- data/lib/tasks/active_stix_tasks.rake +4 -0
- metadata +358 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class ActiveStix::EmailMessagesController < ApplicationController
|
|
2
|
+
before_action :set_stix_email_message, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
# GET /stix/email_messages
|
|
5
|
+
# GET /stix/email_messages.json
|
|
6
|
+
def index
|
|
7
|
+
@email_messages = ActiveStix::EmailMessage.order("created_at DESC").page params[:page]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# GET /stix/email_messages/1
|
|
11
|
+
# GET /stix/email_messages/1.json
|
|
12
|
+
def show
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
18
|
+
def set_stix_email_message
|
|
19
|
+
@email_message = ActiveStix::EmailMessage.find(params[:id])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
|
23
|
+
def stix_email_message_params
|
|
24
|
+
params.require(:email_message).permit(:type, :is_multipart, :date, :content_type, :from_ref, :sender_ref, :to_refs_link_id, :cc_refs_link_id, :bcc_refs_link_id, :subject, :received_lines_link_id, :body, :body_multipart_link_id, :raw_email_ref)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "active_stix/application_controller"
|
|
2
|
+
|
|
3
|
+
module ActiveStix
|
|
4
|
+
class ExternalReferencesController < ApplicationController
|
|
5
|
+
before_action :set_external_reference, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /external_references
|
|
8
|
+
def index
|
|
9
|
+
@external_references = ExternalReference.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /external_references/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /external_references/new
|
|
17
|
+
def new
|
|
18
|
+
@external_reference = ExternalReference.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /external_references/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /external_references
|
|
26
|
+
def create
|
|
27
|
+
@external_reference = ExternalReference.new(external_reference_params)
|
|
28
|
+
|
|
29
|
+
if @external_reference.save
|
|
30
|
+
redirect_to @external_reference, notice: 'External reference was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /external_references/1
|
|
37
|
+
def update
|
|
38
|
+
if @external_reference.update(external_reference_params)
|
|
39
|
+
redirect_to @external_reference, notice: 'External reference was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /external_references/1
|
|
46
|
+
def destroy
|
|
47
|
+
@external_reference.destroy
|
|
48
|
+
redirect_to external_references_url, notice: 'External reference was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_external_reference
|
|
54
|
+
@external_reference = ExternalReference.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def external_reference_params
|
|
59
|
+
params.require(:external_reference).permit(:source_name, :description, :url, :external_id)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
class ActiveStix::FilesController < ApplicationController
|
|
2
|
+
before_action :set_stix_file, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
# GET /stix/files
|
|
5
|
+
# GET /stix/files.json
|
|
6
|
+
def index
|
|
7
|
+
@files = ActiveStix::File.all
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# GET /stix/files/1
|
|
11
|
+
# GET /stix/files/1.json
|
|
12
|
+
def show
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# GET /stix/files/new
|
|
16
|
+
def new
|
|
17
|
+
@file = ActiveStix::File.new
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# GET /stix/files/1/edit
|
|
21
|
+
def edit
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# POST /stix/files
|
|
25
|
+
# POST /stix/files.json
|
|
26
|
+
def create
|
|
27
|
+
@file = ActiveStix::File.new(stix_file_params)
|
|
28
|
+
|
|
29
|
+
respond_to do |format|
|
|
30
|
+
if @file.save
|
|
31
|
+
format.html { redirect_to @file, notice: 'File was successfully created.' }
|
|
32
|
+
format.json { render :show, status: :created, location: @file }
|
|
33
|
+
else
|
|
34
|
+
format.html { render :new }
|
|
35
|
+
format.json { render json: @file.errors, status: :unprocessable_entity }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# PATCH/PUT /stix/files/1
|
|
41
|
+
# PATCH/PUT /stix/files/1.json
|
|
42
|
+
def update
|
|
43
|
+
respond_to do |format|
|
|
44
|
+
if @file.update(stix_file_params)
|
|
45
|
+
format.html { redirect_to @file, notice: 'File was successfully updated.' }
|
|
46
|
+
format.json { render :show, status: :ok, location: @file }
|
|
47
|
+
else
|
|
48
|
+
format.html { render :edit }
|
|
49
|
+
format.json { render json: @file.errors, status: :unprocessable_entity }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# DELETE /stix/files/1
|
|
55
|
+
# DELETE /stix/files/1.json
|
|
56
|
+
def destroy
|
|
57
|
+
@file.destroy
|
|
58
|
+
respond_to do |format|
|
|
59
|
+
format.html { redirect_to stix_files_url, notice: 'File was successfully destroyed.' }
|
|
60
|
+
format.json { head :no_content }
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
66
|
+
def set_stix_file
|
|
67
|
+
@file = ActiveStix::File.find(params[:id])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
|
71
|
+
def stix_file_params
|
|
72
|
+
params.require(:file).permit(:extensions, :hashes, :size, :name, :name_enc, :magic_number_hex, :mime_type, :created_file, :modified_file, :accessed_file, :parent_directory_ref, :is_encrypted, :encryption_algorithm, :decryption_key, :content_ref)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
class ActiveStix::IdentitiesController < ApplicationController
|
|
2
|
+
before_action :set_stix_identity, only: [:show, :edit, :update, :destroy, :corpus]
|
|
3
|
+
|
|
4
|
+
# GET /stix/identities
|
|
5
|
+
# GET /stix/identities.json
|
|
6
|
+
def index
|
|
7
|
+
@identities = ActiveStix::Identity.where("name like ?", "%#{params[:search]}%").order("name").page params[:page]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# GET /stix/identities/1
|
|
11
|
+
# GET /stix/identities/1.json
|
|
12
|
+
def show
|
|
13
|
+
if @identity.identity_class == 'organization'
|
|
14
|
+
@employment_records = @identity.source_relationships.where(relationship_type: "employs").page(params[:page])
|
|
15
|
+
@threat_groups = @identity.threat_groups
|
|
16
|
+
@attack_patterns = @identity.attack_patterns
|
|
17
|
+
else
|
|
18
|
+
case params[:mailbox]
|
|
19
|
+
when 'sent'
|
|
20
|
+
@mailbox = "Sent"
|
|
21
|
+
@sent_email_messages = @identity.email_messages.includes(:eml).order("created_at DESC").page(params[:page])
|
|
22
|
+
when 'received'
|
|
23
|
+
@mailbox = "Received"
|
|
24
|
+
@received_email_messages = @identity.to_refs.order("created_at DESC").page(params[:page])
|
|
25
|
+
else
|
|
26
|
+
@mailbox = "Sent"
|
|
27
|
+
@sent_email_messages = @identity.email_messages.includes(:eml).order("created_at DESC").page(params[:page])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# GET /stix/identities/new
|
|
33
|
+
def new
|
|
34
|
+
@identity = ActiveStix::Identity.new
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# GET /stix/identities/1/edit
|
|
38
|
+
def edit
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# POST /stix/identities
|
|
42
|
+
# POST /stix/identities.json
|
|
43
|
+
def create
|
|
44
|
+
@identity = ActiveStix::Identity.new(stix_identity_params)
|
|
45
|
+
@identity.identity_class = "organization"
|
|
46
|
+
|
|
47
|
+
respond_to do |format|
|
|
48
|
+
if @identity.save
|
|
49
|
+
Ldap.stix_ingest(@identity, params[:identity][:uploaded_file].path)
|
|
50
|
+
format.html {redirect_to @identity, notice: 'Identity was successfully created.'}
|
|
51
|
+
format.json {render :show, status: :created, location: @identity}
|
|
52
|
+
else
|
|
53
|
+
format.html {render :new}
|
|
54
|
+
format.json {render json: @identity.errors, status: :unprocessable_entity}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# PATCH/PUT /stix/identities/1
|
|
60
|
+
# PATCH/PUT /stix/identities/1.json
|
|
61
|
+
def update
|
|
62
|
+
respond_to do |format|
|
|
63
|
+
if @identity.update(stix_identity_params)
|
|
64
|
+
format.html {redirect_to @identity, notice: 'Identity was successfully updated.'}
|
|
65
|
+
format.json {render :show, status: :ok, location: @identity}
|
|
66
|
+
else
|
|
67
|
+
format.html {render :edit}
|
|
68
|
+
format.json {render json: @identity.errors, status: :unprocessable_entity}
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# DELETE /stix/identities/1
|
|
74
|
+
# DELETE /stix/identities/1.json
|
|
75
|
+
def destroy
|
|
76
|
+
@identity.destroy
|
|
77
|
+
respond_to do |format|
|
|
78
|
+
format.html {redirect_to stix_identities_url, notice: 'Identity was successfully destroyed.'}
|
|
79
|
+
format.json {head :no_content}
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def employment
|
|
84
|
+
organization = ActiveStix::Identity.find(params[:organization_id])
|
|
85
|
+
@identity = ActiveStix::Identity.find(params[:identity_id])
|
|
86
|
+
|
|
87
|
+
respond_to do |format|
|
|
88
|
+
if ActiveStix::Identity.employ(@identity, organization)
|
|
89
|
+
format.html {redirect_to @identity, notice: 'Identity was successfully updated.'}
|
|
90
|
+
format.json {render :show, status: :ok, location: @identity}
|
|
91
|
+
else
|
|
92
|
+
format.html {render @identity, notice: 'Could not create employment.'}
|
|
93
|
+
format.json {render json: @identity.errors, status: :unprocessable_entity}
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def attribution
|
|
100
|
+
|
|
101
|
+
organization = ActiveStix::Identity.find(params[:identity_id])
|
|
102
|
+
threat_actor = ActiveStix::ThreatActor.find(params[:threat_actor_id])
|
|
103
|
+
ActiveStix::Relationship.relate(threat_actor, organization, "attributed-to")
|
|
104
|
+
|
|
105
|
+
respond_to do |format|
|
|
106
|
+
format.html {redirect_to organization, notice: 'Identity was successfully updated.'}
|
|
107
|
+
format.json {render :show, status: :ok, location: organization}
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def corpus
|
|
112
|
+
#download all the email attachments in an evaluation
|
|
113
|
+
send_data(File.read(@identity.corpus(params[:mailbox])), :type => 'application/zip', :disposition => "attachment")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
private
|
|
117
|
+
|
|
118
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
119
|
+
def set_stix_identity
|
|
120
|
+
@identity = ActiveStix::Identity.find(params[:id] || params[:identity_id])
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
|
124
|
+
def stix_identity_params
|
|
125
|
+
params.require(:identity).permit(:name, :description, :identity_class, :contact_information, :known_person, :legitimate_organization)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "active_stix/application_controller"
|
|
2
|
+
|
|
3
|
+
module ActiveStix
|
|
4
|
+
class IndicatorLabelsController < ApplicationController
|
|
5
|
+
before_action :set_indicator_label, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /indicator_labels
|
|
8
|
+
def index
|
|
9
|
+
@indicator_labels = IndicatorLabel.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /indicator_labels/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /indicator_labels/new
|
|
17
|
+
def new
|
|
18
|
+
@indicator_label = IndicatorLabel.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /indicator_labels/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /indicator_labels
|
|
26
|
+
def create
|
|
27
|
+
@indicator_label = IndicatorLabel.new(indicator_label_params)
|
|
28
|
+
|
|
29
|
+
if @indicator_label.save
|
|
30
|
+
redirect_to @indicator_label, notice: 'Indicator label was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /indicator_labels/1
|
|
37
|
+
def update
|
|
38
|
+
if @indicator_label.update(indicator_label_params)
|
|
39
|
+
redirect_to @indicator_label, notice: 'Indicator label was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /indicator_labels/1
|
|
46
|
+
def destroy
|
|
47
|
+
@indicator_label.destroy
|
|
48
|
+
redirect_to indicator_labels_url, notice: 'Indicator label was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_indicator_label
|
|
54
|
+
@indicator_label = IndicatorLabel.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def indicator_label_params
|
|
59
|
+
params.require(:indicator_label).permit(:label_id, :indicator_id)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "active_stix/application_controller"
|
|
2
|
+
|
|
3
|
+
module ActiveStix
|
|
4
|
+
class IndicatorsController < ApplicationController
|
|
5
|
+
before_action :set_indicator, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /indicators
|
|
8
|
+
def index
|
|
9
|
+
@indicators = Indicator.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /indicators/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /indicators/new
|
|
17
|
+
def new
|
|
18
|
+
@indicator = Indicator.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /indicators/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /indicators
|
|
26
|
+
def create
|
|
27
|
+
@indicator = Indicator.new(indicator_params)
|
|
28
|
+
|
|
29
|
+
if @indicator.save
|
|
30
|
+
redirect_to @indicator, notice: 'Indicator was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /indicators/1
|
|
37
|
+
def update
|
|
38
|
+
if @indicator.update(indicator_params)
|
|
39
|
+
redirect_to @indicator, notice: 'Indicator was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /indicators/1
|
|
46
|
+
def destroy
|
|
47
|
+
@indicator.destroy
|
|
48
|
+
redirect_to indicators_url, notice: 'Indicator was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_indicator
|
|
54
|
+
@indicator = Indicator.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def indicator_params
|
|
59
|
+
params.require(:indicator).permit(:name, :labels, :description, :pattern, :valid_from, :valid_until, :kill_chain_phases, :active_stix_id)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "active_stix/application_controller"
|
|
2
|
+
|
|
3
|
+
module ActiveStix
|
|
4
|
+
class IntrusionSetsController < ApplicationController
|
|
5
|
+
before_action :set_intrusion_set, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /intrusion_sets
|
|
8
|
+
def index
|
|
9
|
+
@intrusion_sets = IntrusionSet.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /intrusion_sets/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /intrusion_sets/new
|
|
17
|
+
def new
|
|
18
|
+
@intrusion_set = IntrusionSet.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /intrusion_sets/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /intrusion_sets
|
|
26
|
+
def create
|
|
27
|
+
@intrusion_set = IntrusionSet.new(intrusion_set_params)
|
|
28
|
+
|
|
29
|
+
if @intrusion_set.save
|
|
30
|
+
redirect_to @intrusion_set, notice: 'Intrusion set was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /intrusion_sets/1
|
|
37
|
+
def update
|
|
38
|
+
if @intrusion_set.update(intrusion_set_params)
|
|
39
|
+
redirect_to @intrusion_set, notice: 'Intrusion set was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /intrusion_sets/1
|
|
46
|
+
def destroy
|
|
47
|
+
@intrusion_set.destroy
|
|
48
|
+
redirect_to intrusion_sets_url, notice: 'Intrusion set was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_intrusion_set
|
|
54
|
+
@intrusion_set = IntrusionSet.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def intrusion_set_params
|
|
59
|
+
params.require(:intrusion_set).permit(:name, :description, :first_seen, :last_seen, :active_stix_id, :aliases, :object_marking_refs)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|