remove VS sln
This commit is contained in:
37
include/Buffer.h
Normal file
37
include/Buffer.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class Buffer
|
||||
{
|
||||
public:
|
||||
uint8_t* buffer = nullptr;
|
||||
size_t taken = 0;
|
||||
size_t size = 0;
|
||||
std::string file_path;
|
||||
|
||||
Buffer(size_t size);
|
||||
Buffer();
|
||||
~Buffer();
|
||||
bool resize(size_t new_size);
|
||||
int add_end(uint8_t* data, size_t data_size);
|
||||
int add_middle(uint8_t* data, size_t data_size, size_t index);
|
||||
|
||||
// Removes data from buffer without checking if it's in the buffer
|
||||
void remove_fast(uint8_t* data, size_t data_size);
|
||||
|
||||
void remove(size_t index, size_t data_size);
|
||||
|
||||
size_t find(uint8_t* data, size_t data_size);
|
||||
|
||||
void remove(uint8_t* data, size_t data_size);
|
||||
|
||||
void clear() { taken = 0; }
|
||||
|
||||
bool save_to_file();
|
||||
bool save_to_file(std::string file_path);
|
||||
|
||||
bool load_from_file();
|
||||
bool load_from_file(std::string file_path);
|
||||
|
||||
};
|
45
include/arg_func.h
Normal file
45
include/arg_func.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
struct LoginInfoPointer;
|
||||
class Buffer;
|
||||
class Cryptography;
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
enum class Arg
|
||||
{
|
||||
Get, // get password for label
|
||||
Generate, // generate password for label
|
||||
List, // list all labels
|
||||
Delete, // delete password for label
|
||||
Print_all_p, // print all passwords
|
||||
Input, // input password for label
|
||||
Change, // change main password
|
||||
Show, // show password for label
|
||||
Error, // error
|
||||
Username, // update username
|
||||
Name, // update label name
|
||||
File, // select save file
|
||||
};
|
||||
|
||||
Arg get_args(int argc, char** argv, char** label);
|
||||
|
||||
std::optional<LoginInfoPointer> arg_get(Buffer& decrypted_buffer, const char* label);
|
||||
|
||||
std::optional<LoginInfoPointer> arg_new_password(Buffer& decrypted_buffer, Buffer& encrypted_buffer, const char* label, Cryptography& crypto, bool generate);
|
||||
|
||||
void arg_username(Buffer& decrypted_buffer, Buffer& encrypted_buffer, const char* label, Cryptography& crypto);
|
||||
|
||||
void arg_label_name(Buffer& decrypted_buffer, Buffer& encrypted_buffer, const char* label, Cryptography& crypto);
|
||||
|
||||
void arg_list(Buffer& decrypted_buffer);
|
||||
|
||||
void arg_delete(Buffer& decrypted_buffer, Buffer& encrypted_buffer, const char* label, Cryptography& crypto);
|
||||
|
||||
void arg_print_all_p(Buffer& decrypted_buffer, std::string& user_pass);
|
||||
|
||||
void arg_change(Buffer& decrypted_buffer, Buffer& encrypted_buffer, std::string& user_pass, Cryptography& crypto);
|
||||
|
||||
void arg_show(Buffer& decrypted_buffer, const char* label);
|
||||
|
||||
void arg_file(Buffer& decrypted_buffer, Buffer& encrypted_buffer, const char* label, Cryptography& crypto, std::string& save_location_path);
|
23
include/cryptography.h
Normal file
23
include/cryptography.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
struct evp_cipher_ctx_st;
|
||||
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
|
||||
|
||||
class Buffer;
|
||||
|
||||
class Cryptography
|
||||
{
|
||||
public:
|
||||
Cryptography(const char* password, size_t size);
|
||||
~Cryptography();
|
||||
bool encrypt(Buffer* plain, Buffer* encrypted);
|
||||
bool decrypt(Buffer* encrypted, Buffer* decrypted);
|
||||
bool generate_key_and_iv_from_password(const char* password, size_t size);
|
||||
|
||||
private:
|
||||
uint8_t key[32] = { 0 };
|
||||
uint8_t iv[16] = { 0 };
|
||||
EVP_CIPHER_CTX* ctx = nullptr;
|
||||
bool handleErrors();
|
||||
};
|
35
include/func.h
Normal file
35
include/func.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Buffer;
|
||||
|
||||
struct LoginInfo
|
||||
{
|
||||
uint32_t label;
|
||||
uint32_t username;
|
||||
uint32_t password;
|
||||
};
|
||||
|
||||
struct LoginInfoPointer
|
||||
{
|
||||
const char* label;
|
||||
const char* username;
|
||||
const char* password;
|
||||
};
|
||||
|
||||
struct Index
|
||||
{
|
||||
uint32_t count;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
int find_logininfo_in_buffer(Buffer& buffer, const char* label);
|
||||
|
||||
void delete_logininfo_from_buffer(Buffer& buffer, int index_of_pass);
|
||||
|
||||
void add_logininfo_to_buffer(Buffer& buffer, const char* label, const char* username, const char* password);
|
||||
|
||||
LoginInfoPointer get_logininfo_pointer_from_buffer(Buffer& buffer, int index_of_pass);
|
||||
|
||||
void generate_password(std::string& password, int len);
|
||||
|
13
include/glob.h
Normal file
13
include/glob.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
enum class Glob_Result {
|
||||
OOM_ERROR,
|
||||
ENCODING_ERROR,
|
||||
SYNTAX_ERROR,
|
||||
UNMATCHED,
|
||||
MATCHED,
|
||||
};
|
||||
|
||||
// https://github.com/tsoding/glob.h
|
||||
Glob_Result glob(const char* pattern, const char* text);
|
6
include/win.h
Normal file
6
include/win.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include <optional>
|
||||
|
||||
bool put_data_on_clipboard(const char* text);
|
||||
std::string get_user_password();
|
||||
std::optional<std::string> get_save_path();
|
Reference in New Issue
Block a user