Add project files.
This commit is contained in:
158
SHA1Hash/Form1.Designer.cs
generated
Normal file
158
SHA1Hash/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,158 @@
|
||||
namespace SHA1Hash
|
||||
{
|
||||
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()
|
||||
{
|
||||
txtInput = new TextBox();
|
||||
label1 = new Label();
|
||||
btnHash = new Button();
|
||||
txtOutput = new TextBox();
|
||||
txtResult = new TextBox();
|
||||
lblStatus = new Label();
|
||||
txtDesc = new TextBox();
|
||||
btnCreateReport = new Button();
|
||||
btnZeroTrust = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
txtInput.Font = new Font("Consolas", 9F);
|
||||
txtInput.Location = new Point(12, 27);
|
||||
txtInput.Name = "txtInput";
|
||||
txtInput.Size = new Size(303, 22);
|
||||
txtInput.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(68, 15);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "Enter String";
|
||||
//
|
||||
// btnHash
|
||||
//
|
||||
btnHash.Location = new Point(321, 26);
|
||||
btnHash.Name = "btnHash";
|
||||
btnHash.Size = new Size(75, 23);
|
||||
btnHash.TabIndex = 2;
|
||||
btnHash.Text = "Hash";
|
||||
btnHash.UseVisualStyleBackColor = true;
|
||||
btnHash.Click += btnHash_Click;
|
||||
//
|
||||
// txtOutput
|
||||
//
|
||||
txtOutput.Font = new Font("Consolas", 9F);
|
||||
txtOutput.Location = new Point(12, 56);
|
||||
txtOutput.Name = "txtOutput";
|
||||
txtOutput.Size = new Size(303, 22);
|
||||
txtOutput.TabIndex = 3;
|
||||
//
|
||||
// txtResult
|
||||
//
|
||||
txtResult.Font = new Font("Consolas", 9F);
|
||||
txtResult.Location = new Point(12, 99);
|
||||
txtResult.Name = "txtResult";
|
||||
txtResult.Size = new Size(384, 22);
|
||||
txtResult.TabIndex = 4;
|
||||
//
|
||||
// lblStatus
|
||||
//
|
||||
lblStatus.AutoSize = true;
|
||||
lblStatus.Location = new Point(12, 81);
|
||||
lblStatus.Name = "lblStatus";
|
||||
lblStatus.Size = new Size(16, 15);
|
||||
lblStatus.TabIndex = 5;
|
||||
lblStatus.Text = "...";
|
||||
//
|
||||
// txtDesc
|
||||
//
|
||||
txtDesc.Font = new Font("Consolas", 9F);
|
||||
txtDesc.HideSelection = false;
|
||||
txtDesc.Location = new Point(12, 127);
|
||||
txtDesc.Multiline = true;
|
||||
txtDesc.Name = "txtDesc";
|
||||
txtDesc.ScrollBars = ScrollBars.Vertical;
|
||||
txtDesc.Size = new Size(384, 268);
|
||||
txtDesc.TabIndex = 6;
|
||||
//
|
||||
// btnCreateReport
|
||||
//
|
||||
btnCreateReport.Location = new Point(12, 401);
|
||||
btnCreateReport.Name = "btnCreateReport";
|
||||
btnCreateReport.Size = new Size(384, 23);
|
||||
btnCreateReport.TabIndex = 7;
|
||||
btnCreateReport.Text = "Create Report";
|
||||
btnCreateReport.UseVisualStyleBackColor = true;
|
||||
btnCreateReport.Click += btnCreateReport_Click;
|
||||
//
|
||||
// btnZeroTrust
|
||||
//
|
||||
btnZeroTrust.Location = new Point(321, 56);
|
||||
btnZeroTrust.Name = "btnZeroTrust";
|
||||
btnZeroTrust.Size = new Size(75, 23);
|
||||
btnZeroTrust.TabIndex = 8;
|
||||
btnZeroTrust.Text = "ZeroTrust";
|
||||
btnZeroTrust.UseVisualStyleBackColor = true;
|
||||
btnZeroTrust.Click += btnZeroTrust_Click;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AcceptButton = btnHash;
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(409, 436);
|
||||
Controls.Add(btnZeroTrust);
|
||||
Controls.Add(btnCreateReport);
|
||||
Controls.Add(txtDesc);
|
||||
Controls.Add(lblStatus);
|
||||
Controls.Add(txtResult);
|
||||
Controls.Add(txtOutput);
|
||||
Controls.Add(btnHash);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(txtInput);
|
||||
Name = "Form1";
|
||||
Text = "Password Checker";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox txtInput;
|
||||
private Label label1;
|
||||
private Button btnHash;
|
||||
private TextBox txtOutput;
|
||||
private TextBox txtResult;
|
||||
private Label lblStatus;
|
||||
private TextBox txtDesc;
|
||||
private Button btnCreateReport;
|
||||
private Button btnZeroTrust;
|
||||
}
|
||||
}
|
||||
180
SHA1Hash/Form1.cs
Normal file
180
SHA1Hash/Form1.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace SHA1Hash
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnZeroTrust_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtDesc.Text = "";
|
||||
txtOutput.Text = "";
|
||||
txtResult.Text = "";
|
||||
Application.DoEvents();
|
||||
string input = txtInput.Text;
|
||||
string hash = ComputeSHA1Hash(input);
|
||||
txtOutput.Text = hash;
|
||||
string iSha5 = hash.Substring(0, 5);
|
||||
Random random = new Random((int)DateTime.Now.Ticks);
|
||||
string iSha6 = hash.Substring(random.Next(6, 36), 3);
|
||||
string rHash = hash.Substring(5);
|
||||
txtOutput.Text = rHash;
|
||||
lblStatus.Text = "web request...";
|
||||
Application.DoEvents();
|
||||
string returnString = Task.Run(async () => await SendGetRequestWithShaAsyncZeroTrust("https://www.home.daprogs.net/pwn/zerotrust.php", iSha5, iSha6)).GetAwaiter().GetResult();
|
||||
//string returnString = Task.Run(async () => await SendGetRequestWithShaAsyncZeroTrust("https://www.daprogs.com/pwn/zerotrust.php", iSha5, iSha6)).GetAwaiter().GetResult();
|
||||
lblStatus.Text = "response...";
|
||||
Application.DoEvents();
|
||||
lblStatus.Text = $"request sent: {iSha5}-{iSha6}";
|
||||
Application.DoEvents();
|
||||
if (returnString.Contains("BAD"))
|
||||
{
|
||||
if(returnString.ToLower().Contains(rHash.ToLower()))
|
||||
{
|
||||
txtResult.Text = "BAD - Your password is listed";
|
||||
txtDesc.Text = $"{returnString.Replace("BAD:\r\n", "")}";
|
||||
int selectStart = txtDesc.Text.IndexOf(rHash.ToUpper());
|
||||
txtDesc.Select(selectStart, 35);
|
||||
}
|
||||
else
|
||||
txtResult.Text = "OK - Not in list";
|
||||
}
|
||||
else
|
||||
txtResult.Text = returnString;
|
||||
|
||||
txtInput.Focus();
|
||||
txtInput.SelectAll();
|
||||
}
|
||||
|
||||
private void btnHash_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtDesc.Text = "";
|
||||
txtOutput.Text = "";
|
||||
txtResult.Text = "";
|
||||
Application.DoEvents();
|
||||
string input = txtInput.Text;
|
||||
string hash = ComputeSHA1Hash(input);
|
||||
txtOutput.Text = hash;
|
||||
lblStatus.Text = "web request...";
|
||||
Application.DoEvents();
|
||||
string returnString = Task.Run(async () => await SendGetRequestWithShaAsync("https://www.home.daprogs.net/pwn/indexapi.php", hash)).GetAwaiter().GetResult();
|
||||
//string returnString = Task.Run(async () => await SendGetRequestWithShaAsync("https://www.daprogs.com/pwn/indexapi.php", hash)).GetAwaiter().GetResult();
|
||||
lblStatus.Text = "response...";
|
||||
Application.DoEvents();
|
||||
txtResult.Text = returnString;
|
||||
lblStatus.Text = "...";
|
||||
Application.DoEvents();
|
||||
if (returnString.Contains("BAD"))
|
||||
{
|
||||
txtDesc.Text = "This password is in the master list.\r\n";
|
||||
txtDesc.Text += $"It has been seen {txtResult.Text.Split(":")[1].Replace("\r\n", "")} times\r\n";
|
||||
txtDesc.Text += "Even a value of 1 is bad.\r\n";
|
||||
txtDesc.Text += "You need to change this password ASAP!\r\n";
|
||||
}
|
||||
txtInput.Focus();
|
||||
txtInput.SelectAll();
|
||||
}
|
||||
|
||||
public static string ComputeSHA1Hash(string input)
|
||||
{
|
||||
using (SHA1 sha1 = SHA1.Create())
|
||||
{
|
||||
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
|
||||
byte[] hashBytes = sha1.ComputeHash(inputBytes);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < hashBytes.Length; i++)
|
||||
{
|
||||
sb.Append(hashBytes[i].ToString("x2"));
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
async Task<string> SendGetRequestWithShaAsync(string url, string sha)
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
string fullUrl = $"{url}?sha1={Uri.EscapeDataString(sha)}";
|
||||
|
||||
HttpResponseMessage response = await client.GetAsync(fullUrl);
|
||||
response.EnsureSuccessStatusCode();
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
return responseBody;
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
return $"Request exception: {e.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async Task<string> SendGetRequestWithShaAsyncZeroTrust(string url, string sha5, string sha6)
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
string fullUrl = $"{url}?sha5={Uri.EscapeDataString(sha5)}&sha6={Uri.EscapeDataString(sha6)}";
|
||||
HttpResponseMessage response = await client.GetAsync(fullUrl);
|
||||
response.EnsureSuccessStatusCode();
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
return responseBody;
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
return $"Request exception: {e.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCreateReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (StreamWriter SW = new StreamWriter("userReport.txt", false))
|
||||
{
|
||||
using (StreamReader SR = new StreamReader("passList.csv"))
|
||||
{
|
||||
string passThing = SR.ReadToEnd();
|
||||
string[] passList = passThing.Split("\r\n");
|
||||
int cCount = 0;
|
||||
int tCount = passList.Count();
|
||||
foreach (string item in passList)
|
||||
{
|
||||
if (item.Contains(","))
|
||||
{
|
||||
string[] items = item.Split(",");
|
||||
string email = items[0].Split(";")[0] + "@" + items[2];
|
||||
string password = items[1];
|
||||
if (password.Length > 0)
|
||||
{
|
||||
string hash = ComputeSHA1Hash(password);
|
||||
txtOutput.Text = hash;
|
||||
txtResult.Text = $"{cCount}/{tCount}";
|
||||
lblStatus.Text = "web request...";
|
||||
Application.DoEvents();
|
||||
string returnString = Task.Run(async () => await SendGetRequestWithShaAsync("https://www.daprogs.com/pwn/indexapi.php", hash)).GetAwaiter().GetResult();
|
||||
lblStatus.Text = "response...";
|
||||
Application.DoEvents();
|
||||
if (returnString.Contains("BAD"))
|
||||
SW.WriteLine($"{email},Password is hacked!({returnString.Split(":")[1].Replace("\r\n", "")})");
|
||||
}
|
||||
}
|
||||
cCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
txtOutput.Text = "Complete.";
|
||||
lblStatus.Text = "Complete.";
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
SHA1Hash/Form1.resx
Normal file
120
SHA1Hash/Form1.resx
Normal file
@@ -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>
|
||||
11
SHA1Hash/PasswordChecker.csproj
Normal file
11
SHA1Hash/PasswordChecker.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
17
SHA1Hash/Program.cs
Normal file
17
SHA1Hash/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace SHA1Hash
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user