Skip to content

Commit

Permalink
Merge pull request #8 from center-for-threat-informed-defense/cti-aut…
Browse files Browse the repository at this point in the history
…horing-tool-v0-1-3

CTI Authoring Tool v0.1.3
  • Loading branch information
tleef42 authored Jun 6, 2023
2 parents 3655ed2 + 2be3537 commit 4898558
Show file tree
Hide file tree
Showing 270 changed files with 5,199 additions and 2,891 deletions.
11 changes: 11 additions & 0 deletions src/cti_authoring_tool/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.1.3](///compare/v0.1.2...v0.1.3) (2023-06-06)


### Features

* add file save/open functionality 3a4bdc8
* add redesigned Page library 9dc899b
* add redesigned Page Management library 7bc0821
* restructure and expand Web Utilities library b8a66fa
* restructure core application library 9c6f877

### [0.1.2](///compare/v0.1.1...v0.1.2) (2023-04-10)


Expand Down
4 changes: 2 additions & 2 deletions src/cti_authoring_tool/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cti_authoring_tool/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cti-authoring-tool",
"version": "0.1.2",
"version": "0.1.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
20 changes: 10 additions & 10 deletions src/cti_authoring_tool/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<AppHotkeyBox id="main">
<AppTitleBar id="app-title-bar"/>
<div class id="tool-bar"></div>
<!-- <div class id="tool-bar"></div> -->
<div id="app-body">
<ScrollBox id="page-container" :alwaysShowScrollBar="true">
<PageEditorControl id="page" :page="editor.page" @command="onCommand" />
<PageEditorControl id="page" :page="editor.page" @execute="onExecute" />
</ScrollBox>
</div>
<FileSelect
Expand All @@ -21,11 +21,11 @@

<script lang="ts">
import * as Store from "@/store/StoreTypes";
import * as App from "@/assets/scripts/Commands/AppCommands";
import * as AppCommands from "@/assets/scripts/Application/Commands";
import Configuration from "@/assets/configuration/app.config"
// Dependencies
import { Command } from "./assets/scripts/Commands/Command";
import { PageEditor } from "./assets/scripts/Page/PageEditor";
import { Command } from "./assets/scripts/Application/Command";
import { PageEditor } from "./assets/scripts/PageEditor/PageEditor";
import { defineComponent } from 'vue';
import { mapMutations, mapState } from 'vuex';
// Components
Expand Down Expand Up @@ -69,11 +69,11 @@ export default defineComponent({
...mapMutations("ApplicationStore", ["execute"]),
/**
* Page command behavior.
* Page execute behavior.
* @param emitter
* The page's command.
*/
async onCommand(cmd: Command) {
async onExecute(cmd: Command) {
try {
if(cmd instanceof Promise) {
this.execute(await cmd);
Expand All @@ -91,7 +91,7 @@ export default defineComponent({
* The editor's id.
*/
onEditorSwitch(id: string) {
this.execute(new App.SwitchActiveFile(this.ctx, id));
this.execute(AppCommands.switchActivePage(this.ctx, id));
},
/**
Expand All @@ -100,7 +100,7 @@ export default defineComponent({
* The editor's id.
*/
onEditorClose(id: string) {
this.execute(new App.UnloadFile(this.ctx, id));
this.execute(AppCommands.unloadPage(this.ctx, id));
}
Expand All @@ -114,7 +114,7 @@ export default defineComponent({
settings = require("../public/settings.json");
}
// Load settings
this.execute(new App.LoadSettings(this.ctx, settings));
this.execute(AppCommands.loadSettings(this.ctx, settings));
},
components: {
ScrollBox, AppTitleBar, AppHotkeyBox,
Expand Down
6 changes: 3 additions & 3 deletions src/cti_authoring_tool/src/assets/configuration/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AppConfiguration, PropertyType } from "../scripts/AppConfiguration";
import { ThreatActorProfile } from "./templates/ThreatActorProfile";
import { Campaign } from "./templates/Campaign";
import { IntrusionAnalysis } from "./templates/IntrusionAnalysis";
import { Executive } from "./templates/Executive";
import { IntrusionAnalysis } from "./templates/IntrusionAnalysis";
import { ThreatActorProfile } from "./templates/ThreatActorProfile";
import { AppConfiguration } from "@/assets/scripts/Application/AppConfiguration";

const config: AppConfiguration = {
is_web_hosted: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Browser } from "@/assets/scripts/Utilities/Browser";
import { TabularProperty } from "@/assets/scripts/Page";

export class ImportCSVPlugin {

/**
* Creates a new {@link ImportCSVPlugin}.
* @param property
* The tabular property.
*/
constructor(property: TabularProperty) {
// Register "Import from CSV" action
property.registerAction("import-csv", "Import from CSV", () => {
Browser.openTextFileDialog().then(file => {
let { contents } = file;
// Validate contents
if(contents === null || contents === undefined) {
console.error(`Error: could not contents of file: '${ file.filename }'.`);
}
// Parse contents
let objs = this.parseCsv(file.contents as string);
// Add contents
for(let obj of objs) {
property.insertRow(property.createRow(obj));
}
});
});
}

/**
* Parses a simple CSV file.
* @param contents
* The CSV file's contents.
* @returns
* The parsed CSV file.
*/
private parseCsv(contents: string): any[] {
let objs = [];
let lines = contents.split(/\r?\n/g);
let head = lines[0].split(/,/g);
for(let i = 1; i < lines.length; i++) {
let obj = []
let cells = lines[i].split(/\,/g);
for(let j = 0; j < head.length; j++) {
obj.push([head[j], cells[j]]);
}
objs.push(Object.fromEntries(obj));
}
return objs;
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IStringProperty } from "@/assets/scripts/Page/Property/StringProperty/IStringProperty";
import { StringProperty } from "@/assets/scripts/Page";

export class ReportNumberPlugin {

Expand All @@ -7,7 +7,7 @@ export class ReportNumberPlugin {
* @param property
* The report number property.
*/
constructor(property: IStringProperty) {
constructor(property: StringProperty) {
// property.setValue(`${ crypto.randomUUID().substring(0, 6) }`);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Activity = {
id: "activity",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Artifact = {
id: "artifact",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Assessment = {
id: "assessment",
name: "Assessment",
path: "*.assessment",
type: PropertyType.String
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Attribution = {
id: "attribution",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Control = {
id: "control",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Criticality = {
id: "criticality",
name: "Criticality",
path: "*.criticality",
type: PropertyType.Enum,
options: [
{ id: "fysa", text: "FYSA", value: "fysa" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const CveCvssScore = {
id: "cve_cvss_score",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const CveNumber = {
id: "cve_number",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const CvePatchApplied = {
id: "cve_patch_applied",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const CvePatchAvailable = {
id: "cve_patch_available",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const CveRemediation = {
id: "cve_remediation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ import { CveNumber } from "./CveNumber";
import { Attribution } from "./Attribution";
import { CveCvssScore } from "./CveCvssScore";
import { DateOfReport } from "./DateOfReport";
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";
import { CveRemediation } from "./CveRemediation";
import { CvePatchApplied } from "./CvePatchApplied";
import { CvePatchAvailable } from "./CvePatchAvailable";
import { ImportCSVPlugin } from "../plugins/ImportCSVPlugin";

export const Cves = {
id: "cves",
name: "Common Vulnerabilities and Exposures (CVE)",
path: "*.iocs.cves",
type: PropertyType.ComplexTable,
layout: {
summary: "{{ attribution }}\n**{{ cve_number }}**",
rows: 4,
cols: 2
},
plugins: [
{ module: ImportCSVPlugin }
],
properties: [
{
...Attribution,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const DateOfReport = {
id: "date_of_report",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const DateReported = {
id: "date_reported",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Defend = {
id: "defend",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const ExecutiveSummary = {
id: "executive_summary",
name: "Executive Summary",
path: "*.executive_summary",
type: PropertyType.String
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const FirstObserved = {
id: "first_observed",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const IndicatorAnalysis = {
id: "indicator_analysis",
path: "*.indicator_analysis",
name: "Indicator Analysis",
type: PropertyType.String,
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const Infrastructure = {
id: "infrastructure",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const IntelligenceRequirement = {
id: "intelligence_requirement",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { PropertyType } from "@/assets/scripts/PageEditor";
import { ImportCSVPlugin } from "../plugins/ImportCSVPlugin";
import { IntelligenceRequirement } from "./IntelligenceRequirement";

export const IntelligenceRequirements = {
id: "intelligence_requirements",
name: "Intelligence Requirements",
path: "*.intelligence_requirements",
type: PropertyType.BasicTable,
layout: {
cols: 1,
},
plugins: [
{ module: ImportCSVPlugin }
],
properties: [
{
...IntelligenceRequirement,
row: 0,
col: 1
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyType } from "@/assets/scripts/AppConfiguration";
import { PropertyType } from "@/assets/scripts/PageEditor";

export const InternalTelemetry = {
id: "internal_telemetry",
Expand Down
Loading

0 comments on commit 4898558

Please sign in to comment.