Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Configuration;
- using System.Data;
- using System.Drawing;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Forms;
- namespace GTA_V_Native_Hash_Cracker_GUI
- {
- public partial class Form1 : Form
- {
- Thread Cracker1;
- Bruteforce bf1;
- delegate void Cracker1_Report(string r);
- bool Cracker1_Cracking;
- uint hash1;
- int min1;
- int max1;
- Thread Cracker2;
- Bruteforce bf2;
- delegate void Cracker2_Report(string r);
- bool Cracker2_Cracking;
- uint hash2;
- int min2;
- int max2;
- private uint CreateHash(string Native)
- {
- uint num = 0;
- byte[] bytes = Encoding.UTF8.GetBytes(Native);
- for (int i = 0; i < bytes.Length; i++)
- {
- num += bytes[i];
- num += num << 10;
- num ^= num >> 6;
- }
- num += num << 3;
- num ^= num >> 11;
- return (num + (num << 15));
- }
- private void HashCrack1()
- {
- bf1 = new Bruteforce();
- bf1.min = min1;
- bf1.max = max1;
- foreach (string str in bf1)
- {
- if (CreateHash(str) == hash1)
- {
- Cracker1_Report r = new Cracker1_Report(CollisionFound1);
- Invoke(r, "Hash Cracked: " + str);
- }
- }
- }
- private void CollisionFound1(string collision)
- {
- bf_out.Items.Add(collision);
- NotifyIcon n = new NotifyIcon();
- n.ShowBalloonTip(5000, "Hash Cracked!", "The hash you have requested has been cracked! :)\n" + collision, ToolTipIcon.Info);
- }
- private void HashCrack2()
- {
- bf2 = new Bruteforce();
- bf2.min = min2;
- bf2.max = max2;
- foreach (string str in bf2)
- {
- if (CreateHash(pbf_p.Text + "_" + str) == hash2)
- {
- Cracker1_Report r = new Cracker1_Report(CollisionFound2);
- Invoke(r, "Hash Cracked: " + str);
- }
- }
- }
- private void CollisionFound2(string collision)
- {
- pbf_out.Items.Add(collision);
- NotifyIcon n = new NotifyIcon();
- n.ShowBalloonTip(5000, "Hash Cracked!", "The hash you have requested has been cracked! :)\n" + collision, ToolTipIcon.Info);
- }
- public Form1()
- {
- InitializeComponent();
- Cracker1_Cracking = false;
- Cracker2_Cracking = false;
- }
- private void hashes_browse_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Title = "Search for a Text Document with natives in it...";
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- hashes_path.Text = ofd.FileName;
- hashes_natives.Text = File.ReadAllText(ofd.FileName);
- hashes_out.Text = "";
- }
- }
- private void hashes_create_Click(object sender, EventArgs e)
- {
- hashes_out.Text = "";
- foreach (string str in hashes_natives.Text.Split("\n".ToCharArray()))
- hashes_out.Text += "0x" + CreateHash(str).ToString("X8") + "\n";
- hashes_out.Text.TrimEnd("\n".ToCharArray());
- }
- private void singlehash_create_Click(object sender, EventArgs e)
- {
- singlehash_out.Text = "0x" + CreateHash(singlehash_native.Text).ToString("X8");
- }
- private void bf_toggle_Click(object sender, EventArgs e)
- {
- min1 = (int)bf_min.Value;
- max1 = (int)bf_max.Value;
- hash1 = uint.Parse(bf_hash.Text.Replace("0x", ""), NumberStyles.HexNumber);
- if (Cracker1_Cracking)
- {
- Cracker1.Abort();
- Cracker1_Cracking = false;
- }
- else
- {
- Cracker1 = new Thread(HashCrack1);
- Cracker1.Start();
- Cracker1_Cracking = true;
- }
- }
- private void pbf_toggle_Click(object sender, EventArgs e)
- {
- min2 = (int)pbf_min.Value;
- max2 = (int)pbf_max.Value;
- hash2 = uint.Parse(pbf_hash.Text.Replace("0x", ""), NumberStyles.HexNumber);
- if (Cracker2_Cracking)
- {
- Cracker2.Abort();
- Cracker2_Cracking = false;
- }
- else
- {
- Cracker2 = new Thread(HashCrack2);
- Cracker2.Start();
- Cracker2_Cracking = true;
- }
- }
- }
- public class Bruteforce : IEnumerable
- {
- private StringBuilder sb = new StringBuilder();
- public string charset = "abcdefghijklmnopqrstuvwxyz_";
- private ulong len;
- private int _max;
- public int max { get { return _max; } set { _max = value; } }
- private int _min;
- public int min { get { return _min; } set { _min = value; } }
- public System.Collections.IEnumerator GetEnumerator()
- {
- len = (ulong)this.charset.Length;
- for (double x = min; x <= max; x++)
- {
- ulong total = (ulong)Math.Pow((double)charset.Length, (double)x);
- ulong counter = 0;
- while (counter < total)
- {
- string a = factoradic(counter, x - 1);
- yield return a;
- counter++;
- }
- }
- }
- private string factoradic(ulong l, double power)
- {
- sb.Length = 0;
- while (power >= 0)
- {
- sb = sb.Append(this.charset[(int)(l % len)]);
- l /= len;
- power--;
- }
- return sb.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement