added project files
This commit is contained in:
parent
53aff45b33
commit
775195e771
|
@ -0,0 +1,316 @@
|
|||
namespace KRY_0x04_netcore
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
|
||||
this.richTextBox3 = new System.Windows.Forms.RichTextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(437, 102);
|
||||
this.richTextBox1.TabIndex = 5;
|
||||
this.richTextBox1.Text = "";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(467, 120);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "load msg";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(12, 120);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.ReadOnly = true;
|
||||
this.textBox1.Size = new System.Drawing.Size(437, 20);
|
||||
this.textBox1.TabIndex = 2;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(467, 229);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 6;
|
||||
this.button2.Text = "re-compute";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(467, 342);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(75, 23);
|
||||
this.button3.TabIndex = 7;
|
||||
this.button3.Text = "load privkey";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(467, 433);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(75, 23);
|
||||
this.button4.TabIndex = 8;
|
||||
this.button4.Text = "load pubkey";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(558, 120);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(75, 23);
|
||||
this.button5.TabIndex = 9;
|
||||
this.button5.Text = "save msg";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
this.button5.Click += new System.EventHandler(this.button5_Click);
|
||||
//
|
||||
// richTextBox2
|
||||
//
|
||||
this.richTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.richTextBox2.Location = new System.Drawing.Point(12, 309);
|
||||
this.richTextBox2.Name = "richTextBox2";
|
||||
this.richTextBox2.ReadOnly = true;
|
||||
this.richTextBox2.Size = new System.Drawing.Size(437, 55);
|
||||
this.richTextBox2.TabIndex = 10;
|
||||
this.richTextBox2.Text = "";
|
||||
//
|
||||
// richTextBox3
|
||||
//
|
||||
this.richTextBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.richTextBox3.Location = new System.Drawing.Point(12, 401);
|
||||
this.richTextBox3.Name = "richTextBox3";
|
||||
this.richTextBox3.ReadOnly = true;
|
||||
this.richTextBox3.Size = new System.Drawing.Size(437, 55);
|
||||
this.richTextBox3.TabIndex = 11;
|
||||
this.richTextBox3.Text = "";
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(12, 203);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.ReadOnly = true;
|
||||
this.textBox2.Size = new System.Drawing.Size(437, 20);
|
||||
this.textBox2.TabIndex = 12;
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Location = new System.Drawing.Point(558, 342);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(75, 23);
|
||||
this.button6.TabIndex = 13;
|
||||
this.button6.Text = "sign";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
this.button6.Click += new System.EventHandler(this.button6_Click);
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Location = new System.Drawing.Point(558, 433);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(75, 23);
|
||||
this.button7.TabIndex = 14;
|
||||
this.button7.Text = "verify";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
this.button7.Click += new System.EventHandler(this.button7_Click);
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.textBox3.Location = new System.Drawing.Point(12, 229);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.ReadOnly = true;
|
||||
this.textBox3.Size = new System.Drawing.Size(437, 13);
|
||||
this.textBox3.TabIndex = 15;
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.Location = new System.Drawing.Point(558, 229);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(75, 23);
|
||||
this.button8.TabIndex = 16;
|
||||
this.button8.Tag = "";
|
||||
this.button8.Text = "save sha";
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
this.button8.Click += new System.EventHandler(this.button8_Click);
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.Location = new System.Drawing.Point(467, 268);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(75, 23);
|
||||
this.button9.TabIndex = 17;
|
||||
this.button9.Text = "zip";
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
this.button9.Click += new System.EventHandler(this.button9_Click);
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.Location = new System.Drawing.Point(558, 268);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(75, 23);
|
||||
this.button10.TabIndex = 18;
|
||||
this.button10.Text = "unzip";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
//
|
||||
// button12
|
||||
//
|
||||
this.button12.Location = new System.Drawing.Point(727, 342);
|
||||
this.button12.Name = "button12";
|
||||
this.button12.Size = new System.Drawing.Size(75, 23);
|
||||
this.button12.TabIndex = 21;
|
||||
this.button12.Text = "clean ALL";
|
||||
this.button12.UseVisualStyleBackColor = true;
|
||||
this.button12.Click += new System.EventHandler(this.button12_Click);
|
||||
//
|
||||
// button13
|
||||
//
|
||||
this.button13.Location = new System.Drawing.Point(467, 203);
|
||||
this.button13.Name = "button13";
|
||||
this.button13.Size = new System.Drawing.Size(75, 23);
|
||||
this.button13.TabIndex = 22;
|
||||
this.button13.Text = "load sha256";
|
||||
this.button13.UseVisualStyleBackColor = true;
|
||||
this.button13.Click += new System.EventHandler(this.button13_Click);
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(12, 370);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.ReadOnly = true;
|
||||
this.textBox5.Size = new System.Drawing.Size(437, 20);
|
||||
this.textBox5.TabIndex = 23;
|
||||
//
|
||||
// textBox6
|
||||
//
|
||||
this.textBox6.Location = new System.Drawing.Point(12, 462);
|
||||
this.textBox6.Name = "textBox6";
|
||||
this.textBox6.ReadOnly = true;
|
||||
this.textBox6.Size = new System.Drawing.Size(437, 20);
|
||||
this.textBox6.TabIndex = 24;
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(12, 146);
|
||||
this.textBox4.Multiline = true;
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.ReadOnly = true;
|
||||
this.textBox4.Size = new System.Drawing.Size(437, 51);
|
||||
this.textBox4.TabIndex = 25;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(814, 496);
|
||||
this.Controls.Add(this.textBox4);
|
||||
this.Controls.Add(this.textBox6);
|
||||
this.Controls.Add(this.textBox5);
|
||||
this.Controls.Add(this.button13);
|
||||
this.Controls.Add(this.button12);
|
||||
this.Controls.Add(this.button10);
|
||||
this.Controls.Add(this.button9);
|
||||
this.Controls.Add(this.button8);
|
||||
this.Controls.Add(this.textBox3);
|
||||
this.Controls.Add(this.button7);
|
||||
this.Controls.Add(this.button6);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.richTextBox3);
|
||||
this.Controls.Add(this.richTextBox2);
|
||||
this.Controls.Add(this.button5);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "Form1";
|
||||
this.ShowIcon = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "kry-0x04-netcore";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
private System.Windows.Forms.RichTextBox richTextBox2;
|
||||
private System.Windows.Forms.RichTextBox richTextBox3;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.Button button7;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.Button button8;
|
||||
private System.Windows.Forms.Button button9;
|
||||
private System.Windows.Forms.Button button10;
|
||||
private System.Windows.Forms.Button button12;
|
||||
private System.Windows.Forms.Button button13;
|
||||
private System.Windows.Forms.TextBox textBox5;
|
||||
private System.Windows.Forms.TextBox textBox6;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,423 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace KRY_0x04_netcore
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string path = "";
|
||||
|
||||
string sha256sum(string path)
|
||||
{
|
||||
string sha256sum = "";
|
||||
try
|
||||
{
|
||||
FileStream my_filestream = File.OpenRead(path);
|
||||
SHA256Managed my_sha_256_managed = new SHA256Managed();
|
||||
byte[] byte_array_of_sha256 = my_sha_256_managed.ComputeHash(my_filestream);
|
||||
sha256sum = BitConverter.ToString(byte_array_of_sha256).Replace("-", string.Empty).ToLower();
|
||||
|
||||
my_filestream.Close();
|
||||
my_sha_256_managed.Clear();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("https://xkcd.com/2200 \nerror: " + e.ToString(), "this should never have happened",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
return sha256sum;
|
||||
}
|
||||
|
||||
string get_file_metrics(string filename)
|
||||
{
|
||||
string metrics = "";
|
||||
metrics += $"created: " + $"{File.GetCreationTime(filename)}" + Environment.NewLine;
|
||||
metrics += $"file type: " + $"{Path.GetExtension(filename)}";
|
||||
return metrics;
|
||||
}
|
||||
|
||||
BigInteger return_bigint_representation_of_message(string input)
|
||||
{
|
||||
byte[] part_of_message = Encoding.ASCII.GetBytes(input);
|
||||
return new BigInteger(part_of_message);
|
||||
}
|
||||
|
||||
string return_string_representation_of_bigint(BigInteger bA_number)
|
||||
{
|
||||
byte[] decrypted_b_a = bA_number.ToByteArray();
|
||||
string decrypted_text = "";
|
||||
for (int i = 0; i < decrypted_b_a.Length; i++)
|
||||
{
|
||||
decrypted_text += Convert.ToString(Convert.ToChar(decrypted_b_a[i]));
|
||||
}
|
||||
return decrypted_text;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* load msg */
|
||||
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "pick a msg";
|
||||
/* freedom for all */
|
||||
dlg.Filter = "message (*.msg)|*.msg|custom (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
richTextBox1.Text = File.ReadAllText(dlg.FileName);
|
||||
textBox1.Text = dlg.FileName;
|
||||
string f = dlg.FileName;
|
||||
textBox4.Text = get_file_metrics(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* save msg */
|
||||
|
||||
if (richTextBox1.Text == "")
|
||||
{
|
||||
MessageBox.Show("you've nothing to dump, friend ()");
|
||||
return;
|
||||
}
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
saveFileDialog1.Title = "export msg";
|
||||
saveFileDialog1.CheckFileExists = false;
|
||||
saveFileDialog1.CheckPathExists = false;
|
||||
saveFileDialog1.DefaultExt = "";
|
||||
saveFileDialog1.Filter = "msg (*.msg)|*.msg|any file you wish (*.*)|*.*";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(saveFileDialog1.FileName, richTextBox1.Text);
|
||||
MessageBox.Show($"saved to {saveFileDialog1.FileName}", "gj, file saved!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("error: " + ex.ToString(), "this didn't work...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* compute sha256 */
|
||||
|
||||
if (textBox1.Text != "")
|
||||
{
|
||||
textBox3.Text = sha256sum(textBox1.Text);
|
||||
textBox3.BorderStyle = BorderStyle.Fixed3D;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("please first load a file, thanks", "why are you doing this to me");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* load privkey */
|
||||
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "pick a privkey";
|
||||
/* freedom for all */
|
||||
dlg.Filter = "private key (*.pri)|*.pri|custom (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
richTextBox2.Text = File.ReadAllText(dlg.FileName);
|
||||
textBox5.Text = dlg.FileName;
|
||||
//path = textBox5.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* load pubkey */
|
||||
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "pick a pubkey";
|
||||
/* freedom for all */
|
||||
dlg.Filter = "public key (*.pub)|*.pub|custom (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
richTextBox3.Text = File.ReadAllText(dlg.FileName);
|
||||
textBox6.Text = dlg.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button8_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* save sha256sum */
|
||||
|
||||
if (textBox3.Text == "")
|
||||
{
|
||||
MessageBox.Show("you've nothing to dump, friend ()");
|
||||
return;
|
||||
}
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
saveFileDialog.Title = "export checksum";
|
||||
saveFileDialog.CheckFileExists = false;
|
||||
saveFileDialog.CheckPathExists = false;
|
||||
saveFileDialog.DefaultExt = "";
|
||||
saveFileDialog.Filter = "sha256sum (*.sha256sum)|*.sha256sum|any file you wish (*.*)|*.*";
|
||||
saveFileDialog.FilterIndex = 2;
|
||||
saveFileDialog.RestoreDirectory = true;
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(saveFileDialog.FileName, textBox3.Text);
|
||||
MessageBox.Show($"saved to {saveFileDialog.FileName}", "gj, file saved!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("error: " + ex.ToString(), "this didn't work...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button13_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* load sha256 */
|
||||
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "pick a sha256sum";
|
||||
/* freedom for all */
|
||||
dlg.Filter = "sha256sum (*.sha256sum)|*.sha256sum|custom (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
textBox2.Text = File.ReadAllText(dlg.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button9_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* zip */
|
||||
if (textBox1.Text == "")
|
||||
{
|
||||
MessageBox.Show("load a msg file first, please", "oh hey");
|
||||
return;
|
||||
}
|
||||
using (FolderBrowserDialog dlg = new FolderBrowserDialog())
|
||||
{
|
||||
dlg.Description = "choose a folder to zip";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string pathTo_dirToZip = dlg.SelectedPath;
|
||||
using (SaveFileDialog dlggg = new SaveFileDialog())
|
||||
{
|
||||
dlggg.Title = "where to save sha256sum of earlier specified msg";
|
||||
dlggg.Filter = "sha256sum (*.sha256sum)|*.sha256sum|sh256sum in windows-recognizable text file ending with \"txt\" (*.txt)|*.txt|custom (*.*)|*.*";
|
||||
if (dlggg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path_to_sha256sum = dlggg.FileName;
|
||||
// VYTVORENI ADRESARE dirToZip
|
||||
if (path_to_sha256sum == "")
|
||||
{
|
||||
MessageBox.Show("please specify a path first", "not this again, come on");
|
||||
return;
|
||||
}
|
||||
Directory.CreateDirectory(pathTo_dirToZip);
|
||||
|
||||
// VYTVORENI/ZAPIS SOUBORU sha256OfMessage.txt DO ADRESARE dirToZip
|
||||
// OBSAHEM SOUBORU sha256OfMessage.txt je SHA256 OTISK SOUBORU, KTERY SE NACHAZI NA CESTE pathToMessageForTransfer
|
||||
File.WriteAllText(path_to_sha256sum, sha256sum(textBox1.Text));
|
||||
|
||||
try
|
||||
{
|
||||
if (File.Exists(pathTo_dirToZip + "zipfile.zip"))
|
||||
{
|
||||
MessageBox.Show($"file exists: {pathTo_dirToZip + "zipfile.zip"}\ndeleting", "ayy");
|
||||
File.Delete(pathTo_dirToZip + "zipfile.zip");
|
||||
}
|
||||
|
||||
ZipFile.CreateFromDirectory(pathTo_dirToZip, pathTo_dirToZip + "zipfile.zip");
|
||||
MessageBox.Show("great success!", "gj, zip created");
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
MessageBox.Show("error: " + exception.ToString(), "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void button10_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* unzip */
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "choose a zip file to unzip";
|
||||
dlg.Filter = "zip (*.zip)|*.zip|custom (*.*)|*.*";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string zipfile = dlg.FileName;
|
||||
using (FolderBrowserDialog dlgg = new FolderBrowserDialog())
|
||||
{
|
||||
dlgg.Description = "select folder to unzip the zip to yeeeaaah";
|
||||
if (dlgg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string pathTo_UnzippedDir = dlgg.SelectedPath;
|
||||
path = pathTo_UnzippedDir;
|
||||
|
||||
if (Directory.Exists(pathTo_UnzippedDir))
|
||||
{
|
||||
pathTo_UnzippedDir = pathTo_UnzippedDir + "-NEW-" + DateTime.Now.ToString("yyyyMMddTHHmmss");
|
||||
MessageBox.Show("dir exists, created a new one with the same name + date", "just so you know");
|
||||
Directory.CreateDirectory(pathTo_UnzippedDir);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ZipFile.ExtractToDirectory(zipfile, pathTo_UnzippedDir);
|
||||
MessageBox.Show("great success!", "gj, archive unzipped");
|
||||
}
|
||||
catch (IOException exc)
|
||||
{
|
||||
MessageBox.Show("error: " + exc.ToString(), "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* sign */
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
string[] keys = richTextBox2.Text.Split(' ');
|
||||
MessageBox.Show("we good?");
|
||||
Console.WriteLine(BigInteger.Parse(keys[1]));
|
||||
Console.WriteLine(BigInteger.Parse(keys[0]));
|
||||
string signed = Convert.ToString(BigInteger.ModPow(return_bigint_representation_of_message(textBox3.Text), BigInteger.Parse(keys[1]), BigInteger.Parse(keys[0])));
|
||||
|
||||
|
||||
saveFileDialog1.Title = ".sign";
|
||||
saveFileDialog1.CheckFileExists = false;
|
||||
saveFileDialog1.CheckPathExists = false;
|
||||
saveFileDialog1.DefaultExt = "";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(saveFileDialog1.FileName, signed);
|
||||
MessageBox.Show($"saved to {saveFileDialog1.FileName}", "gj, file saved!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("error: " + ex.ToString(), "this didn't work...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* verify */
|
||||
string[] keys = richTextBox3.Text.Split(' ');
|
||||
string verified = "";
|
||||
string orig_message = "";
|
||||
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "pick a .sign file";
|
||||
/* freedom for all */
|
||||
dlg.Filter = "sign file (*.sign)|*.sign|custom (*.*)|*.*";
|
||||
MessageBox.Show("we still good");
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
verified = return_string_representation_of_bigint(BigInteger.ModPow(BigInteger.Parse(File.ReadAllText(dlg.FileName)), BigInteger.Parse(keys[1]), BigInteger.Parse(keys[0])));
|
||||
}
|
||||
catch (Exception excep)
|
||||
{
|
||||
MessageBox.Show("error: " + excep.ToString(), "this didn't work...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "pick a .msg file";
|
||||
/* freedom for all */
|
||||
dlg.Filter = "msg file (*.msg)|*.msg|custom (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
orig_message = dlg.FileName;
|
||||
}
|
||||
catch (Exception excep)
|
||||
{
|
||||
MessageBox.Show("error: " + excep.ToString(), "this didn't work...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sha256sum(orig_message) == verified)
|
||||
{
|
||||
MessageBox.Show($"{sha256sum(orig_message)} == {verified}", "we good");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"orig message: {orig_message}");
|
||||
Console.WriteLine($"verif message: {verified}");
|
||||
MessageBox.Show("something is seriously wrong", "checksums differ!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private void button12_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBox1.Text = "";
|
||||
textBox2.Text = "";
|
||||
textBox3.Text = "";
|
||||
textBox4.Text = "";
|
||||
textBox5.Text = "";
|
||||
textBox6.Text = "";
|
||||
richTextBox1.Text = "";
|
||||
richTextBox2.Text = "";
|
||||
richTextBox3.Text = "";
|
||||
path = "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>KRY_0x04_netcore</RootNamespace>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29827.131
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KRY-0x04-netcore", "KRY-0x04-netcore.csproj", "{457865BB-F2FE-4871-8CB8-D08A86251034}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{457865BB-F2FE-4871-8CB8-D08A86251034}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{457865BB-F2FE-4871-8CB8-D08A86251034}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{457865BB-F2FE-4871-8CB8-D08A86251034}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{457865BB-F2FE-4871-8CB8-D08A86251034}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8C1B9A7E-1C64-4E15-8272-851852D6BF7B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace KRY_0x04_netcore
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue