Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
58350ab
Updated .gitignore to move openapi docs
MaartendeKruijf Nov 22, 2024
0e3a4eb
Moved main to cmd/soarca
MaartendeKruijf Nov 22, 2024
5592658
Moved playbooks to examples folder
MaartendeKruijf Nov 22, 2024
101bb73
Moved models inside pkg
MaartendeKruijf Nov 22, 2024
54c4e59
Fixed files in models
MaartendeKruijf Nov 22, 2024
6f5e325
Moved decompose into pkg/core
MaartendeKruijf Nov 22, 2024
216b4c6
Fixed decomposer path
MaartendeKruijf Nov 22, 2024
226dbde
Moved executors into pkg/core
MaartendeKruijf Nov 22, 2024
5fa13ae
Fixed executors files
MaartendeKruijf Nov 22, 2024
868f061
Moved database into internal
MaartendeKruijf Nov 22, 2024
5cf4ff0
Fixed database files
MaartendeKruijf Nov 22, 2024
fa03e0a
Moved utils and included guid into utils
MaartendeKruijf Nov 22, 2024
ce84cde
Fixed utils files
MaartendeKruijf Nov 22, 2024
2afd67a
Move capability into pkg
MaartendeKruijf Nov 22, 2024
db6d782
Fix capability files
MaartendeKruijf Nov 22, 2024
e4f9d5b
Move routes to pkg api
MaartendeKruijf Nov 22, 2024
fde83bd
Update api files
MaartendeKruijf Nov 22, 2024
d72037a
Moved logger to internal
MaartendeKruijf Nov 22, 2024
4952ad3
Fixed test
MaartendeKruijf Nov 22, 2024
9dc646c
Fixed internal
MaartendeKruijf Nov 22, 2024
b9fed04
Updated makefile
MaartendeKruijf Nov 22, 2024
08f70ae
Updated makefile sbom path
MaartendeKruijf Nov 24, 2024
137fd47
Moved capability to core folder
MaartendeKruijf Nov 24, 2024
596fa15
Updated package paths for capabilities
MaartendeKruijf Nov 24, 2024
3864df7
Fix linting issues
MaartendeKruijf Nov 24, 2024
a363dd4
Moved docker folder to deployments
MaartendeKruijf Nov 24, 2024
9bbe2c8
Move images to assets
MaartendeKruijf Nov 24, 2024
e31db41
Moved fin protocol to pkg
MaartendeKruijf Nov 24, 2024
d775c61
Fixed paths for fin protocol
MaartendeKruijf Nov 25, 2024
167ba81
Moved reporter to pkg
MaartendeKruijf Nov 25, 2024
28a386f
Fixed paths reporter
MaartendeKruijf Nov 25, 2024
b26f3e1
Fixed build for ci
MaartendeKruijf Nov 25, 2024
3ec91fb
Moved existing the hive integration
MaartendeKruijf Nov 25, 2024
e9c3528
Moved models and utils
MaartendeKruijf Nov 25, 2024
80719da
Moved to reporter folder
MaartendeKruijf Nov 25, 2024
a9542d8
Fixed include paths
MaartendeKruijf Nov 25, 2024
3384031
fixed manual test
MaartendeKruijf Nov 25, 2024
05c7ec2
Moved models and utils to common
MaartendeKruijf Nov 25, 2024
fb5f33f
Updated SOARCA component diagram to be in line with repo changes
MaartendeKruijf Nov 25, 2024
db941b3
Fexed typo in application design
MaartendeKruijf Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: go install github.com/swaggo/swag/cmd/swag@latest
timeout-minutes: 12
- name: Start docker containers for test
run: docker compose -f "docker/testing/httpbin-test/docker-compose.yml" up -d --build
run: docker compose -f "deployments/docker/testing/httpbin-test/docker-compose.yml" up -d --build
- name: Run tests
run: |
sudo apt update
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ jobs:
run: |
go install github.com/swaggo/swag/cmd/swag@latest
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest
swag init -o swaggerdocs
make sbom
zip -r bin/sbom.zip bin

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins/*
build/*
!build/build.md
bin/*
swaggerdocs/*
api/*
**.env
test/cacao/flatfile-db-example.json

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<a href="https://cossas-project.org/cossas-software/soarca"><img src="img/soarca-logo.svg"/>
<a href="https://cossas-project.org/cossas-software/soarca"><img src="assets/soarca-logo.svg"/>


[![https://cossas-project.org/portfolio/SOARCA/](https://img.shields.io/badge/website-cossas--project.org-orange)](https://cossas-project.org/portfolio/SOARCA/)
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
26 changes: 13 additions & 13 deletions main.go → cmd/soarca/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"fmt"

api "soarca/api"
"soarca/internal/controller"
"soarca/logger"
"soarca/routes/status"
"soarca/swaggerdocs"
"soarca/utils"
"soarca/internal/logger"
"soarca/pkg/api/status"
"soarca/pkg/utils"

"github.com/joho/godotenv"
)
Expand Down Expand Up @@ -36,25 +36,25 @@ const banner = `

`

// @title SOARCA API
// @version 1.0.0
// @title SOARCA API
// @version 1.0.0
func main() {
fmt.Print(banner)
log.Info("Version: ", Version)
log.Info("Buildtime: ", Buildtime)

errenv := godotenv.Load(".env")
if errenv != nil {
err := godotenv.Load(".env")
if err != nil {
log.Warning("Failed to read env variable, but will continue")
}
Host = "localhost:" + utils.GetEnv("PORT", "8080")
swaggerdocs.SwaggerInfo.Host = Host
api.SwaggerInfo.Host = Host

// Version is only available here
status.SetVersion(Version)
errinit := controller.Initialize()
if errinit != nil {
log.Fatal("Something Went wrong with setting-up the app, msg: ", errinit)
panic(errinit)
err = controller.Initialize()
if err != nil {
log.Fatal("Something Went wrong with setting-up the app, msg: ", err)
panic(err)
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
71 changes: 45 additions & 26 deletions docs/content/en/docs/core-components/soarca-application-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,61 @@ set separator ::

protocol /playbook #lightgreen
protocol /trigger #lightgreen
protocol /status #lightgreen
protocol /reporter #lightgreen
protocol /step #red
protocol /trusted/variables #red
protocol /status #red

class controller #lightgreen
class database #lightgreen
class log #lightgreen
class internal::controller #lightgreen
class internal::database #lightgreen
class internal::logger #lightgreen
class core::decomposer #lightgreen
class core::executor #lightgreen
class endpoints::playbook #lightgreen
class endpoints::trigger #lightgreen
class core::modules::http #lightgreen
class core::modules::ssh #lightgreen
class core::modules::openC2 #orange
class core::modules::fin #orange
class api::playbook #lightgreen
class api::trigger #lightgreen
class core::capability::http #lightgreen
class core::capability::ssh #lightgreen
class core::capability::openC2 #lightgreen
class core::capability::fin #lightgreen
class core::capability::powershell #lightgreen
class api::status #lightgreen
class api::reporter #lightgreen

class endpoints::step #red
class endpoints::variables #red
class endpoints::status #red
class api::step #red
class api::variables #red

class api::reporter #lightgreen

"/step" *-- endpoints::step
"/playbook" *-- endpoints::playbook
"/trigger" *-- endpoints::trigger
"/status" *-- endpoints::status
"/trusted/variables" *-- endpoints::variables
class reporter::cache #orange

endpoints *-down- controller

"/step" *-- api::step
"/playbook" *-- api::playbook
"/trigger" *-- api::trigger
"/status" *-- api::status
"/reporter" *-- api::reporter
"/trusted/variables" *-- api::variables

api *-down- controller
controller -* database
log *- controller
controller -down-* core::decomposer
logger *- controller
controller -down-* core

api::reporter -down-> reporter::cache

reporter::cache <-- core::decomposer
reporter::cache <-- core::executor

api::playbook --> internal::database
api::trigger --> core::decomposer
api::trigger --> internal::database

core::decomposer -down-> core::executor
core::executor --> core::modules::openC2
core::executor --> core::modules::fin
core::executor --> core::modules::http
core::executor --> core::modules::ssh
core::executor --> core::capability::openC2
core::executor --> core::capability::fin
core::executor --> core::capability::http
core::executor --> core::capability::ssh
core::executor --> core::capability::powershell
@enduml
```

Expand Down Expand Up @@ -108,7 +127,7 @@ ICapability <- Executer
```

### Controller
The SOARCA controller will create all classed needed by SOARCA. The controller glues the endpoints and decomposer together. Each run will instantiate a new decomposer.
The SOARCA controller will create all classes needed by SOARCA. The controller glues the api and decomposer together. Each run will instantiate a new decomposer.

```plantuml
interface IPlaybook{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 27 additions & 27 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ import (
"strconv"
"strings"

"soarca/internal/capability"
capabilityController "soarca/internal/capability/controller"
finExecutor "soarca/internal/capability/fin"
"soarca/internal/capability/http"
"soarca/internal/capability/openc2"
"soarca/internal/capability/powershell"
"soarca/internal/capability/ssh"
"soarca/internal/decomposer"
"soarca/internal/executors/action"
"soarca/internal/executors/condition"
"soarca/internal/executors/playbook_action"
"soarca/internal/fin/protocol"
"soarca/internal/guid"
"soarca/internal/reporter"
cache "soarca/internal/reporter/downstream_reporter/cache"
"soarca/internal/reporter/downstream_reporter/thehive"
"soarca/logger"
"soarca/utils"
httpUtil "soarca/utils/http"
"soarca/utils/stix/expression/comparison"
timeUtil "soarca/utils/time"

downstreamReporter "soarca/internal/reporter/downstream_reporter"
"soarca/internal/logger"
"soarca/pkg/core/capability"
capabilityController "soarca/pkg/core/capability/controller"
finExecutor "soarca/pkg/core/capability/fin"
"soarca/pkg/core/capability/fin/protocol"
"soarca/pkg/core/capability/http"
"soarca/pkg/core/capability/openc2"
"soarca/pkg/core/capability/powershell"
"soarca/pkg/core/capability/ssh"
"soarca/pkg/core/decomposer"
"soarca/pkg/core/executors/action"
"soarca/pkg/core/executors/condition"
"soarca/pkg/core/executors/playbook_action"
thehive "soarca/pkg/integration/thehive/reporter"
"soarca/pkg/reporter"
cache "soarca/pkg/reporter/downstream_reporter/cache"
"soarca/pkg/utils"
"soarca/pkg/utils/guid"
httpUtil "soarca/pkg/utils/http"
"soarca/pkg/utils/stix/expression/comparison"
timeUtil "soarca/pkg/utils/time"

downstreamReporter "soarca/pkg/reporter/downstream_reporter"

"github.com/gin-gonic/gin"

"soarca/database/memory"
mongo "soarca/database/mongodb"
playbookrepository "soarca/database/playbook"
"soarca/routes"
"soarca/internal/database/memory"
mongo "soarca/internal/database/mongodb"
playbookrepository "soarca/internal/database/playbook"
routes "soarca/pkg/api"
)

var log *logger.Log
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/database/controller_database.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package database

import (
playbookrepository "soarca/database/playbook"
playbookrepository "soarca/internal/database/playbook"
)

type IController interface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package decomposer_controller

import (
"soarca/internal/decomposer"
"soarca/pkg/core/decomposer"
)

type IController interface {
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/informer/execution_informer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package informer

import (
"soarca/models/cache"
"soarca/pkg/models/cache"

"github.com/google/uuid"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package memory

import (
"errors"
"soarca/models/api"
"soarca/models/cacao"
"soarca/models/decoder"
"soarca/pkg/models/api"
"soarca/pkg/models/cacao"
"soarca/pkg/models/decoder"
)

type InMemoryDatabase struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"fmt"
"io"
"os"
"soarca/models/cacao"
"soarca/models/decoder"
"soarca/pkg/models/cacao"
"soarca/pkg/models/decoder"
"sort"
"testing"

"github.com/go-playground/assert/v2"
)

var PB_PATH string = "../../test/playbooks/"
var PB_PATH string = "../../../test/playbooks/"

func TestCreate(t *testing.T) {
jsonFile, err := os.Open(PB_PATH + "playbook.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mongodb
import (
"reflect"

"soarca/logger"
"soarca/internal/logger"
)

var log *logger.Log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"reflect"
"time"

"soarca/database/projections"
cacao "soarca/models/cacao"
"soarca/internal/database/projections"
cacao "soarca/pkg/models/cacao"

"go.mongodb.org/mongo-driver/bson"
mongo "go.mongodb.org/mongo-driver/mongo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package playbookrepository
import (
"errors"

database "soarca/database"
"soarca/database/projections"
database "soarca/internal/database"
"soarca/internal/database/projections"
validator "soarca/internal/validators"
"soarca/models/api"
"soarca/models/cacao"
"soarca/models/decoder"
"soarca/pkg/models/api"
"soarca/pkg/models/cacao"
"soarca/pkg/models/decoder"
)

type IPlaybookRepository interface {
Expand Down
2 changes: 1 addition & 1 deletion logger/logger.go → internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package logger
import (
"fmt"
"os"
"soarca/utils"
"soarca/pkg/utils"
"strings"

logrus "github.com/sirupsen/logrus"
Expand Down
Loading