2022-12-04 18:54:57 +01:00
|
|
|
/*
|
|
|
|
This is part of WHY2
|
|
|
|
Copyright (C) 2022 Václav Šmejkal
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-03-20 18:12:25 +01:00
|
|
|
#ifndef WHY2_FLAGS_H
|
|
|
|
#define WHY2_FLAGS_H
|
|
|
|
|
2022-05-02 18:01:12 +02:00
|
|
|
//CONSTS
|
2022-07-31 15:51:54 +02:00
|
|
|
const enum EXIT_CODES //exit codes you fucking idiot
|
|
|
|
{
|
|
|
|
SUCCESS = 0, //EXIT CODE FOR SUCCESSFUL RUN
|
|
|
|
INVALID_KEY = 1, //EXIT VALUE FOR INVALID KEY
|
|
|
|
INVALID_TEXT = 4, //EXIT VALUE FOR INVALID TEXT
|
|
|
|
DOWNLOAD_FAILED = 2, //EXIT VALUE FOR versions.json DOWNLOAD FAILED
|
|
|
|
UPDATE_FAILED = 3 //EXIT VALUE FOR UPDATE FAILED
|
|
|
|
};
|
2022-03-20 18:12:25 +01:00
|
|
|
|
2022-08-25 12:38:49 +02:00
|
|
|
#define VERSION "v4.3.2" //VERSION OF CURRENT BUILD > DO NOT TOUCH THIS <
|
2022-06-11 16:22:44 +02:00
|
|
|
#define VERSIONS_URL "https://raw.githubusercontent.com/ENGO150/WHY2/release/versions.json" //URL FOR GETTING versions.json
|
2022-05-31 19:39:59 +02:00
|
|
|
#define VERSIONS_NAME "/tmp/why2-versions.json" //do I have to explain this?
|
2022-04-04 18:07:42 +02:00
|
|
|
|
2022-06-11 17:04:15 +02:00
|
|
|
#define UPDATE_URL "https://github.com/ENGO150/WHY2.git" // REPOSITORY URL FOR UPDATES (YOU DON'T SAY)
|
|
|
|
#define UPDATE_NAME "/tmp/why2-update" // fuck you
|
2022-06-11 18:54:34 +02:00
|
|
|
#define UPDATE_COMMAND "tmux new-session -d \"cd {DIR} && make install\""
|
2022-06-11 17:04:15 +02:00
|
|
|
|
2022-07-23 15:47:47 +02:00
|
|
|
#define TEST_TEXT "aAzZ( )!?#\\/śŠ <3|420*;㍿㊓ㅅΔ♛👶🏿" //TEST TEXT FOR ENCRYPTION IN why2-test BINARY
|
2022-05-05 18:26:10 +02:00
|
|
|
|
|
|
|
#define TEXT_TO_ENCRYPT "Some text yk" //THIS TEXT WILL BE ENCRYPTED IN why2-app BINARY
|
|
|
|
|
|
|
|
#define CLEAR_SCREEN "\e[1;1H\e[2J" //TEXT FOR UNIX CLEAR SCREEN
|
|
|
|
|
2022-08-25 12:02:16 +02:00
|
|
|
#define CURL_TIMEOUT 3 //if you need comment explaining, what the fuck is timeout, don't change WHY2's code, alright? thx, love ya
|
2022-05-05 18:26:10 +02:00
|
|
|
#define NOT_FOUND_TRIES 10 //NUMBER OF TRIES FOR DOWNLOADING versions.json
|
|
|
|
|
2022-05-21 18:37:24 +02:00
|
|
|
#define DEPRECATED __attribute__((deprecated)) //SAME COMMENT AS VERSIONS_NAME'S
|
2022-06-19 17:15:23 +02:00
|
|
|
#define UNUSED __attribute__((unused)) //SAME COMMENT AS DEPRECATED'S
|
2022-05-05 18:38:30 +02:00
|
|
|
|
2022-10-17 16:41:04 +02:00
|
|
|
//TYPES
|
2023-01-27 16:03:01 +01:00
|
|
|
typedef char why2_bool; //READ THE NAME OR I WILL FIND YOU AND FUCK YOUR MOTHERFUCKING DOG!!!
|
2022-10-17 16:49:05 +02:00
|
|
|
typedef int (*encryptionOperation_type_cb)(int, int); //TYPE FOR encryptionOperation CALLBACK
|
2022-05-25 17:27:26 +02:00
|
|
|
typedef struct
|
2022-05-05 18:50:45 +02:00
|
|
|
{
|
2023-01-27 16:03:01 +01:00
|
|
|
why2_bool noCheck; //BOOLEAN FOR SKIPPING VERSION CHECK
|
|
|
|
why2_bool noOutput; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING
|
|
|
|
why2_bool update; //BOOLEAN FOR UPDATING YOUR WHY VERSION IF OLD IS USED
|
2022-05-05 19:03:53 +02:00
|
|
|
} inputFlags;
|
|
|
|
|
2022-05-25 17:27:26 +02:00
|
|
|
typedef struct
|
2022-05-05 19:03:53 +02:00
|
|
|
{
|
2022-05-06 18:14:45 +02:00
|
|
|
char *outputText; //VARIABLE FOR ENCRYPTED/DECRYPTED TEXT
|
|
|
|
char *usedKey; //VARIABLE FOR USED/GENERATED KEY
|
2022-05-30 19:09:47 +02:00
|
|
|
unsigned long unusedKeySize; //VARIABLE FOR COUNT OF UNUSED CHARACTERS IN KEY
|
2022-08-24 14:51:17 +02:00
|
|
|
unsigned long repeatedKeySize; //VARIABLE FOR COUNT OF REPEATED CHARACTERS IN KEY (basically reversed unusedKeySize)
|
2022-05-30 19:09:47 +02:00
|
|
|
unsigned long elapsedTime; //VARIABLE FOR ELAPSED TIME IN MICROSECONDS => 1s = 1000000µs
|
2023-01-27 16:03:01 +01:00
|
|
|
why2_bool exitCode; //VARIABLE FOR EXIT CODE
|
2022-05-06 17:43:00 +02:00
|
|
|
} outputFlags;
|
2022-05-05 18:50:45 +02:00
|
|
|
|
2022-07-01 18:45:44 +02:00
|
|
|
//NOTE: Variables were moved to 'flags.c' to force y'all using getters
|
2022-05-04 18:42:30 +02:00
|
|
|
|
2022-05-04 19:21:31 +02:00
|
|
|
//GETTERS
|
2022-12-11 14:56:20 +01:00
|
|
|
char getEncryptionSeparator(void);
|
|
|
|
unsigned long getKeyLength(void);
|
|
|
|
inputFlags getDefaultFlags(void); //THIS GENERATES inputFlags WITH DEFAULT VALUES
|
|
|
|
inputFlags getFlags(void); //RETURNS USED FLAGS
|
2023-01-27 16:03:01 +01:00
|
|
|
outputFlags noOutput(why2_bool exitCode); //SAME AS getDefaultFlags() BUT FOR outputFlags
|
2022-12-11 14:56:20 +01:00
|
|
|
encryptionOperation_type_cb getEncryptionOperation(void); //RETURNS FUNCTION WHICH IS USED FOR ENCRYPTION & DECRYPTION
|
2023-01-27 16:03:01 +01:00
|
|
|
why2_bool getFlagsChanged(void);
|
2022-05-04 19:21:31 +02:00
|
|
|
|
|
|
|
//SETTERS
|
2022-06-18 18:28:33 +02:00
|
|
|
void setEncryptionSeparator(char encryptionSeparatorNew);
|
2022-05-04 19:21:31 +02:00
|
|
|
void setKeyLength(int keyLengthNew);
|
2022-07-10 18:07:21 +02:00
|
|
|
void setFlags(inputFlags newFlags); //.... whatcha think?
|
2022-10-17 16:53:26 +02:00
|
|
|
void setEncryptionOperation(encryptionOperation_type_cb newEncryptionOperation); //are you that dumb?
|
2022-05-04 18:42:30 +02:00
|
|
|
|
2022-04-07 17:26:41 +02:00
|
|
|
#endif
|