diff --git a/KeePassHttp.plgx b/KeePassHttp.plgx index 6d36496..6c99fcc 100644 Binary files a/KeePassHttp.plgx and b/KeePassHttp.plgx differ diff --git a/KeePassHttp/ConfigOpt.cs b/KeePassHttp/ConfigOpt.cs index aa65265..c44712e 100644 --- a/KeePassHttp/ConfigOpt.cs +++ b/KeePassHttp/ConfigOpt.cs @@ -1,84 +1,111 @@ -using KeePass.App.Configuration; - -namespace KeePassHttp -{ - public class ConfigOpt - { - readonly AceCustomConfig _config; - const string ReceiveCredentialNotificationKey = "KeePassHttp_ReceiveCredentialNotification"; - const string SpecificMatchingOnlyKey = "KeePassHttp_SpecificMatchingOnly"; - const string UnlockDatabaseRequestKey = "KeePassHttp_UnlockDatabaseRequest"; - const string AlwaysAllowAccessKey = "KeePassHttp_AlwaysAllowAccess"; - const string AlwaysAllowUpdatesKey = "KeePassHttp_AlwaysAllowUpdates"; - const string SearchInAllOpenedDatabasesKey = "KeePassHttp_SearchInAllOpenedDatabases"; - const string MatchSchemesKey = "KeePassHttp_MatchSchemes"; - const string ReturnStringFieldsKey = "KeePassHttp_ReturnStringFields"; - const string SortResultByUsernameKey = "KeePassHttp_SortResultByUsername"; - const string ListenerPortKey = "KeePassHttp_ListenerPort"; - - public ConfigOpt(AceCustomConfig config) - { - _config = config; - } - - public bool ReceiveCredentialNotification - { - get { return _config.GetBool(ReceiveCredentialNotificationKey, true); } - set { _config.SetBool(ReceiveCredentialNotificationKey, value); } - } - - public bool UnlockDatabaseRequest - { - get { return _config.GetBool(UnlockDatabaseRequestKey, false); } - set { _config.SetBool(UnlockDatabaseRequestKey, value); } - } - - public bool SpecificMatchingOnly - { - get { return _config.GetBool(SpecificMatchingOnlyKey, false); } - set { _config.SetBool(SpecificMatchingOnlyKey, value); } - } - - public bool AlwaysAllowAccess - { - get { return _config.GetBool(AlwaysAllowAccessKey, false); } - set { _config.SetBool(AlwaysAllowAccessKey, value); } - } - - public bool AlwaysAllowUpdates - { - get { return _config.GetBool(AlwaysAllowUpdatesKey, false); } - set { _config.SetBool(AlwaysAllowUpdatesKey, value); } - } - - public bool SearchInAllOpenedDatabases - { - get { return _config.GetBool(SearchInAllOpenedDatabasesKey, false); } - set { _config.SetBool(SearchInAllOpenedDatabasesKey, value); } - } - - public bool MatchSchemes - { - get { return _config.GetBool(MatchSchemesKey, false); } - set { _config.SetBool(MatchSchemesKey, value); } - } - - public bool ReturnStringFields - { - get { return _config.GetBool(ReturnStringFieldsKey, false); } - set { _config.SetBool(ReturnStringFieldsKey, value); } - } - - public bool SortResultByUsername - { - get { return _config.GetBool(SortResultByUsernameKey, true); } - set { _config.SetBool(SortResultByUsernameKey, value); } - } - - public long ListenerPort - { - get { return _config.GetLong(ListenerPortKey, KeePassHttpExt.DEFAULT_PORT); } - set { _config.SetLong(ListenerPortKey, value); } - } - } +using KeePass.App.Configuration; + +namespace KeePassHttp +{ + public class ConfigOpt + { + readonly AceCustomConfig _config; + const string ReceiveCredentialNotificationKey = "KeePassHttp_ReceiveCredentialNotification"; + const string SpecificMatchingOnlyKey = "KeePassHttp_SpecificMatchingOnly"; + const string UnlockDatabaseRequestKey = "KeePassHttp_UnlockDatabaseRequest"; + const string AlwaysAllowAccessKey = "KeePassHttp_AlwaysAllowAccess"; + const string AlwaysAllowUpdatesKey = "KeePassHttp_AlwaysAllowUpdates"; + const string SearchInAllOpenedDatabasesKey = "KeePassHttp_SearchInAllOpenedDatabases"; + const string MatchSchemesKey = "KeePassHttp_MatchSchemes"; + const string ReturnStringFieldsKey = "KeePassHttp_ReturnStringFields"; + const string SortResultByUsernameKey = "KeePassHttp_SortResultByUsername"; + const string ListenerHostHttpKey = "KeePassHttp_ListenerHostHttp"; + const string ListenerPortHttpKey = "KeePassHttp_ListenerPortHttp"; + const string ActivateHttpsListenerKey = "KeePassHttp_ActivateHttpsListener"; + const string ListenerHostHttpsKey = "KeePassHttp_ListenerHostHttps"; + const string ListenerPortHttpsKey = "KeePassHttp_ListenerPortHttps"; + + public ConfigOpt(AceCustomConfig config) + { + _config = config; + } + + public bool ReceiveCredentialNotification + { + get { return _config.GetBool(ReceiveCredentialNotificationKey, true); } + set { _config.SetBool(ReceiveCredentialNotificationKey, value); } + } + + public bool UnlockDatabaseRequest + { + get { return _config.GetBool(UnlockDatabaseRequestKey, false); } + set { _config.SetBool(UnlockDatabaseRequestKey, value); } + } + + public bool SpecificMatchingOnly + { + get { return _config.GetBool(SpecificMatchingOnlyKey, false); } + set { _config.SetBool(SpecificMatchingOnlyKey, value); } + } + + public bool AlwaysAllowAccess + { + get { return _config.GetBool(AlwaysAllowAccessKey, false); } + set { _config.SetBool(AlwaysAllowAccessKey, value); } + } + + public bool AlwaysAllowUpdates + { + get { return _config.GetBool(AlwaysAllowUpdatesKey, false); } + set { _config.SetBool(AlwaysAllowUpdatesKey, value); } + } + + public bool SearchInAllOpenedDatabases + { + get { return _config.GetBool(SearchInAllOpenedDatabasesKey, false); } + set { _config.SetBool(SearchInAllOpenedDatabasesKey, value); } + } + + public bool MatchSchemes + { + get { return _config.GetBool(MatchSchemesKey, false); } + set { _config.SetBool(MatchSchemesKey, value); } + } + + public bool ReturnStringFields + { + get { return _config.GetBool(ReturnStringFieldsKey, false); } + set { _config.SetBool(ReturnStringFieldsKey, value); } + } + + public bool SortResultByUsername + { + get { return _config.GetBool(SortResultByUsernameKey, true); } + set { _config.SetBool(SortResultByUsernameKey, value); } + } + + public string ListenerHostHttp { + get { return _config.GetString(ListenerHostHttpKey, KeePassHttpExt.DEFAULT_HOST); } + set { _config.SetString(ListenerHostHttpKey, value); } + } + + public long ListenerPortHttp + { + get { return _config.GetLong(ListenerPortHttpKey, KeePassHttpExt.DEFAULT_PORT_HTTP); } + set { _config.SetLong(ListenerPortHttpKey, value); } + } + + public bool ActivateHttpsListener + { + get { return _config.GetBool(ActivateHttpsListenerKey, false); } + set { _config.SetBool(ActivateHttpsListenerKey, value); } + } + + public string ListenerHostHttps + { + get { return _config.GetString(ListenerHostHttpsKey, KeePassHttpExt.DEFAULT_HOST); } + set { _config.SetString(ListenerHostHttpsKey, value); } + } + + public long ListenerPortHttps + { + get { return _config.GetLong(ListenerPortHttpsKey, KeePassHttpExt.DEFAULT_PORT_HTTPS); } + set { _config.SetLong(ListenerPortHttpsKey, value); } + } + } } \ No newline at end of file diff --git a/KeePassHttp/KeePassHttp.cs b/KeePassHttp/KeePassHttp.cs index 0cc3c5c..cc92b63 100644 --- a/KeePassHttp/KeePassHttp.cs +++ b/KeePassHttp/KeePassHttp.cs @@ -42,20 +42,17 @@ public sealed partial class KeePassHttpExt : Plugin public const string ASSOCIATE_KEY_PREFIX = "AES Key: "; private IPluginHost host; private HttpListener listener; - public const int DEFAULT_PORT = 19455; - /// - /// TODO make configurable - /// - private int port = DEFAULT_PORT; - private const string HTTP_PREFIX = "http://localhost:"; - //private const string HTTPS_PREFIX = "https://localhost:"; - //private int HTTPS_PORT = DEFAULT_PORT + 1; + public const int DEFAULT_PORT_HTTP = 19455; + public const int DEFAULT_PORT_HTTPS = 19456; + public const string DEFAULT_HOST = "localhost"; + private const string HTTP_PREFIX = "http://"; + private const string HTTPS_PREFIX = "https://"; private Thread httpThread; private volatile bool stopped = false; Dictionary handlers = new Dictionary(); //public string UpdateUrl = ""; - public override string UpdateUrl { get { return "https://passifox.appspot.com/kph/latest-version.txt"; } } + public override string UpdateUrl { get { return "https://raw.githubusercontent.com/mheese/keepasshttp/master/latest-version.txt"; } } private SearchParameters MakeSearchParameters() { @@ -198,9 +195,19 @@ public override bool Initialize(IPluginHost host) listener = new HttpListener(); var configOpt = new ConfigOpt(this.host.CustomConfig); - - listener.Prefixes.Add(HTTP_PREFIX + configOpt.ListenerPort.ToString() + "/"); - //listener.Prefixes.Add(HTTPS_PREFIX + HTTPS_PORT + "/"); + listener.Prefixes.Add(HTTP_PREFIX + configOpt.ListenerHostHttp + ":" + configOpt.ListenerPortHttp.ToString() + "/"); + if (configOpt.ListenerHostHttp != DEFAULT_HOST) + { + listener.Prefixes.Add(HTTP_PREFIX + DEFAULT_HOST + ":" + configOpt.ListenerPortHttp.ToString() + "/"); + } + if (configOpt.ActivateHttpsListener) + { + listener.Prefixes.Add(HTTPS_PREFIX + configOpt.ListenerHostHttps + ":" + configOpt.ListenerPortHttps.ToString() + "/"); + if (configOpt.ListenerHostHttps != DEFAULT_HOST) + { + listener.Prefixes.Add(HTTPS_PREFIX + DEFAULT_HOST + ":" + configOpt.ListenerPortHttps.ToString() + "/"); + } + } listener.Start(); httpThread = new Thread(new ThreadStart(Run)); diff --git a/KeePassHttp/OptionsForm.Designer.cs b/KeePassHttp/OptionsForm.Designer.cs index 9c1aad9..ab2d001 100644 --- a/KeePassHttp/OptionsForm.Designer.cs +++ b/KeePassHttp/OptionsForm.Designer.cs @@ -28,359 +28,591 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); - this.cancelButton = new System.Windows.Forms.Button(); - this.okButton = new System.Windows.Forms.Button(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.SortByUsernameRadioButton = new System.Windows.Forms.RadioButton(); - this.SortByTitleRadioButton = new System.Windows.Forms.RadioButton(); - this.matchSchemesCheckbox = new System.Windows.Forms.CheckBox(); - this.removePermissionsButton = new System.Windows.Forms.Button(); - this.unlockDatabaseCheckbox = new System.Windows.Forms.CheckBox(); - this.removeButton = new System.Windows.Forms.Button(); - this.credMatchingCheckbox = new System.Windows.Forms.CheckBox(); - this.credNotifyCheckbox = new System.Windows.Forms.CheckBox(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.returnStringFieldsCheckbox = new System.Windows.Forms.CheckBox(); - this.label2 = new System.Windows.Forms.Label(); - this.credSearchInAllOpenedDatabases = new System.Windows.Forms.CheckBox(); - this.label1 = new System.Windows.Forms.Label(); - this.credAllowUpdatesCheckbox = new System.Windows.Forms.CheckBox(); - this.credAllowAccessCheckbox = new System.Windows.Forms.CheckBox(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.portNumber = new System.Windows.Forms.NumericUpDown(); - this.label7 = new System.Windows.Forms.Label(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.portNumber)).BeginInit(); - this.SuspendLayout(); - // - // cancelButton - // - this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(313, 383); - this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(88, 28); - this.cancelButton.TabIndex = 2; - this.cancelButton.Text = "&Cancel"; - this.cancelButton.UseVisualStyleBackColor = true; - // - // okButton - // - this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.okButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.okButton.Location = new System.Drawing.Point(219, 383); - this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(88, 28); - this.okButton.TabIndex = 1; - this.okButton.Text = "&Save"; - this.okButton.UseVisualStyleBackColor = true; - this.okButton.Click += new System.EventHandler(this.okButton_Click); - // - // tabControl1 - // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(1, 3); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(410, 373); - this.tabControl1.TabIndex = 3; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this.SortByUsernameRadioButton); - this.tabPage1.Controls.Add(this.SortByTitleRadioButton); - this.tabPage1.Controls.Add(this.matchSchemesCheckbox); - this.tabPage1.Controls.Add(this.removePermissionsButton); - this.tabPage1.Controls.Add(this.unlockDatabaseCheckbox); - this.tabPage1.Controls.Add(this.removeButton); - this.tabPage1.Controls.Add(this.credMatchingCheckbox); - this.tabPage1.Controls.Add(this.credNotifyCheckbox); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(402, 347); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "General"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // SortByUsernameRadioButton - // - this.SortByUsernameRadioButton.AutoSize = true; - this.SortByUsernameRadioButton.Location = new System.Drawing.Point(7, 124); - this.SortByUsernameRadioButton.Name = "SortByUsernameRadioButton"; - this.SortByUsernameRadioButton.Size = new System.Drawing.Size(171, 17); - this.SortByUsernameRadioButton.TabIndex = 19; - this.SortByUsernameRadioButton.TabStop = true; - this.SortByUsernameRadioButton.Text = "Sort found entries by &username"; - this.SortByUsernameRadioButton.UseVisualStyleBackColor = true; - // - // SortByTitleRadioButton - // - this.SortByTitleRadioButton.AutoSize = true; - this.SortByTitleRadioButton.Location = new System.Drawing.Point(7, 147); - this.SortByTitleRadioButton.Name = "SortByTitleRadioButton"; - this.SortByTitleRadioButton.Size = new System.Drawing.Size(141, 17); - this.SortByTitleRadioButton.TabIndex = 18; - this.SortByTitleRadioButton.TabStop = true; - this.SortByTitleRadioButton.Text = "Sort found entries by &title"; - this.SortByTitleRadioButton.UseVisualStyleBackColor = true; - // - // matchSchemesCheckbox - // - this.matchSchemesCheckbox.AutoSize = true; - this.matchSchemesCheckbox.Location = new System.Drawing.Point(7, 88); - this.matchSchemesCheckbox.Name = "matchSchemesCheckbox"; - this.matchSchemesCheckbox.Size = new System.Drawing.Size(375, 30); - this.matchSchemesCheckbox.TabIndex = 17; - this.matchSchemesCheckbox.Text = "&Match URL schemes\r\nonly entries with the same scheme (http://, https://, ftp://," + - " ...) are returned"; - this.matchSchemesCheckbox.UseVisualStyleBackColor = true; - // - // removePermissionsButton - // - this.removePermissionsButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.removePermissionsButton.ImageAlign = System.Drawing.ContentAlignment.TopLeft; - this.removePermissionsButton.Location = new System.Drawing.Point(14, 216); - this.removePermissionsButton.Name = "removePermissionsButton"; - this.removePermissionsButton.Size = new System.Drawing.Size(372, 28); - this.removePermissionsButton.TabIndex = 16; - this.removePermissionsButton.Text = "Remo&ve all stored permissions from entries in active database"; - this.removePermissionsButton.UseVisualStyleBackColor = true; - this.removePermissionsButton.Click += new System.EventHandler(this.removePermissionsButton_Click); - // - // unlockDatabaseCheckbox - // - this.unlockDatabaseCheckbox.AutoSize = true; - this.unlockDatabaseCheckbox.Location = new System.Drawing.Point(7, 65); - this.unlockDatabaseCheckbox.Name = "unlockDatabaseCheckbox"; - this.unlockDatabaseCheckbox.Size = new System.Drawing.Size(256, 17); - this.unlockDatabaseCheckbox.TabIndex = 15; - this.unlockDatabaseCheckbox.Text = "Re&quest for unlocking the database if it is locked"; - this.unlockDatabaseCheckbox.UseVisualStyleBackColor = true; - // - // removeButton - // - this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.removeButton.Location = new System.Drawing.Point(14, 182); - this.removeButton.Name = "removeButton"; - this.removeButton.Size = new System.Drawing.Size(372, 28); - this.removeButton.TabIndex = 11; - this.removeButton.Text = "R&emove all shared encryption-keys from active database"; - this.removeButton.UseVisualStyleBackColor = true; - this.removeButton.Click += new System.EventHandler(this.removeButton_Click); - // - // credMatchingCheckbox - // - this.credMatchingCheckbox.AutoSize = true; - this.credMatchingCheckbox.Location = new System.Drawing.Point(7, 29); - this.credMatchingCheckbox.Name = "credMatchingCheckbox"; - this.credMatchingCheckbox.Size = new System.Drawing.Size(238, 30); - this.credMatchingCheckbox.TabIndex = 9; - this.credMatchingCheckbox.Text = "&Return only best matching entries for an URL\r\ninstead of all entries for the who" + - "le domain"; - this.credMatchingCheckbox.UseVisualStyleBackColor = true; - // - // credNotifyCheckbox - // - this.credNotifyCheckbox.AutoSize = true; - this.credNotifyCheckbox.Location = new System.Drawing.Point(7, 6); - this.credNotifyCheckbox.Name = "credNotifyCheckbox"; - this.credNotifyCheckbox.Size = new System.Drawing.Size(267, 17); - this.credNotifyCheckbox.TabIndex = 8; - this.credNotifyCheckbox.Text = "Sh&ow a notification when credentials are requested"; - this.credNotifyCheckbox.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.label7); - this.tabPage2.Controls.Add(this.portNumber); - this.tabPage2.Controls.Add(this.label5); - this.tabPage2.Controls.Add(this.label6); - this.tabPage2.Controls.Add(this.label4); - this.tabPage2.Controls.Add(this.label3); - this.tabPage2.Controls.Add(this.returnStringFieldsCheckbox); - this.tabPage2.Controls.Add(this.label2); - this.tabPage2.Controls.Add(this.credSearchInAllOpenedDatabases); - this.tabPage2.Controls.Add(this.label1); - this.tabPage2.Controls.Add(this.credAllowUpdatesCheckbox); - this.tabPage2.Controls.Add(this.credAllowAccessCheckbox); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(402, 347); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Advanced"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.Location = new System.Drawing.Point(53, 225); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(277, 26); - this.label4.TabIndex = 22; - this.label4.Text = "Automatic creates or updates are not supported\r\nfor string fields!"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(52, 156); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(302, 65); - this.label3.TabIndex = 21; - this.label3.Text = resources.GetString("label3.Text"); - // - // returnStringFieldsCheckbox - // - this.returnStringFieldsCheckbox.AutoSize = true; - this.returnStringFieldsCheckbox.Location = new System.Drawing.Point(7, 136); - this.returnStringFieldsCheckbox.Name = "returnStringFieldsCheckbox"; - this.returnStringFieldsCheckbox.Size = new System.Drawing.Size(303, 17); - this.returnStringFieldsCheckbox.TabIndex = 20; - this.returnStringFieldsCheckbox.Text = "&Return also advanced string fields which start with \"KPH: \""; - this.returnStringFieldsCheckbox.UseVisualStyleBackColor = true; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(52, 108); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(299, 13); - this.label2.TabIndex = 19; - this.label2.Text = "Only the selected database has to be connected with a client!"; - // - // credSearchInAllOpenedDatabases - // - this.credSearchInAllOpenedDatabases.AutoSize = true; - this.credSearchInAllOpenedDatabases.Location = new System.Drawing.Point(7, 88); - this.credSearchInAllOpenedDatabases.Name = "credSearchInAllOpenedDatabases"; - this.credSearchInAllOpenedDatabases.Size = new System.Drawing.Size(270, 17); - this.credSearchInAllOpenedDatabases.TabIndex = 18; - this.credSearchInAllOpenedDatabases.Text = "Searc&h in all opened databases for matching entries"; - this.credSearchInAllOpenedDatabases.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Red; - this.label1.Location = new System.Drawing.Point(4, 7); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(391, 13); - this.label1.TabIndex = 17; - this.label1.Text = "Activate the following options only, if you know what you are doing!"; - // - // credAllowUpdatesCheckbox - // - this.credAllowUpdatesCheckbox.AutoSize = true; - this.credAllowUpdatesCheckbox.Location = new System.Drawing.Point(6, 56); - this.credAllowUpdatesCheckbox.Name = "credAllowUpdatesCheckbox"; - this.credAllowUpdatesCheckbox.Size = new System.Drawing.Size(164, 17); - this.credAllowUpdatesCheckbox.TabIndex = 16; - this.credAllowUpdatesCheckbox.Text = "Always allow &updating entries"; - this.credAllowUpdatesCheckbox.UseVisualStyleBackColor = true; - // - // credAllowAccessCheckbox - // - this.credAllowAccessCheckbox.AutoSize = true; - this.credAllowAccessCheckbox.Location = new System.Drawing.Point(6, 33); - this.credAllowAccessCheckbox.Name = "credAllowAccessCheckbox"; - this.credAllowAccessCheckbox.Size = new System.Drawing.Size(169, 17); - this.credAllowAccessCheckbox.TabIndex = 15; - this.credAllowAccessCheckbox.Text = "Always allow &access to entries"; - this.credAllowAccessCheckbox.UseVisualStyleBackColor = true; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(21, 298); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(29, 13); - this.label6.TabIndex = 26; - this.label6.Text = "Port:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 274); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(312, 13); - this.label5.TabIndex = 27; - this.label5.Text = "Change the default port number if you have connection problems"; - // - // portNumber - // - this.portNumber.Location = new System.Drawing.Point(56, 296); - this.portNumber.Maximum = new decimal(new int[] { - 99999, - 0, - 0, - 0}); - this.portNumber.Minimum = new decimal(new int[] { - 1025, - 0, - 0, - 0}); - this.portNumber.Name = "portNumber"; - this.portNumber.Size = new System.Drawing.Size(60, 20); - this.portNumber.TabIndex = 29; - this.portNumber.Value = new decimal(new int[] { - 19455, - 0, - 0, - 0}); - this.portNumber.ValueChanged += new System.EventHandler(this.portNumber_ValueChanged); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(132, 296); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(241, 39); - this.label7.TabIndex = 30; - this.label7.Text = "Default: 19455\r\nDon\'t forget to change the port number also in\r\nthe plugins like " + - "chromeIPass, PassIFox, kypass,..."; - // - // OptionsForm - // - this.AcceptButton = this.okButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(411, 420); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this.okButton); - this.Controls.Add(this.cancelButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "OptionsForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "KeePassHttp Options"; - this.Load += new System.EventHandler(this.OptionsForm_Load); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.portNumber)).EndInit(); - this.ResumeLayout(false); - + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); + this.cancelButton = new System.Windows.Forms.Button(); + this.okButton = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.SortByUsernameRadioButton = new System.Windows.Forms.RadioButton(); + this.SortByTitleRadioButton = new System.Windows.Forms.RadioButton(); + this.matchSchemesCheckbox = new System.Windows.Forms.CheckBox(); + this.removePermissionsButton = new System.Windows.Forms.Button(); + this.unlockDatabaseCheckbox = new System.Windows.Forms.CheckBox(); + this.removeButton = new System.Windows.Forms.Button(); + this.credMatchingCheckbox = new System.Windows.Forms.CheckBox(); + this.credNotifyCheckbox = new System.Windows.Forms.CheckBox(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.returnStringFieldsCheckbox = new System.Windows.Forms.CheckBox(); + this.label2 = new System.Windows.Forms.Label(); + this.credSearchInAllOpenedDatabases = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.credAllowUpdatesCheckbox = new System.Windows.Forms.CheckBox(); + this.credAllowAccessCheckbox = new System.Windows.Forms.CheckBox(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.instructionsLink = new System.Windows.Forms.LinkLabel(); + this.activateHttpsListenerCheckbox = new System.Windows.Forms.CheckBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label10 = new System.Windows.Forms.Label(); + this.listenerHostHttp = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.portNumberHttp = new System.Windows.Forms.NumericUpDown(); + this.label6 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label12 = new System.Windows.Forms.Label(); + this.listenerHostHttps = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.portNumberHttps = new System.Windows.Forms.NumericUpDown(); + this.label15 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.portNumberHttp)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.portNumberHttps)).BeginInit(); + this.SuspendLayout(); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(649, 791); + this.cancelButton.Margin = new System.Windows.Forms.Padding(6); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(176, 54); + this.cancelButton.TabIndex = 2; + this.cancelButton.Text = "&Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.okButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.okButton.Location = new System.Drawing.Point(461, 791); + this.okButton.Margin = new System.Windows.Forms.Padding(6); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(176, 54); + this.okButton.TabIndex = 1; + this.okButton.Text = "&Save"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.ItemSize = new System.Drawing.Size(88, 30); + this.tabControl1.Location = new System.Drawing.Point(12, 12); + this.tabControl1.Margin = new System.Windows.Forms.Padding(6); + this.tabControl1.Multiline = true; + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(820, 767); + this.tabControl1.TabIndex = 3; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.SortByUsernameRadioButton); + this.tabPage1.Controls.Add(this.SortByTitleRadioButton); + this.tabPage1.Controls.Add(this.matchSchemesCheckbox); + this.tabPage1.Controls.Add(this.removePermissionsButton); + this.tabPage1.Controls.Add(this.unlockDatabaseCheckbox); + this.tabPage1.Controls.Add(this.removeButton); + this.tabPage1.Controls.Add(this.credMatchingCheckbox); + this.tabPage1.Controls.Add(this.credNotifyCheckbox); + this.tabPage1.Location = new System.Drawing.Point(4, 34); + this.tabPage1.Margin = new System.Windows.Forms.Padding(0); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Size = new System.Drawing.Size(812, 729); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "General"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // SortByUsernameRadioButton + // + this.SortByUsernameRadioButton.AutoSize = true; + this.SortByUsernameRadioButton.Location = new System.Drawing.Point(8, 232); + this.SortByUsernameRadioButton.Margin = new System.Windows.Forms.Padding(6); + this.SortByUsernameRadioButton.Name = "SortByUsernameRadioButton"; + this.SortByUsernameRadioButton.Size = new System.Drawing.Size(343, 29); + this.SortByUsernameRadioButton.TabIndex = 19; + this.SortByUsernameRadioButton.TabStop = true; + this.SortByUsernameRadioButton.Text = "Sort found entries by &username"; + this.SortByUsernameRadioButton.UseVisualStyleBackColor = true; + // + // SortByTitleRadioButton + // + this.SortByTitleRadioButton.AutoSize = true; + this.SortByTitleRadioButton.Location = new System.Drawing.Point(8, 277); + this.SortByTitleRadioButton.Margin = new System.Windows.Forms.Padding(6); + this.SortByTitleRadioButton.Name = "SortByTitleRadioButton"; + this.SortByTitleRadioButton.Size = new System.Drawing.Size(282, 29); + this.SortByTitleRadioButton.TabIndex = 18; + this.SortByTitleRadioButton.TabStop = true; + this.SortByTitleRadioButton.Text = "Sort found entries by &title"; + this.SortByTitleRadioButton.UseVisualStyleBackColor = true; + // + // matchSchemesCheckbox + // + this.matchSchemesCheckbox.AutoSize = true; + this.matchSchemesCheckbox.Location = new System.Drawing.Point(8, 163); + this.matchSchemesCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.matchSchemesCheckbox.Name = "matchSchemesCheckbox"; + this.matchSchemesCheckbox.Size = new System.Drawing.Size(732, 54); + this.matchSchemesCheckbox.TabIndex = 17; + this.matchSchemesCheckbox.Text = "&Match URL schemes\r\nonly entries with the same scheme (http://, https://, ftp://," + + " ...) are returned"; + this.matchSchemesCheckbox.UseVisualStyleBackColor = true; + // + // removePermissionsButton + // + this.removePermissionsButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.removePermissionsButton.ImageAlign = System.Drawing.ContentAlignment.TopLeft; + this.removePermissionsButton.Location = new System.Drawing.Point(22, 409); + this.removePermissionsButton.Margin = new System.Windows.Forms.Padding(6); + this.removePermissionsButton.Name = "removePermissionsButton"; + this.removePermissionsButton.Size = new System.Drawing.Size(756, 54); + this.removePermissionsButton.TabIndex = 16; + this.removePermissionsButton.Text = "Remo&ve all stored permissions from entries in active database"; + this.removePermissionsButton.UseVisualStyleBackColor = true; + this.removePermissionsButton.Click += new System.EventHandler(this.removePermissionsButton_Click); + // + // unlockDatabaseCheckbox + // + this.unlockDatabaseCheckbox.AutoSize = true; + this.unlockDatabaseCheckbox.Location = new System.Drawing.Point(8, 119); + this.unlockDatabaseCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.unlockDatabaseCheckbox.Name = "unlockDatabaseCheckbox"; + this.unlockDatabaseCheckbox.Size = new System.Drawing.Size(509, 29); + this.unlockDatabaseCheckbox.TabIndex = 15; + this.unlockDatabaseCheckbox.Text = "Re&quest for unlocking the database if it is locked"; + this.unlockDatabaseCheckbox.UseVisualStyleBackColor = true; + // + // removeButton + // + this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.removeButton.Location = new System.Drawing.Point(22, 344); + this.removeButton.Margin = new System.Windows.Forms.Padding(6); + this.removeButton.Name = "removeButton"; + this.removeButton.Size = new System.Drawing.Size(756, 54); + this.removeButton.TabIndex = 11; + this.removeButton.Text = "R&emove all shared encryption-keys from active database"; + this.removeButton.UseVisualStyleBackColor = true; + this.removeButton.Click += new System.EventHandler(this.removeButton_Click); + // + // credMatchingCheckbox + // + this.credMatchingCheckbox.AutoSize = true; + this.credMatchingCheckbox.Location = new System.Drawing.Point(8, 50); + this.credMatchingCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.credMatchingCheckbox.Name = "credMatchingCheckbox"; + this.credMatchingCheckbox.Size = new System.Drawing.Size(474, 54); + this.credMatchingCheckbox.TabIndex = 9; + this.credMatchingCheckbox.Text = "&Return only best matching entries for an URL\r\ninstead of all entries for the who" + + "le domain"; + this.credMatchingCheckbox.UseVisualStyleBackColor = true; + // + // credNotifyCheckbox + // + this.credNotifyCheckbox.AutoSize = true; + this.credNotifyCheckbox.Location = new System.Drawing.Point(8, 6); + this.credNotifyCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.credNotifyCheckbox.Name = "credNotifyCheckbox"; + this.credNotifyCheckbox.Size = new System.Drawing.Size(532, 29); + this.credNotifyCheckbox.TabIndex = 8; + this.credNotifyCheckbox.Text = "Sh&ow a notification when credentials are requested"; + this.credNotifyCheckbox.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.label4); + this.tabPage2.Controls.Add(this.label3); + this.tabPage2.Controls.Add(this.returnStringFieldsCheckbox); + this.tabPage2.Controls.Add(this.label2); + this.tabPage2.Controls.Add(this.credSearchInAllOpenedDatabases); + this.tabPage2.Controls.Add(this.label1); + this.tabPage2.Controls.Add(this.credAllowUpdatesCheckbox); + this.tabPage2.Controls.Add(this.credAllowAccessCheckbox); + this.tabPage2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + this.tabPage2.Location = new System.Drawing.Point(4, 34); + this.tabPage2.Margin = new System.Windows.Forms.Padding(0); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Size = new System.Drawing.Size(812, 729); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Advanced"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point(100, 427); + this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(516, 52); + this.label4.TabIndex = 22; + this.label4.Text = "Automatic creates or updates are not supported\r\nfor string fields!"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(98, 294); + this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(530, 120); + this.label3.TabIndex = 21; + this.label3.Text = resources.GetString("label3.Text"); + // + // returnStringFieldsCheckbox + // + this.returnStringFieldsCheckbox.AutoSize = true; + this.returnStringFieldsCheckbox.Location = new System.Drawing.Point(8, 256); + this.returnStringFieldsCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.returnStringFieldsCheckbox.Name = "returnStringFieldsCheckbox"; + this.returnStringFieldsCheckbox.Size = new System.Drawing.Size(521, 28); + this.returnStringFieldsCheckbox.TabIndex = 20; + this.returnStringFieldsCheckbox.Text = "&Return also advanced string fields which start with \"KPH: \""; + this.returnStringFieldsCheckbox.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(98, 202); + this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(521, 24); + this.label2.TabIndex = 19; + this.label2.Text = "Only the selected database has to be connected with a client!"; + // + // credSearchInAllOpenedDatabases + // + this.credSearchInAllOpenedDatabases.AutoSize = true; + this.credSearchInAllOpenedDatabases.Location = new System.Drawing.Point(8, 163); + this.credSearchInAllOpenedDatabases.Margin = new System.Windows.Forms.Padding(6); + this.credSearchInAllOpenedDatabases.Name = "credSearchInAllOpenedDatabases"; + this.credSearchInAllOpenedDatabases.Size = new System.Drawing.Size(475, 28); + this.credSearchInAllOpenedDatabases.TabIndex = 18; + this.credSearchInAllOpenedDatabases.Text = "Searc&h in all opened databases for matching entries"; + this.credSearchInAllOpenedDatabases.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.Red; + this.label1.Location = new System.Drawing.Point(2, 7); + this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(723, 26); + this.label1.TabIndex = 17; + this.label1.Text = "Activate the following options only, if you know what you are doing!"; + // + // credAllowUpdatesCheckbox + // + this.credAllowUpdatesCheckbox.AutoSize = true; + this.credAllowUpdatesCheckbox.Location = new System.Drawing.Point(6, 102); + this.credAllowUpdatesCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.credAllowUpdatesCheckbox.Name = "credAllowUpdatesCheckbox"; + this.credAllowUpdatesCheckbox.Size = new System.Drawing.Size(288, 28); + this.credAllowUpdatesCheckbox.TabIndex = 16; + this.credAllowUpdatesCheckbox.Text = "Always allow &updating entries"; + this.credAllowUpdatesCheckbox.UseVisualStyleBackColor = true; + // + // credAllowAccessCheckbox + // + this.credAllowAccessCheckbox.AutoSize = true; + this.credAllowAccessCheckbox.Location = new System.Drawing.Point(6, 57); + this.credAllowAccessCheckbox.Margin = new System.Windows.Forms.Padding(6); + this.credAllowAccessCheckbox.Name = "credAllowAccessCheckbox"; + this.credAllowAccessCheckbox.Size = new System.Drawing.Size(294, 28); + this.credAllowAccessCheckbox.TabIndex = 15; + this.credAllowAccessCheckbox.Text = "Always allow &access to entries"; + this.credAllowAccessCheckbox.UseVisualStyleBackColor = true; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.instructionsLink); + this.tabPage3.Controls.Add(this.activateHttpsListenerCheckbox); + this.tabPage3.Controls.Add(this.groupBox2); + this.tabPage3.Controls.Add(this.groupBox1); + this.tabPage3.Controls.Add(this.label9); + this.tabPage3.Controls.Add(this.label5); + this.tabPage3.Location = new System.Drawing.Point(4, 34); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(812, 729); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Listener Configuration"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // instructionsLink + // + this.instructionsLink.AutoSize = true; + this.instructionsLink.Location = new System.Drawing.Point(9, 98); + this.instructionsLink.Name = "instructionsLink"; + this.instructionsLink.Size = new System.Drawing.Size(221, 25); + this.instructionsLink.TabIndex = 47; + this.instructionsLink.TabStop = true; + this.instructionsLink.Text = "Read the instructions!"; + this.instructionsLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.instructionsLink_LinkClicked); + // + // activateHttpsListenerCheckbox + // + this.activateHttpsListenerCheckbox.AutoSize = true; + this.activateHttpsListenerCheckbox.Location = new System.Drawing.Point(14, 333); + this.activateHttpsListenerCheckbox.Name = "activateHttpsListenerCheckbox"; + this.activateHttpsListenerCheckbox.Size = new System.Drawing.Size(279, 29); + this.activateHttpsListenerCheckbox.TabIndex = 46; + this.activateHttpsListenerCheckbox.Text = "Activate HTTPS Listener"; + this.activateHttpsListenerCheckbox.UseVisualStyleBackColor = true; + this.activateHttpsListenerCheckbox.CheckedChanged += new System.EventHandler(this.activateHttpsListenerCheckbox_CheckedChanged); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.label10); + this.groupBox2.Controls.Add(this.listenerHostHttp); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Controls.Add(this.portNumberHttp); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Location = new System.Drawing.Point(14, 144); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(774, 155); + this.groupBox2.TabIndex = 45; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "HTTP Listener"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(440, 47); + this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(178, 25); + this.label10.TabIndex = 48; + this.label10.Text = "Default: localhost"; + // + // listenerHostHttp + // + this.listenerHostHttp.Location = new System.Drawing.Point(92, 46); + this.listenerHostHttp.Name = "listenerHostHttp"; + this.listenerHostHttp.Size = new System.Drawing.Size(324, 31); + this.listenerHostHttp.TabIndex = 47; + this.listenerHostHttp.Text = "localhost"; + this.listenerHostHttp.TextChanged += new System.EventHandler(this.listenerHost_TextChanged); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(21, 47); + this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(62, 25); + this.label8.TabIndex = 46; + this.label8.Text = "Host:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(440, 95); + this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(152, 25); + this.label7.TabIndex = 45; + this.label7.Text = "Default: 19455"; + // + // portNumberHttp + // + this.portNumberHttp.Location = new System.Drawing.Point(93, 97); + this.portNumberHttp.Margin = new System.Windows.Forms.Padding(6); + this.portNumberHttp.Maximum = new decimal(new int[] { + 99999, + 0, + 0, + 0}); + this.portNumberHttp.Minimum = new decimal(new int[] { + 1025, + 0, + 0, + 0}); + this.portNumberHttp.Name = "portNumberHttp"; + this.portNumberHttp.Size = new System.Drawing.Size(120, 31); + this.portNumberHttp.TabIndex = 44; + this.portNumberHttp.Value = new decimal(new int[] { + 19455, + 0, + 0, + 0}); + this.portNumberHttp.ValueChanged += new System.EventHandler(this.portNumber_ValueChanged); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(26, 99); + this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(57, 25); + this.label6.TabIndex = 43; + this.label6.Text = "Port:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Controls.Add(this.listenerHostHttps); + this.groupBox1.Controls.Add(this.label13); + this.groupBox1.Controls.Add(this.label14); + this.groupBox1.Controls.Add(this.portNumberHttps); + this.groupBox1.Controls.Add(this.label15); + this.groupBox1.Location = new System.Drawing.Point(14, 368); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(774, 149); + this.groupBox1.TabIndex = 44; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "HTTPS Listener"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(435, 42); + this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(178, 25); + this.label12.TabIndex = 48; + this.label12.Text = "Default: localhost"; + // + // listenerHostHttps + // + this.listenerHostHttps.Location = new System.Drawing.Point(87, 41); + this.listenerHostHttps.Name = "listenerHostHttps"; + this.listenerHostHttps.Size = new System.Drawing.Size(324, 31); + this.listenerHostHttps.TabIndex = 47; + this.listenerHostHttps.Text = "localhost"; + this.listenerHostHttps.TextChanged += new System.EventHandler(this.listenerHost_TextChanged); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(16, 42); + this.label13.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(62, 25); + this.label13.TabIndex = 46; + this.label13.Text = "Host:"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(435, 90); + this.label14.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(152, 25); + this.label14.TabIndex = 45; + this.label14.Text = "Default: 19456"; + // + // portNumberHttps + // + this.portNumberHttps.Location = new System.Drawing.Point(88, 92); + this.portNumberHttps.Margin = new System.Windows.Forms.Padding(6); + this.portNumberHttps.Maximum = new decimal(new int[] { + 99999, + 0, + 0, + 0}); + this.portNumberHttps.Minimum = new decimal(new int[] { + 1025, + 0, + 0, + 0}); + this.portNumberHttps.Name = "portNumberHttps"; + this.portNumberHttps.Size = new System.Drawing.Size(120, 31); + this.portNumberHttps.TabIndex = 44; + this.portNumberHttps.Value = new decimal(new int[] { + 19456, + 0, + 0, + 0}); + this.portNumberHttps.ValueChanged += new System.EventHandler(this.portNumber_ValueChanged); + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(21, 94); + this.label15.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(57, 25); + this.label15.TabIndex = 43; + this.label15.Text = "Port:"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.875F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label9.Location = new System.Drawing.Point(9, 541); + this.label9.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(583, 50); + this.label9.TabIndex = 41; + this.label9.Text = "Don\'t forget to change the listener (host + port) also in\r\nthe plugins like chrom" + + "eIPass, PassIFox, kypass, etc."; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(9, 13); + this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(762, 75); + this.label5.TabIndex = 36; + this.label5.Text = resources.GetString("label5.Text"); + // + // OptionsForm + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(840, 860); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.okButton); + this.Controls.Add(this.cancelButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(6); + this.Name = "OptionsForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "KeePassHttp Options"; + this.Load += new System.EventHandler(this.OptionsForm_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.portNumberHttp)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.portNumberHttps)).EndInit(); + this.ResumeLayout(false); + } #endregion @@ -404,11 +636,26 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox returnStringFieldsCheckbox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; - private System.Windows.Forms.RadioButton SortByUsernameRadioButton; - private System.Windows.Forms.RadioButton SortByTitleRadioButton; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.NumericUpDown portNumber; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; + private System.Windows.Forms.RadioButton SortByUsernameRadioButton; + private System.Windows.Forms.RadioButton SortByTitleRadioButton; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox activateHttpsListenerCheckbox; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox listenerHostHttp; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.NumericUpDown portNumberHttp; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox listenerHostHttps; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.NumericUpDown portNumberHttps; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.LinkLabel instructionsLink; } } \ No newline at end of file diff --git a/KeePassHttp/OptionsForm.cs b/KeePassHttp/OptionsForm.cs index be1698a..d9f0134 100644 --- a/KeePassHttp/OptionsForm.cs +++ b/KeePassHttp/OptionsForm.cs @@ -1,204 +1,242 @@ -using KeePassLib; -using KeePassHttp; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using KeePassLib.Collections; - -namespace KeePassHttp -{ - public partial class OptionsForm : Form - { - readonly ConfigOpt _config; - private bool _restartRequired = false; - - public OptionsForm(ConfigOpt config) - { - _config = config; - InitializeComponent(); - } - - - private PwEntry GetConfigEntry(PwDatabase db) - { - var kphe = new KeePassHttpExt(); - var root = db.RootGroup; - var uuid = new PwUuid(kphe.KEEPASSHTTP_UUID); - var entry = root.FindEntry(uuid, false); - return entry; - } - - private void OptionsForm_Load(object sender, EventArgs e) - { - credNotifyCheckbox.Checked = _config.ReceiveCredentialNotification; - credMatchingCheckbox.Checked = _config.SpecificMatchingOnly; - unlockDatabaseCheckbox.Checked = _config.UnlockDatabaseRequest; - credAllowAccessCheckbox.Checked = _config.AlwaysAllowAccess; - credAllowUpdatesCheckbox.Checked = _config.AlwaysAllowUpdates; - credSearchInAllOpenedDatabases.Checked = _config.SearchInAllOpenedDatabases; - matchSchemesCheckbox.Checked = _config.MatchSchemes; - returnStringFieldsCheckbox.Checked = _config.ReturnStringFields; - SortByUsernameRadioButton.Checked = _config.SortResultByUsername; - SortByTitleRadioButton.Checked = !_config.SortResultByUsername; - portNumber.Value = _config.ListenerPort; - } - - private void okButton_Click(object sender, EventArgs e) - { - _config.ReceiveCredentialNotification = credNotifyCheckbox.Checked; - _config.SpecificMatchingOnly = credMatchingCheckbox.Checked; - _config.UnlockDatabaseRequest = unlockDatabaseCheckbox.Checked; - _config.AlwaysAllowAccess = credAllowAccessCheckbox.Checked; - _config.AlwaysAllowUpdates = credAllowUpdatesCheckbox.Checked; - _config.SearchInAllOpenedDatabases = credSearchInAllOpenedDatabases.Checked; - _config.MatchSchemes = matchSchemesCheckbox.Checked; - _config.ReturnStringFields = returnStringFieldsCheckbox.Checked; - _config.SortResultByUsername = SortByUsernameRadioButton.Checked; - _config.ListenerPort = (int)portNumber.Value; - - if (_restartRequired) - { - MessageBox.Show( - "You have successfully changed the port number.\nA restart of KeePass is required!\n\nPlease restart KeePass now.", - "Restart required!", - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - } - - private void removeButton_Click(object sender, EventArgs e) - { - if (KeePass.Program.MainForm.DocumentManager.ActiveDatabase.IsOpen) - { - PwDatabase db = KeePass.Program.MainForm.DocumentManager.ActiveDatabase; - var entry = GetConfigEntry(db); - if (entry != null) - { - List deleteKeys = new List(); - - foreach (var s in entry.Strings) - { - if (s.Key.IndexOf(KeePassHttpExt.ASSOCIATE_KEY_PREFIX) == 0) - { - deleteKeys.Add(s.Key); - } - } - - - if(deleteKeys.Count > 0) - { - PwObjectList m_vHistory = entry.History.CloneDeep(); - entry.History = m_vHistory; - entry.CreateBackup(null); - - foreach (var key in deleteKeys) - { - entry.Strings.Remove(key); - } - - entry.Touch(true); - KeePass.Program.MainForm.UpdateUI(false, null, true, db.RootGroup, true, null, true); - MessageBox.Show( - String.Format("Successfully removed {0} encryption-key{1} from KeePassHttp Settings.", deleteKeys.Count.ToString(), deleteKeys.Count == 1 ? "" : "s"), - String.Format("Removed {0} key{1} from database", deleteKeys.Count.ToString(), deleteKeys.Count == 1 ? "" : "s"), - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - else - { - MessageBox.Show( - "No shared encryption-keys found in KeePassHttp Settings.", "No keys found", - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - } - else - { - MessageBox.Show("The active database does not contain an entry of KeePassHttp Settings.", "KeePassHttp Settings not available!", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - else - { - MessageBox.Show("The active database is locked!\nPlease unlock the selected database or choose another one which is unlocked.", "Database locked!", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void removePermissionsButton_Click(object sender, EventArgs e) - { - if (KeePass.Program.MainForm.DocumentManager.ActiveDatabase.IsOpen) - { - PwDatabase db = KeePass.Program.MainForm.DocumentManager.ActiveDatabase; - - uint counter = 0; - var entries = db.RootGroup.GetEntries(true); - - if (entries.Count() > 999) - { - MessageBox.Show( - String.Format("{0} entries detected!\nSearching and removing permissions could take some while.\n\nWe will inform you when the process has been finished.", entries.Count().ToString()), - String.Format("{0} entries detected", entries.Count().ToString()), - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - - foreach (var entry in entries) { - foreach (var str in entry.Strings) - { - if (str.Key == KeePassHttpExt.KEEPASSHTTP_NAME) - { - PwObjectList m_vHistory = entry.History.CloneDeep(); - entry.History = m_vHistory; - entry.CreateBackup(null); - - entry.Strings.Remove(str.Key); - - entry.Touch(true); - - counter += 1; - - break; - } - } - } - - if (counter > 0) - { - KeePass.Program.MainForm.UpdateUI(false, null, true, db.RootGroup, true, null, true); - MessageBox.Show( - String.Format("Successfully removed permissions from {0} entr{1}.", counter.ToString(), counter == 1 ? "y" : "ies"), - String.Format("Removed permissions from {0} entr{1}", counter.ToString(), counter == 1 ? "y" : "ies"), - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - else - { - MessageBox.Show( - "The active database does not contain an entry with permissions.", - "No entry with permissions found!", - MessageBoxButtons.OK, - MessageBoxIcon.Information - ); - } - } - else - { - MessageBox.Show("The active database is locked!\nPlease unlock the selected database or choose another one which is unlocked.", "Database locked!", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void portNumber_ValueChanged(object sender, EventArgs e) - { - _restartRequired = (_config.ListenerPort != portNumber.Value); - } - } -} +using KeePassLib; +using KeePassHttp; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using KeePassLib.Collections; + +namespace KeePassHttp +{ + public partial class OptionsForm : Form + { + readonly ConfigOpt _config; + private bool _restartRequired = false; + + public OptionsForm(ConfigOpt config) + { + _config = config; + InitializeComponent(); + } + + + private PwEntry GetConfigEntry(PwDatabase db) + { + var kphe = new KeePassHttpExt(); + var root = db.RootGroup; + var uuid = new PwUuid(kphe.KEEPASSHTTP_UUID); + var entry = root.FindEntry(uuid, false); + return entry; + } + + private void OptionsForm_Load(object sender, EventArgs e) + { + credNotifyCheckbox.Checked = _config.ReceiveCredentialNotification; + credMatchingCheckbox.Checked = _config.SpecificMatchingOnly; + unlockDatabaseCheckbox.Checked = _config.UnlockDatabaseRequest; + credAllowAccessCheckbox.Checked = _config.AlwaysAllowAccess; + credAllowUpdatesCheckbox.Checked = _config.AlwaysAllowUpdates; + credSearchInAllOpenedDatabases.Checked = _config.SearchInAllOpenedDatabases; + matchSchemesCheckbox.Checked = _config.MatchSchemes; + returnStringFieldsCheckbox.Checked = _config.ReturnStringFields; + SortByUsernameRadioButton.Checked = _config.SortResultByUsername; + SortByTitleRadioButton.Checked = !_config.SortResultByUsername; + listenerHostHttp.Text = _config.ListenerHostHttp; + portNumberHttp.Value = _config.ListenerPortHttp; + activateHttpsListenerCheckbox.Checked = _config.ActivateHttpsListener; + listenerHostHttps.Text = _config.ListenerHostHttps; + portNumberHttps.Value = _config.ListenerPortHttps; + + LinkLabel.Link link = new LinkLabel.Link(); + link.LinkData = "https://github.com/mheese/keepasshttp/wiki/Listener-Configuration"; + instructionsLink.Links.Add(link); + } + + private void okButton_Click(object sender, EventArgs e) + { + _config.ReceiveCredentialNotification = credNotifyCheckbox.Checked; + _config.SpecificMatchingOnly = credMatchingCheckbox.Checked; + _config.UnlockDatabaseRequest = unlockDatabaseCheckbox.Checked; + _config.AlwaysAllowAccess = credAllowAccessCheckbox.Checked; + _config.AlwaysAllowUpdates = credAllowUpdatesCheckbox.Checked; + _config.SearchInAllOpenedDatabases = credSearchInAllOpenedDatabases.Checked; + _config.MatchSchemes = matchSchemesCheckbox.Checked; + _config.ReturnStringFields = returnStringFieldsCheckbox.Checked; + _config.SortResultByUsername = SortByUsernameRadioButton.Checked; + _config.ListenerHostHttp = listenerHostHttp.Text; + _config.ListenerPortHttp = (int)portNumberHttp.Value; + _config.ActivateHttpsListener = activateHttpsListenerCheckbox.Checked; + _config.ListenerHostHttps = listenerHostHttps.Text; + _config.ListenerPortHttps = (int)portNumberHttps.Value; + + if (_restartRequired) + { + MessageBox.Show( + "You have successfully changed the port number or changed the host binding.\nA restart of KeePass is required!\n\nPlease restart KeePass now.", + "Restart required!", + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + } + + private void removeButton_Click(object sender, EventArgs e) + { + if (KeePass.Program.MainForm.DocumentManager.ActiveDatabase.IsOpen) + { + PwDatabase db = KeePass.Program.MainForm.DocumentManager.ActiveDatabase; + var entry = GetConfigEntry(db); + if (entry != null) + { + List deleteKeys = new List(); + + foreach (var s in entry.Strings) + { + if (s.Key.IndexOf(KeePassHttpExt.ASSOCIATE_KEY_PREFIX) == 0) + { + deleteKeys.Add(s.Key); + } + } + + + if(deleteKeys.Count > 0) + { + PwObjectList m_vHistory = entry.History.CloneDeep(); + entry.History = m_vHistory; + entry.CreateBackup(null); + + foreach (var key in deleteKeys) + { + entry.Strings.Remove(key); + } + + entry.Touch(true); + KeePass.Program.MainForm.UpdateUI(false, null, true, db.RootGroup, true, null, true); + MessageBox.Show( + String.Format("Successfully removed {0} encryption-key{1} from KeePassHttp Settings.", deleteKeys.Count.ToString(), deleteKeys.Count == 1 ? "" : "s"), + String.Format("Removed {0} key{1} from database", deleteKeys.Count.ToString(), deleteKeys.Count == 1 ? "" : "s"), + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + else + { + MessageBox.Show( + "No shared encryption-keys found in KeePassHttp Settings.", "No keys found", + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + } + else + { + MessageBox.Show("The active database does not contain an entry of KeePassHttp Settings.", "KeePassHttp Settings not available!", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + MessageBox.Show("The active database is locked!\nPlease unlock the selected database or choose another one which is unlocked.", "Database locked!", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void removePermissionsButton_Click(object sender, EventArgs e) + { + if (KeePass.Program.MainForm.DocumentManager.ActiveDatabase.IsOpen) + { + PwDatabase db = KeePass.Program.MainForm.DocumentManager.ActiveDatabase; + + uint counter = 0; + var entries = db.RootGroup.GetEntries(true); + + if (entries.Count() > 999) + { + MessageBox.Show( + String.Format("{0} entries detected!\nSearching and removing permissions could take some while.\n\nWe will inform you when the process has been finished.", entries.Count().ToString()), + String.Format("{0} entries detected", entries.Count().ToString()), + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + + foreach (var entry in entries) { + foreach (var str in entry.Strings) + { + if (str.Key == KeePassHttpExt.KEEPASSHTTP_NAME) + { + PwObjectList m_vHistory = entry.History.CloneDeep(); + entry.History = m_vHistory; + entry.CreateBackup(null); + + entry.Strings.Remove(str.Key); + + entry.Touch(true); + + counter += 1; + + break; + } + } + } + + if (counter > 0) + { + KeePass.Program.MainForm.UpdateUI(false, null, true, db.RootGroup, true, null, true); + MessageBox.Show( + String.Format("Successfully removed permissions from {0} entr{1}.", counter.ToString(), counter == 1 ? "y" : "ies"), + String.Format("Removed permissions from {0} entr{1}", counter.ToString(), counter == 1 ? "y" : "ies"), + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + else + { + MessageBox.Show( + "The active database does not contain an entry with permissions.", + "No entry with permissions found!", + MessageBoxButtons.OK, + MessageBoxIcon.Information + ); + } + } + else + { + MessageBox.Show("The active database is locked!\nPlease unlock the selected database or choose another one which is unlocked.", "Database locked!", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void portNumber_ValueChanged(object sender, EventArgs e) + { + checkRestartRequired(); + } + + private void listenerHost_TextChanged(object sender, EventArgs e) + { + checkRestartRequired(); + } + + private void activateHttpsListenerCheckbox_CheckedChanged(object sender, EventArgs e) + { + checkRestartRequired(); + } + + private void checkRestartRequired() + { + _restartRequired = ( + _config.ListenerPortHttp != portNumberHttp.Value || + _config.ListenerHostHttp != listenerHostHttp.Text || + _config.ActivateHttpsListener != activateHttpsListenerCheckbox.Checked || + _config.ListenerPortHttps != portNumberHttps.Value || + _config.ListenerHostHttps != listenerHostHttps.Text + ); + } + + private void instructionsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process.Start(e.Link.LinkData as string); + } + } +} diff --git a/KeePassHttp/OptionsForm.resx b/KeePassHttp/OptionsForm.resx index 4282a89..5937947 100644 --- a/KeePassHttp/OptionsForm.resx +++ b/KeePassHttp/OptionsForm.resx @@ -1,127 +1,132 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - If there are more fields needed than username + password, -normal "String Fields" are used, which can be defined in the -"Advanced" tab of an entry. -String fields are returned in alphabetical order and have to start -with "KPH: " (mind the space after KPH:). - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + If there are more fields needed than username + password, +normal "String Fields" are used, which can be defined in the +"Advanced" tab of an entry. +String fields are returned in alphabetical order and have to start +with "KPH: " (mind the space after KPH:). + + + Specify a different port number if you have connection problems, and specify a +different host name if you require access from a remote network. Then you +probably also want to enable the HTTPS listener. + \ No newline at end of file diff --git a/KeePassHttp/Properties/AssemblyInfo.cs b/KeePassHttp/Properties/AssemblyInfo.cs index 155adbe..9de9144 100644 --- a/KeePassHttp/Properties/AssemblyInfo.cs +++ b/KeePassHttp/Properties/AssemblyInfo.cs @@ -8,9 +8,9 @@ [assembly: AssemblyTitle("KeePassHttp")] [assembly: AssemblyDescription("A plugin to expose a secure HTTP interface to your KeePass database")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Perry Nguyen, Lukas Schulze")] +[assembly: AssemblyCompany("Marcus Heese, Perry Nguyen, Lukas Schulze")] [assembly: AssemblyProduct("KeePass Plugin")] -[assembly: AssemblyCopyright("Copyright © Perry Nguyen, Lukas Schulze 2013")] +[assembly: AssemblyCopyright("Copyright © Marcus Heese, Perry Nguyen, Lukas Schulze 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.21.0.0")] -[assembly: AssemblyFileVersion("1.8.3.0")] +[assembly: AssemblyVersion("2.22.0.0")] +[assembly: AssemblyFileVersion("1.9.0.1")] diff --git a/README.md b/README.md index e75aa45..a984b31 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # KeePassHttp -is a plugin for KeePass 2.x and provides a secure means of exposing KeePass entries via HTTP for clients to +is a plugin for KeePass 2.x and provides a secure means of exposing KeePass entries via HTTP or HTTPS for clients to consume. -This plugin is primarily intended for use with [PassIFox for Mozilla Firefox and chromeIPass for Google Chrome](https://github.com/pfn/passifox/). +This is a fork from [pfn/keepasshttp](https://github.com/pfn/keepasshttp). It is mainly intended to add remote access functionality to KeePassHttp. Have a look at the [Wiki section](https://github.com/mheese/keepasshttp/wiki/Listener-Configuration) on how to configure it! The rest is the same! Enjoy! + +This plugin is primarily intended for use with [PassIFox for Mozilla Firefox and chromeIPass for Google Chrome](https://github.com/pfn/passifox/). However, the listener HTTPS feature only works with passIFox at the moment, as you cannot specify https in chromeIPass yet. ## Features * returns all matching entries for a given URL diff --git a/latest-version.txt b/latest-version.txt index 3927bff..aa81dd8 100644 --- a/latest-version.txt +++ b/latest-version.txt @@ -1,3 +1,3 @@ : -KeePassHttp:1.8.3.0 +KeePassHttp:1.9.0.1 : diff --git a/update-version.txt b/update-version.txt index 3927bff..aa81dd8 100644 --- a/update-version.txt +++ b/update-version.txt @@ -1,3 +1,3 @@ : -KeePassHttp:1.8.3.0 +KeePassHttp:1.9.0.1 :