Master Password field and clipboard cleared
This commit is contained in:
parent
36b699b1d1
commit
57c213312c
Binary file not shown.
15
OnePass/Form1.Designer.cs
generated
15
OnePass/Form1.Designer.cs
generated
@ -47,6 +47,7 @@ namespace OnePass
|
||||
this.numbers = new System.Windows.Forms.Label();
|
||||
this.special = new System.Windows.Forms.Label();
|
||||
this.extspc = new System.Windows.Forms.Label();
|
||||
this.help = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.passCycle)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.passLength)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -152,7 +153,7 @@ namespace OnePass
|
||||
//
|
||||
this.sitename.Location = new System.Drawing.Point(43, 6);
|
||||
this.sitename.Name = "sitename";
|
||||
this.sitename.Size = new System.Drawing.Size(325, 20);
|
||||
this.sitename.Size = new System.Drawing.Size(290, 20);
|
||||
this.sitename.TabIndex = 9;
|
||||
//
|
||||
// username
|
||||
@ -246,11 +247,22 @@ namespace OnePass
|
||||
this.extspc.Text = "Ext%";
|
||||
this.extspc.Click += new System.EventHandler(this.extspc_Click);
|
||||
//
|
||||
// help
|
||||
//
|
||||
this.help.Location = new System.Drawing.Point(339, 4);
|
||||
this.help.Name = "help";
|
||||
this.help.Size = new System.Drawing.Size(29, 23);
|
||||
this.help.TabIndex = 18;
|
||||
this.help.Text = "?";
|
||||
this.help.UseVisualStyleBackColor = true;
|
||||
this.help.Click += new System.EventHandler(this.help_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(380, 180);
|
||||
this.Controls.Add(this.help);
|
||||
this.Controls.Add(this.extspc);
|
||||
this.Controls.Add(this.special);
|
||||
this.Controls.Add(this.numbers);
|
||||
@ -299,6 +311,7 @@ namespace OnePass
|
||||
private System.Windows.Forms.Label numbers;
|
||||
private System.Windows.Forms.Label special;
|
||||
private System.Windows.Forms.Label extspc;
|
||||
private System.Windows.Forms.Button help;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@ -8,47 +9,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace OnePass
|
||||
{
|
||||
class ImageHolder
|
||||
{
|
||||
string site;
|
||||
string login;
|
||||
byte isize;
|
||||
byte[] imagedata;
|
||||
public ImageHolder(Bitmap img,string sitename,string login)
|
||||
{
|
||||
site = sitename;
|
||||
this.login = login;
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
|
||||
imagedata = ms.ToArray();
|
||||
isize = (byte)ms.Length;
|
||||
}
|
||||
}
|
||||
public ImageHolder(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open)))
|
||||
{
|
||||
site = reader.ReadString();
|
||||
login = reader.ReadString();
|
||||
isize = reader.ReadByte();
|
||||
imagedata = reader.ReadBytes(isize);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void tofile(string filename)
|
||||
{
|
||||
using (BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.Open)))
|
||||
{
|
||||
bw.Write(site);
|
||||
bw.Write(login);
|
||||
bw.Write(isize);
|
||||
bw.Write(imagedata);
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
@ -215,13 +175,21 @@ namespace OnePass
|
||||
temp = b;
|
||||
seed ^= (temp << (c++ % 8) * 8);
|
||||
}
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(GenerateKey((uint)passLength.Value, seed, ref chars));
|
||||
} catch
|
||||
{
|
||||
MessageBox.Show("Attempt to capture clipboard data over the network! (Are you using remote desktop w/clipboard)");
|
||||
}
|
||||
masterpass.Text = "";
|
||||
Generate.Text = "Copied to Clipboard";
|
||||
Generate.Enabled = false;
|
||||
this.Update();
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(7000);
|
||||
Generate.Text = "Generate Password";
|
||||
Generate.Enabled = true;
|
||||
Clipboard.Clear();
|
||||
}
|
||||
|
||||
private void extspc_Click(object sender, EventArgs e)
|
||||
@ -235,5 +203,51 @@ namespace OnePass
|
||||
extspc.BackColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
}
|
||||
}
|
||||
|
||||
private void help_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("When a password is generated the password will live on your clipboard for 7 seconds (paste it quick). Then your master password and the clipboard is also cleared out! Make sure nothing important is on the clipboard!","Help!");
|
||||
}
|
||||
}
|
||||
class ImageHolder
|
||||
{
|
||||
string site;
|
||||
string login;
|
||||
byte isize;
|
||||
byte[] imagedata;
|
||||
public ImageHolder(Bitmap img, string sitename, string login)
|
||||
{
|
||||
site = sitename;
|
||||
this.login = login;
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
|
||||
imagedata = ms.ToArray();
|
||||
isize = (byte)ms.Length;
|
||||
}
|
||||
}
|
||||
public ImageHolder(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open)))
|
||||
{
|
||||
site = reader.ReadString();
|
||||
login = reader.ReadString();
|
||||
isize = reader.ReadByte();
|
||||
imagedata = reader.ReadBytes(isize);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void tofile(string filename)
|
||||
{
|
||||
using (BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.Open)))
|
||||
{
|
||||
bw.Write(site);
|
||||
bw.Write(login);
|
||||
bw.Write(isize);
|
||||
bw.Write(imagedata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user