How chainreactors/malice-network works
Main components
a. Client Application
• UI Layer
• CLI/TUI engine (uses external/console and external/readline)
• Optional GUI assets (client/assets)
• Command Layer
• 100+ sub-commands under client/command
• Core Layer
• client/core (session, plugin loaders: Lua, Yaegi)
• REPL Layer
• client/repl (console, login, plugin integration)
• gRPC/Stubs
• helper/proto/clientpb and rootpb
b. Server Application
• gRPC API Layer
• server/rpc (RPC service definitions and gRPC server)
• HTTP/Web UI Layer
• server/assets + embedded web UI
• Listener Modules (C2 channels)
• TCP, HTTP, REM, Website (server/listener)
• Core Orchestration
• server/internal/core (session, pipeline, tasks, event bus)
• Build Service
• server/internal/build (artifact generation, GitHub integration)
• Parser & Stream
• server/internal/parser (malefic, pulse)
• server/internal/stream (AES, XOR, compression)
• Cert & Security
• server/internal/certutils, helper/utils/mtls
• Configuration
• server/configs, YAML files, environment
• Data Layer
• SQLite via server/internal/db (models, SQL helper)
c. Shared Libraries
• helper/cryptography (implant signing, TLS keying)
• helper/encoders (base32/58/64, gzip, traffic encoder)
• helper/utils (fileutils, output formatting, peek)
• external/* (console, gonut, readline) as third-party dependencies
Relationships and data flows
• Client ⇄ Server
• gRPC calls over mTLS (helper/utils/mtls)
• Optional HTTP(S) calls for web UI assets
• Server ⇄ Database
• CRUD operations via internal/db/sqlite.go
• Server ⇄ Listeners ⇄ Implants
• C2 channel registration, inbound/outbound pipelines
• Build Service ⇄ GitHub/Goreleaser
• Artifact assembly and distribution
• Shared Libraries
• Imported by both client and server code
Architectural patterns & design principles
• Layered Architecture (UI → Command → Core → Data)
• Modular Listener Plugins (each C2 channel implements a common interface)
• RPC-first design (all operations exposed via gRPC services)
• Pluggable scripting (Lua, Yaegi) in client side
• Embedded assets (Go’s embed for UI, certs, plugins)
• Single binary deployments (client and server compile all modules in one)