mirror of
https://github.com/lucaspalomodevelop/autom.git
synced 2026-03-12 23:27:21 +00:00
add cryptopp lib
This commit is contained in:
parent
b110973917
commit
3570ecefe2
1
libs/cryptopp
Submodule
1
libs/cryptopp
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit af7d1050bf2287072edd629be133da458a3cf978
|
||||||
23
src/main.cpp
23
src/main.cpp
@ -111,12 +111,18 @@ void runScript(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// encrypt a script in the autom directory
|
// encrypt a script in the autom directory
|
||||||
|
std::string encrypt(std::string content, std::string pass)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void encryptScript(int argc, char *argv[])
|
void encryptScript(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
std::string password = "";
|
std::string password = "";
|
||||||
std::string password2 = "";
|
std::string password2 = "";
|
||||||
std::string script = home_dir + "/" + argv[1];
|
std::string script = home_dir + "/" + argv[1];
|
||||||
|
std::string scriptContent = "";
|
||||||
|
std::string encryptScriptContent = "CRYPT;AES256\n";
|
||||||
std::cout << "encrypting file " << script << std::endl;
|
std::cout << "encrypting file " << script << std::endl;
|
||||||
std::cout << "Enter password: ";
|
std::cout << "Enter password: ";
|
||||||
password = EnterPassword();
|
password = EnterPassword();
|
||||||
@ -140,9 +146,24 @@ void encryptScript(int argc, char *argv[])
|
|||||||
std::cout << "Script " << argv[1] << " does not exist" << std::endl;
|
std::cout << "Script " << argv[1] << " does not exist" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::fstream file(script);
|
||||||
|
std::string line;
|
||||||
|
while (getline(file, line))
|
||||||
|
{
|
||||||
|
scriptContent += line + "\n";
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
encryptScriptContent += encrypt(scriptContent, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
// encrypt a script in the autom directory
|
// encrypt a script in the autom directory
|
||||||
|
|
||||||
|
std::string decrypt(std::string content, std::string pass)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void decryptScript(int argc, char *argv[])
|
void decryptScript(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
std::cout << "decrypting file " << argv[1] << std::endl;
|
std::cout << "decrypting file " << argv[1] << std::endl;
|
||||||
|
|||||||
@ -10,6 +10,13 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
|
||||||
|
#include "../libs/cryptopp/cryptlib.h"
|
||||||
|
#include "../libs/cryptopp/rijndael.h"
|
||||||
|
#include "../libs/cryptopp/modes.h"
|
||||||
|
#include "../libs/cryptopp/files.h"
|
||||||
|
#include "../libs/cryptopp/osrng.h"
|
||||||
|
#include "../libs/cryptopp/hex.h"
|
||||||
|
|
||||||
#include "inputparser.h"
|
#include "inputparser.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -35,8 +42,10 @@ void removeScript(int argc, char *argv[]);
|
|||||||
// show a script in the autom directory
|
// show a script in the autom directory
|
||||||
void showScript(int argc, char *argv[]);
|
void showScript(int argc, char *argv[]);
|
||||||
// encrypt a script in the autom directory
|
// encrypt a script in the autom directory
|
||||||
|
std::string encrypt(std::string content, std::string pass);
|
||||||
void encryptScript(int argc, char *argv[]);
|
void encryptScript(int argc, char *argv[]);
|
||||||
// decrypt a script in the autom directory
|
// decrypt a script in the autom directory
|
||||||
|
std::string decrypt(std::string content, std::string pass);
|
||||||
void decryptScript(int argc, char *argv[]);
|
void decryptScript(int argc, char *argv[]);
|
||||||
|
|
||||||
std::string EnterPassword();
|
std::string EnterPassword();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user