Skip to content

Commit 6513580

Browse files
committed
Initial release — Revelion daemon v0.2.0
Go daemon binary that bridges the Revelion cloud brain to local Docker containers for sandboxed pentesting tool execution. Includes: - WebSocket client with auto-reconnect - Docker container lifecycle management - Health reporting - Cross-platform install scripts (macOS/Linux/Windows) - GitHub Actions CI for automated releases
0 parents  commit 6513580

12 files changed

Lines changed: 2155 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build & Release Daemon
2+
3+
on:
4+
push:
5+
tags:
6+
- 'daemon-v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- goos: linux
18+
goarch: amd64
19+
suffix: linux-amd64
20+
- goos: linux
21+
goarch: arm64
22+
suffix: linux-arm64
23+
- goos: darwin
24+
goarch: amd64
25+
suffix: darwin-amd64
26+
- goos: darwin
27+
goarch: arm64
28+
suffix: darwin-arm64
29+
- goos: windows
30+
goarch: amd64
31+
suffix: windows-amd64.exe
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: actions/setup-go@v5
37+
with:
38+
go-version: '1.24'
39+
cache-dependency-path: go.sum
40+
41+
- name: Build
42+
env:
43+
GOOS: ${{ matrix.goos }}
44+
GOARCH: ${{ matrix.goarch }}
45+
CGO_ENABLED: '0'
46+
run: |
47+
VERSION=${GITHUB_REF_NAME#daemon-}
48+
go build -ldflags "-s -w -X main.Version=${VERSION}" \
49+
-o dist/revelion-${{ matrix.suffix }} \
50+
./cmd/daemon
51+
52+
- name: Upload artifact
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: revelion-${{ matrix.suffix }}
56+
path: dist/revelion-${{ matrix.suffix }}
57+
58+
release:
59+
needs: build
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/download-artifact@v4
63+
with:
64+
path: dist
65+
merge-multiple: true
66+
67+
- name: Create checksums
68+
working-directory: dist
69+
run: sha256sum revelion-* > checksums.txt
70+
71+
- name: Create Release
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
files: |
75+
dist/revelion-*
76+
dist/checksums.txt
77+
generate_release_notes: true
78+
draft: false
79+
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dist/
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
*.test
8+
*.out
9+
.DS_Store

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Revelion Daemon
2+
3+
The local execution layer for [Revelion](https://app.revelion.ai) — AI-powered penetration testing.
4+
5+
The daemon runs on your machine, connects to the Revelion cloud brain via WebSocket, and manages Docker containers for sandboxed tool execution.
6+
7+
## Quick Install
8+
9+
### macOS / Linux
10+
11+
```bash
12+
curl -fsSL https://raw.githubusercontent.com/RevelionAI/revelion-daemon/main/scripts/install.sh | sh -s -- YOUR_API_TOKEN
13+
```
14+
15+
### Windows (PowerShell)
16+
17+
```powershell
18+
$env:REVELION_TOKEN='YOUR_API_TOKEN'; irm https://raw.githubusercontent.com/RevelionAI/revelion-daemon/main/scripts/install.ps1 | iex
19+
```
20+
21+
Find your API token at [app.revelion.ai/agents](https://app.revelion.ai/agents).
22+
23+
## Prerequisites
24+
25+
- **Docker** — The daemon uses Docker to run scan tools in isolated containers
26+
- [Docker Desktop](https://docs.docker.com/desktop/) (macOS/Windows)
27+
- [Docker Engine](https://docs.docker.com/engine/install/) (Linux)
28+
29+
## Manual Installation
30+
31+
Download the latest binary from [Releases](https://github.com/RevelionAI/revelion-daemon/releases), then:
32+
33+
```bash
34+
# Authenticate
35+
revelion auth YOUR_API_TOKEN
36+
37+
# Start the daemon
38+
revelion start
39+
40+
# Check status
41+
revelion status
42+
```
43+
44+
## Commands
45+
46+
| Command | Description |
47+
|---|---|
48+
| `revelion auth <token>` | Save your API token |
49+
| `revelion start` | Start the daemon |
50+
| `revelion status` | Show configuration |
51+
| `revelion version` | Print version |
52+
53+
## How It Works
54+
55+
1. You start the daemon on your machine
56+
2. It connects to the Revelion brain via WebSocket
57+
3. When you launch a scan, the brain sends commands to your daemon
58+
4. The daemon spins up Docker containers and executes tools in a sandbox
59+
5. Results stream back to the brain for AI analysis
60+
61+
## License
62+
63+
Proprietary — see [Revelion Terms of Service](https://app.revelion.ai/terms).

cmd/daemon/main.go

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Revelion Daemon - bridges cloud brain to local Docker containers.
2+
//
3+
// Architecture (from build plan Section 4):
4+
// - WebSocket client with auto-reconnect (exponential backoff)
5+
// - Docker manager for container lifecycle
6+
// - Tool server proxy (forwards exec messages to container port 48081)
7+
// - Health reporter (system stats in pong messages)
8+
// - Backlog processor (catches up on missed commands after reconnect)
9+
package main
10+
11+
import (
12+
"fmt"
13+
"log"
14+
"os"
15+
"os/signal"
16+
"syscall"
17+
18+
"github.com/revelion/daemon/internal/config"
19+
dockermgr "github.com/revelion/daemon/internal/docker"
20+
"github.com/revelion/daemon/internal/health"
21+
"github.com/revelion/daemon/internal/ws"
22+
)
23+
24+
// Version is set at build time via -ldflags
25+
var Version = "dev"
26+
27+
func main() {
28+
if len(os.Args) < 2 {
29+
printUsage()
30+
os.Exit(1)
31+
}
32+
33+
switch os.Args[1] {
34+
case "auth":
35+
runAuth()
36+
case "start":
37+
runDaemon()
38+
case "status":
39+
runStatus()
40+
case "version":
41+
fmt.Printf("revelion-daemon %s\n", Version)
42+
default:
43+
printUsage()
44+
os.Exit(1)
45+
}
46+
}
47+
48+
func printUsage() {
49+
fmt.Printf(`Revelion Daemon %s - Local execution layer for Revelion pentesting platform
50+
51+
Usage:
52+
revelion auth <token> Authenticate with your API token
53+
revelion start Start the daemon
54+
revelion status Check daemon configuration
55+
revelion version Print version
56+
`, Version)
57+
}
58+
59+
func runAuth() {
60+
if len(os.Args) < 3 {
61+
fmt.Println("Usage: revelion auth <api-token>")
62+
fmt.Println("")
63+
fmt.Println("Find your API token at: https://revelion-ten.vercel.app/agents")
64+
os.Exit(1)
65+
}
66+
token := os.Args[2]
67+
68+
// Load existing config or use defaults
69+
cfg, err := config.Load()
70+
if err != nil {
71+
cfg = config.DefaultConfig()
72+
}
73+
cfg.APIToken = token
74+
75+
if err := config.Save(cfg); err != nil {
76+
log.Fatalf("Failed to save config: %v", err)
77+
}
78+
fmt.Println("Authenticated successfully. Run 'revelion start' to connect.")
79+
}
80+
81+
func runStatus() {
82+
cfg, err := config.Load()
83+
if err != nil {
84+
fmt.Println("Status: NOT CONFIGURED")
85+
fmt.Println("")
86+
fmt.Println("Run 'revelion auth <token>' to authenticate.")
87+
os.Exit(1)
88+
}
89+
90+
masked := cfg.APIToken
91+
if len(masked) > 8 {
92+
masked = masked[:4] + "..." + masked[len(masked)-4:]
93+
}
94+
95+
fmt.Println("Status: CONFIGURED")
96+
fmt.Printf(" Token: %s\n", masked)
97+
fmt.Printf(" Brain: %s\n", cfg.BrainURL)
98+
fmt.Printf(" Sandbox: %s\n", cfg.SandboxImage)
99+
fmt.Printf(" Config: ~/.revelion/config.json\n")
100+
}
101+
102+
func runDaemon() {
103+
cfg, err := config.Load()
104+
if err != nil {
105+
log.Fatalf("Config not found. Run 'revelion auth <token>' first: %v", err)
106+
}
107+
108+
docker := dockermgr.NewManager()
109+
reporter := health.NewReporter(docker)
110+
client := ws.NewClient(cfg, docker, reporter)
111+
112+
// Handle shutdown gracefully
113+
sigCh := make(chan os.Signal, 1)
114+
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
115+
116+
go func() {
117+
<-sigCh
118+
log.Println("Shutting down daemon...")
119+
client.Close()
120+
reporter.Stop()
121+
docker.CleanupAll()
122+
os.Exit(0)
123+
}()
124+
125+
log.Printf("Starting Revelion daemon %s...", Version)
126+
client.ConnectAndServe()
127+
}

go.mod

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module github.com/revelion/daemon
2+
3+
go 1.24.0
4+
5+
require (
6+
github.com/docker/docker v27.5.1+incompatible
7+
github.com/docker/go-connections v0.5.0
8+
github.com/gorilla/websocket v1.5.3
9+
github.com/shirou/gopsutil/v4 v4.25.1
10+
)
11+
12+
require (
13+
github.com/Microsoft/go-winio v0.6.2 // indirect
14+
github.com/containerd/log v0.1.0 // indirect
15+
github.com/distribution/reference v0.6.0 // indirect
16+
github.com/docker/go-units v0.5.0 // indirect
17+
github.com/ebitengine/purego v0.8.2 // indirect
18+
github.com/felixge/httpsnoop v1.0.4 // indirect
19+
github.com/go-logr/logr v1.4.2 // indirect
20+
github.com/go-logr/stdr v1.2.2 // indirect
21+
github.com/go-ole/go-ole v1.3.0 // indirect
22+
github.com/gogo/protobuf v1.3.2 // indirect
23+
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
24+
github.com/moby/docker-image-spec v1.3.1 // indirect
25+
github.com/moby/term v0.5.2 // indirect
26+
github.com/morikuni/aec v1.0.0 // indirect
27+
github.com/opencontainers/go-digest v1.0.0 // indirect
28+
github.com/opencontainers/image-spec v1.1.0 // indirect
29+
github.com/pkg/errors v0.9.1 // indirect
30+
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
31+
github.com/tklauser/go-sysconf v0.3.14 // indirect
32+
github.com/tklauser/numcpus v0.9.0 // indirect
33+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
34+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
35+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
36+
go.opentelemetry.io/otel v1.33.0 // indirect
37+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 // indirect
38+
go.opentelemetry.io/otel/metric v1.33.0 // indirect
39+
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
40+
go.opentelemetry.io/otel/trace v1.33.0 // indirect
41+
golang.org/x/sys v0.29.0 // indirect
42+
golang.org/x/time v0.14.0 // indirect
43+
gotest.tools/v3 v3.5.2 // indirect
44+
)

0 commit comments

Comments
 (0)