summaryrefslogtreecommitdiffstats
path: root/Compass.h
diff options
context:
space:
mode:
Diffstat (limited to 'Compass.h')
-rw-r--r--Compass.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/Compass.h b/Compass.h
new file mode 100644
index 0000000..1cb9dcd
--- /dev/null
+++ b/Compass.h
@@ -0,0 +1,70 @@
+#ifndef COMPASS_H
+#define COMPASS_H
+
+#include <iostream>
+#include <string>
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <cstdlib>
+#include <unistd.h>
+#endif // WIN32
+
+#include "Options.h"
+#include "Keychain.h"
+#include "Cryptor.h"
+#include "Help.h"
+
+#define ALLOW_WALK 0
+#define SECONDS_PSWD_CLEANUP 30
+#define CLEAN_STRING "compass-cleared"
+
+#define WARN_CANT_CLEANUP "Warning: automatic clipboard cleanup failed to start."
+#define WARN_WONT_CLEANUP "Warning: automatic clipboard cleanup squelched"
+
+#define ERR_NO_ACTION "Error: no action specified."
+#define ERR_RH_NOT_ALLOWED "Error: this action does not support the remote-host option."
+#define ERR_REQ_PARAMS_MISSING "Error: required parameters are missing."
+#define ERR_INVALID_ACTION "Error: action not recognized."
+#define ERR_CLIPBOARD "Error placing password in clipboard. Try using the -pp option."
+#define ERR_INPUT "Error: formatting problem with input text."
+#define ERR_GENERIC "There was a problem reading/writing the keychain. You may have typed your master password incorrectly, the file may be currupt or missing, you may not have permissions in this directory, or a network error may have occoured."
+
+#define MSG_CLIPBOARD "Password was placed in clipboard."
+
+class Compass {
+public:
+ Compass();
+ virtual ~Compass();
+
+ void perform(int argc, char* argv[]);
+
+private:
+ Options opt;
+
+ void initNoArgs(int argc, char* argv[]);
+ std::string initOneArg(int argc, char* argv[]);
+
+ void showResult(Credential c);
+ void pasteClipboard(std::string text, bool clean, bool recur);
+
+ // Help
+ void help();
+
+ // Actions
+ void initialize();
+ void create(std::string service);
+ void walk();
+ void rekey();
+ void get(std::string service);
+ void _delete(std::string service);
+ void show(std::string service, bool like);
+ void random();
+ void markReset(std::string service);
+ void checkReset(std::string service);
+ void ruser(std::string service);
+ void rpass(std::string service);
+};
+
+#endif // COMPASS_H