From b2b720c597fd61ca5da3e410d355ca101bb9a218 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 22 Apr 2022 18:40:03 +0200 Subject: [PATCH] implemented misc --- src/encrypter.c | 49 ++----------------------------------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/src/encrypter.c b/src/encrypter.c index a675347..2e0d43a 100644 --- a/src/encrypter.c +++ b/src/encrypter.c @@ -5,60 +5,15 @@ #include #include #include -#include - -#include -#include #include "../include/flags.h" +#include "../include/misc.h" char* encryptText(char *text, char *keyNew) { //CHECK FOR ACTIVE VERSION - - //CURL VARIABLES - CURL *curl = curl_easy_init(); - FILE *fileBuffer = fopen(VERSIONS_NAME, "w"); - - //GET versions.json - curl_easy_setopt(curl, CURLOPT_URL, VERSIONS_URL); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, fileBuffer); - - //DOWNLOAD versions.json - curl_easy_perform(curl); - - //CLEANUP - curl_easy_cleanup(curl); - fclose(fileBuffer); - - //JSON VARIABLES - fileBuffer = fopen(VERSIONS_NAME, "r"); - char buffer[256]; - char lineBuffer[64]; - struct json_object *parsedJson; - struct json_object *active; - - //LOAD jsonFile - while (fgets(lineBuffer, sizeof(lineBuffer), fileBuffer) != NULL) - { - strcat(buffer, lineBuffer); - } - - //CLEANUP - fclose(fileBuffer); - - //GET - parsedJson = json_tokener_parse(buffer); - json_object_object_get_ex(parsedJson, "active", &active); - - if (strcmp(VERSION, json_object_get_string(active)) != 0) - { - fprintf(stderr, "Your version isn't latest! This release could be unsafe!\n"); - - //WAIT FOR 5 SECONDS - sleep(5); - } + checkVersion(); srand(time(0)); //TRY TO MAKE RANDOM GENERATION REALLY "RANDOM"