2022-02-25 04:13:05 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "sclient.h"
|
|
|
|
#include "sterm.h"
|
|
|
|
|
2022-03-21 22:47:46 +00:00
|
|
|
#define STRING(x) #x
|
|
|
|
#define MACROLITSTR(x) STRING(x)
|
|
|
|
|
2022-03-22 00:47:18 +00:00
|
|
|
const char *LOGO = "\n\t██╗ █████╗ ██╗██╗ ██╗ █████╗\n\t██║ ██╔══██╗██║██║ ██╔╝██╔══██╗\n\t██║ ███████║██║█████╔╝ ███████║\n\t██║ ██╔══██║██║██╔═██╗ ██╔══██║\n\t███████╗██║ ██║██║██║ ██╗██║ ██║\n\t╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝";
|
2022-03-21 22:47:46 +00:00
|
|
|
|
2022-02-25 04:13:05 +00:00
|
|
|
int main(int argv, char *argc[]) {
|
|
|
|
tShell_client client;
|
|
|
|
bool printPrompt = false;
|
|
|
|
|
2022-03-21 22:47:46 +00:00
|
|
|
shellT_printf("%s%s\n%s", shellT_getForeColor(TERM_BRIGHT_RED), LOGO, shellT_getForeColor(TERM_BRIGHT_WHITE));
|
2022-03-22 00:47:18 +00:00
|
|
|
shellT_printf("\t\t\t%s\n\n", " v" MACROLITSTR(LAIKA_VERSION_MAJOR) "." MACROLITSTR(LAIKA_VERSION_MINOR));
|
2022-03-21 22:47:46 +00:00
|
|
|
|
2022-02-25 04:13:05 +00:00
|
|
|
shellC_init(&client);
|
|
|
|
shellC_connectToCNC(&client, "127.0.0.1", "13337");
|
|
|
|
|
|
|
|
shellT_conioTerm();
|
|
|
|
while(laikaS_isAlive((&client.peer->sock))) {
|
|
|
|
/* poll for 50ms */
|
|
|
|
if (!shellC_poll(&client, 50)) {
|
|
|
|
/* check if we have input! */
|
|
|
|
if (shellT_waitForInput(0))
|
|
|
|
shellT_addChar(&client, shellT_kbget());
|
|
|
|
|
|
|
|
/* no prompt shown? show it */
|
|
|
|
if (!printPrompt) {
|
|
|
|
printPrompt = true;
|
|
|
|
|
|
|
|
shellT_printPrompt();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
printPrompt = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
shellC_cleanup(&client);
|
2022-03-22 14:50:22 +00:00
|
|
|
PRINTERROR("Connection closed\n");
|
2022-02-25 04:13:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|