diff --git a/bfsk.o b/bfsk.o new file mode 100644 index 0000000..8a26e2b Binary files /dev/null and b/bfsk.o differ diff --git a/cerberus b/cerberus new file mode 100755 index 0000000..f8e04db Binary files /dev/null and b/cerberus differ diff --git a/cli.cpp b/cli.cpp index 81e577c..d1bc551 100644 --- a/cli.cpp +++ b/cli.cpp @@ -5,11 +5,16 @@ #include #include #include +#include +#include #include "libs/linenoise.h" +#define CLR_RESET "\x1b[0m" +#define CLR_CYAN "\x1b[36m" + static void completionCallback(const char *input, linenoiseCompletions *completions) { - if (strncmp(input, "ni", 2) == 0) { + if (strncmp(input, "nick", 4) == 0) { linenoiseAddCompletion(completions, "nick set "); linenoiseAddCompletion(completions, "nick generatekey"); } @@ -38,7 +43,7 @@ void runCLI(AppConfig &config) { << " exit\n\n" CLR_RESET; while (true) { - char *line = linenoise(CLR_BOLD ">_ " CLR_RESET); + char *line = linenoise(CLR_CYAN ">_ " CLR_RESET); if (!line) { std::cout << "\n[cli] EOF/Ctrl+C - выходим.\n"; break; diff --git a/cli.o b/cli.o new file mode 100644 index 0000000..b88d378 Binary files /dev/null and b/cli.o differ diff --git a/commands.o b/commands.o new file mode 100644 index 0000000..8f7a2c3 Binary files /dev/null and b/commands.o differ diff --git a/history.txt b/history.txt index bc1f6e7..9198e9f 100644 --- a/history.txt +++ b/history.txt @@ -4,3 +4,12 @@ nick set platon nick generatekey web start web connect pm localhost +web start +web stop +exit +nick set platon +nick generatekey +web find +web find +sound find +exit diff --git a/libs/linenoise.o b/libs/linenoise.o new file mode 100644 index 0000000..478a7c5 Binary files /dev/null and b/libs/linenoise.o differ diff --git a/libs/monocypher.o b/libs/monocypher.o new file mode 100644 index 0000000..b4277ee Binary files /dev/null and b/libs/monocypher.o differ diff --git a/main.o b/main.o new file mode 100644 index 0000000..b83f800 Binary files /dev/null and b/main.o differ diff --git a/sound.o b/sound.o new file mode 100644 index 0000000..b3a6902 Binary files /dev/null and b/sound.o differ diff --git a/webserver.o b/webserver.o new file mode 100644 index 0000000..a2420d3 Binary files /dev/null and b/webserver.o differ diff --git a/x25519_handshake.cpp b/x25519_handshake.cpp index bf87348..2306eb1 100644 --- a/x25519_handshake.cpp +++ b/x25519_handshake.cpp @@ -1,34 +1,38 @@ #include "x25519_handshake.hpp" #include "config.hpp" -extern "C" { -#include "libs/monocypher.h" -} - -#include -#include +#include // Для std::memcpy и std::memset #include +// Подключаем Monocypher +extern "C" { +#include "monocypher.h" +} + void x25519GenerateEphemeral(AppConfig &config) { FILE* f = fopen("/dev/urandom", "rb"); if (!f) { - std::cerr << "[x25519] Не удалось открыть /dev/urandom\n"; + std::cerr << CLR_RED "[x25519] Не удалось открыть /dev/urandom\n" CLR_RESET; return; } - fread(config.ephemeralSec, 1, 32, f); + size_t read = fread(config.ephemeralSec, 1, 32, f); fclose(f); + if (read != 32) { + std::cerr << CLR_RED "[x25519] Не удалось прочитать 32 байта из /dev/urandom\n" CLR_RESET; + return; + } crypto_x25519_public_key(config.ephemeralPub, config.ephemeralSec); - memset(config.sharedSecret, 0, 32); + std::memset(config.sharedSecret, 0, 32); config.haveSharedSecret = false; } void x25519ComputeShared(AppConfig &config, const uint8_t otherPub[32]) { uint8_t shared[32]; crypto_x25519(shared, config.ephemeralSec, otherPub); - memcpy(config.sharedSecret, shared, 32); + std::memcpy(config.sharedSecret, shared, 32); config.haveSharedSecret = true; - std::cout << "[x25519] Получен общий сеансовый ключ (32 байта).\n"; + std::cout << CLR_GREEN "[x25519] Общий сеансовый ключ вычислен!\n" CLR_RESET; } diff --git a/x25519_handshake.o b/x25519_handshake.o new file mode 100644 index 0000000..996b2c1 Binary files /dev/null and b/x25519_handshake.o differ