Redefined params and added key param

This commit is contained in:
x00010 2021-04-26 20:51:25 +01:00
parent f3ec28e559
commit f5dc57b994
1 changed files with 19 additions and 8 deletions

View File

@ -8,10 +8,11 @@ namespace po = boost::program_options;
void parseargs(int argc, char* argv[]) void parseargs(int argc, char* argv[])
{ {
std::string sIFile;
bool bInputHex = false; bool bInputHex = false;
std::string sOFile;
bool bOutputHex = false; bool bOutputHex = false;
std::string sInputFile; std::string sKey;
std::string sOutputFile;
po::options_description desc("Allowed options"); po::options_description desc("Allowed options");
desc.add_options() desc.add_options()
@ -20,6 +21,7 @@ void parseargs(int argc, char* argv[])
("ih", "Input data is in hex") ("ih", "Input data is in hex")
("of", po::value<std::string>(), "Specify an output file") ("of", po::value<std::string>(), "Specify an output file")
("oh", "Output data in hex") ("oh", "Output data in hex")
("k", po::value<std::string>(), "Specify a key")
; ;
/*po::positional_options_description p; /*po::positional_options_description p;
@ -36,9 +38,8 @@ void parseargs(int argc, char* argv[])
if (vm.count("if")) if (vm.count("if"))
{ {
std::string file = vm["if"].as<std::string>(); sIFile = vm["if"].as<std::string>();
std::string filecut = file.substr(1, file.length()); sIFile = sIFile.substr(1, sIFile.length());
std::cout << filecut;
} }
if (vm.count("ih")) if (vm.count("ih"))
@ -48,15 +49,25 @@ void parseargs(int argc, char* argv[])
if (vm.count("of")) if (vm.count("of"))
{ {
std::string file = vm["of"].as<std::string>(); sOFile = vm["of"].as<std::string>();
std::string filecut = file.substr(1, file.length()); sOFile = sOFile.substr(1, sOFile.length());
std::cout << filecut;
} }
if (vm.count("oh")) if (vm.count("oh"))
{ {
bool bOutputHex = true; bool bOutputHex = true;
} }
if (vm.count("k"))
{
sKey = vm["k"].as<std::string>();
}
else
{
std::cout << "A key must be specified";
exit(0);
}
} }
std::vector<char> xormessage(std::string sMessage, std::string sKey) std::vector<char> xormessage(std::string sMessage, std::string sKey)