diff options
author | Malfurious <m@lfurio.us> | 2024-10-24 13:06:13 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-10-25 03:31:18 -0400 |
commit | 8455d3e9256bff8d4f74b3606347522ea6c381ca (patch) | |
tree | 80660a9a058033f475c49cc71c4f18ae7cca14ac | |
parent | 6285b4d8b283fb38112ec04b1cc570a8c0c9844b (diff) | |
download | compass-8455d3e9256bff8d4f74b3606347522ea6c381ca.tar.gz compass-8455d3e9256bff8d4f74b3606347522ea6c381ca.zip |
Remove remote-host and port options
Support for remote keychains is removed, so also remove the associated
command-line options.
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r-- | Compass.cpp | 20 | ||||
-rw-r--r-- | Cryptor.cpp | 4 | ||||
-rw-r--r-- | Cryptor.h | 4 | ||||
-rw-r--r-- | Help.cpp | 4 | ||||
-rw-r--r-- | Keychain.cpp | 15 | ||||
-rw-r--r-- | Keychain.h | 6 | ||||
-rw-r--r-- | Options.cpp | 32 | ||||
-rw-r--r-- | Options.h | 2 |
8 files changed, 23 insertions, 64 deletions
diff --git a/Compass.cpp b/Compass.cpp index 9a27d55..dd0bbaf 100644 --- a/Compass.cpp +++ b/Compass.cpp @@ -215,7 +215,7 @@ void Compass::initialize() { }
void Compass::create(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
Credential c;
if (opt.user != "" && opt.pass != "")
@@ -238,13 +238,13 @@ void Compass::create(std::string service) { }
void Compass::walk() {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
kc->walk();
delete kc;
}
void Compass::rekey() {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
Cryptor::rekey();
std::cout << "Enter a new master password for your keychain... (CTRL-C to abort)" << std::endl;
@@ -253,7 +253,7 @@ void Compass::rekey() { }
void Compass::get(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
Credential c;
if (opt.cn != -1)
@@ -278,7 +278,7 @@ void Compass::get(std::string service) { }
void Compass::_delete(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
bool b;
if (opt.cn != -1)
@@ -300,7 +300,7 @@ void Compass::_delete(std::string service) { }
void Compass::show(std::string service, bool like) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
if (service == "")
kc->show();
@@ -319,7 +319,7 @@ void Compass::random() { }
void Compass::markReset(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
int i;
if (service == "")
@@ -335,7 +335,7 @@ void Compass::markReset(std::string service) { }
void Compass::checkReset(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
int i;
if (service == "")
@@ -349,7 +349,7 @@ void Compass::checkReset(std::string service) { }
void Compass::ruser(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
Credential c;
if (opt.user == "") {
@@ -376,7 +376,7 @@ void Compass::ruser(std::string service) { }
void Compass::rpass(std::string service) {
- Keychain* kc = Keychain::loadKeychain(opt.rh, opt.pt, opt.dr);
+ Keychain* kc = Keychain::loadKeychain(opt.dr);
Credential c;
if (opt.pass == "") {
diff --git a/Cryptor.cpp b/Cryptor.cpp index 1cce31e..0d2dd71 100644 --- a/Cryptor.cpp +++ b/Cryptor.cpp @@ -25,7 +25,7 @@ static void fromHex(void *output, const char *input) { }
}
-void Cryptor::encryptAndSave(std::string remoteHost, std::string port, std::string directory, std::string payload) {
+void Cryptor::encryptAndSave(std::string directory, std::string payload) {
// Key
if (!haveKey) {
assembleKey(true);
@@ -71,7 +71,7 @@ void Cryptor::encryptAndSave(std::string remoteHost, std::string port, std::stri f.close();
}
-std::string Cryptor::loadAndDecrypt(std::string remoteHost, std::string port, std::string directory) {
+std::string Cryptor::loadAndDecrypt(std::string directory) {
// Load Data
std::string encIV, encCipher;
@@ -42,8 +42,8 @@ struct PasswordSpec { class Cryptor {
public:
- static void encryptAndSave(std::string remoteHost, std::string port, std::string directory, std::string payload);
- static std::string loadAndDecrypt(std::string remoteHost, std::string port, std::string directory);
+ static void encryptAndSave(std::string directory, std::string payload);
+ static std::string loadAndDecrypt(std::string directory);
static std::string createRandomPassword(PasswordSpec spec);
static void rekey();
@@ -52,9 +52,7 @@ void Help::dispGeneral() { std::cout << "-user <username> Used to disambiguate credentials if lookups return more than one" << std::endl;
std::cout << " Also used to specify a username value for new or updated credentials" << std::endl;
std::cout << "-pass <password> Used to specify a password value for new or updated credentials" << std::endl;
- std::cout << "-rh <address> Used to specify a remote host to connect to if keychain is on another machine" << std::endl;
- std::cout << "-pt <port> Port on remote host to connect to" << std::endl;
- std::cout << "-dr <path> Directory to look for, or put, keychain in. If -rh is set, this refers to the remote machine" << std::endl;
+ std::cout << "-dr <path> Directory to look for, or put, keychain in" << std::endl;
std::cout << "-cn <number> Used to disambiguate credentials if lookups return more than one" << std::endl;
std::cout << "-ml <length> Password Gen Option: max-length for generated string" << std::endl;
std::cout << "-ns Password Gen Option: set this if no special chars should be used" << std::endl;
diff --git a/Keychain.cpp b/Keychain.cpp index 8e017eb..8f0880d 100644 --- a/Keychain.cpp +++ b/Keychain.cpp @@ -1,8 +1,6 @@ #include "Keychain.h"
-Keychain::Keychain(std::string remoteHost, std::string port, std::string directory) {
- this->remoteHost = remoteHost;
- this->port = port;
+Keychain::Keychain(std::string directory) {
this->directory = directory;
}
@@ -10,15 +8,14 @@ Keychain::~Keychain() { }
Keychain* Keychain::newKeychain(std::string directory) {
- Keychain* kc = new Keychain("", "", directory);
- return kc;
+ return new Keychain(directory);
}
-Keychain* Keychain::loadKeychain(std::string remoteHost, std::string port, std::string directory) {
- std::string data = Cryptor::loadAndDecrypt(remoteHost, port, directory);
+Keychain* Keychain::loadKeychain(std::string directory) {
+ std::string data = Cryptor::loadAndDecrypt(directory);
std::istringstream datstr(data);
- Keychain* kc = new Keychain(remoteHost, port, directory);
+ Keychain* kc = new Keychain(directory);
int kcSize, servSize;
datstr >> kcSize;
@@ -86,7 +83,7 @@ void Keychain::saveKeychain() { }
}
- Cryptor::encryptAndSave(remoteHost, port, directory, datstr.str());
+ Cryptor::encryptAndSave(directory, datstr.str());
}
void Keychain::walk() { // Don't call this, it's just for debuging purposes and prints out plaintext passwords!
@@ -23,12 +23,12 @@ struct Credential { class Keychain {
public:
// Structors
- Keychain(std::string remoteHost, std::string port, std::string directory);
+ Keychain(std::string directory);
virtual ~Keychain();
// Open/close
static Keychain* newKeychain(std::string directory);
- static Keychain* loadKeychain(std::string remoteHost, std::string port, std::string directory);
+ static Keychain* loadKeychain(std::string directory);
void saveKeychain();
// Info/Debug
@@ -80,8 +80,6 @@ public: private:
std::map<std::string, std::vector<Credential> > credentials; // map from service name (string) onto list of credentials for that service (vector<Credential>)
- std::string remoteHost;
- std::string port;
std::string directory;
// Reset Credentials
diff --git a/Options.cpp b/Options.cpp index 34b1e66..acfb803 100644 --- a/Options.cpp +++ b/Options.cpp @@ -7,8 +7,6 @@ Options::Options() { user = "";
pass = "";
- rh = "";
- pt = "3041";
dr = cwd;
cn = -1;
ml = DEF_PASSWD_LENGTH;
@@ -39,7 +37,6 @@ void Options::checkString(std::string str) { }
void Options::parseArgv(int start, int argc, char* argv[]) {
- bool setPort = false;
bool setGenMod = false;
std::vector<std::string> args = loadOptionsFile(start, argc, argv);
@@ -71,29 +68,6 @@ void Options::parseArgv(int start, int argc, char* argv[]) { checkString(pass);
}
- else if (opt == "-rh") {
- i++;
- if (i >= args.size()) {
- std::cerr << "Warning: remote-host: value is missing." << std::endl;
- i--;
- continue;
- }
- rh = std::string(args[i]);
- checkString(rh);
- }
-
- else if (opt == "-pt") {
- i++;
- if (i >= args.size()) {
- std::cerr << "Warning: port: value is missing." << std::endl;
- i--;
- continue;
- }
- pt = std::string(args[i]);
- checkString(pt);
- setPort = true;
- }
-
else if (opt == "-dr") {
i++;
if (i >= args.size()) {
@@ -180,12 +154,6 @@ void Options::parseArgv(int start, int argc, char* argv[]) { std::cerr << "Notice: unrecognized option: " << opt << std::endl;
}
- if (rh != "")
- std::cout << "Notice: using remote-host: " << rh << std::endl;
-
- if (setPort && rh == "")
- std::cerr << "Notice: setting remote port without setting remote host." << std::endl;
-
if (setGenMod && pass != "")
std::cerr << "Notice: setting generator modifiers and explicitly setting a password. Explicit password takes precedence." << std::endl;
}
@@ -24,8 +24,6 @@ public: // Options
std::string user;
std::string pass;
- std::string rh; // remote host
- std::string pt; // TCP port
std::string dr; // directory
int cn; // credential number
int ml; // max length
|