Advertisement
IAmXeClutch

[Project] GTA V Natives Tool GUI

Jul 1st, 2014
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.29 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Configuration;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Globalization;
  9. using System.IO;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using System.Windows.Forms;
  16.  
  17. namespace GTA_V_Native_Hash_Cracker_GUI
  18. {
  19.     public partial class Form1 : Form
  20.     {
  21.         Thread Cracker1;
  22.         Bruteforce bf1;
  23.         delegate void Cracker1_Report(string r);
  24.         bool Cracker1_Cracking;
  25.         uint hash1;
  26.         int min1;
  27.         int max1;
  28.  
  29.         Thread Cracker2;
  30.         Bruteforce bf2;
  31.         delegate void Cracker2_Report(string r);
  32.         bool Cracker2_Cracking;
  33.         uint hash2;
  34.         int min2;
  35.         int max2;
  36.  
  37.  
  38.         private uint CreateHash(string Native)
  39.         {
  40.             uint num = 0;
  41.             byte[] bytes = Encoding.UTF8.GetBytes(Native);
  42.             for (int i = 0; i < bytes.Length; i++)
  43.             {
  44.                 num += bytes[i];
  45.                 num += num << 10;
  46.                 num ^= num >> 6;
  47.             }
  48.             num += num << 3;
  49.             num ^= num >> 11;
  50.             return (num + (num << 15));
  51.         }
  52.  
  53.         private void HashCrack1()
  54.         {
  55.             bf1 = new Bruteforce();
  56.             bf1.min = min1;
  57.             bf1.max = max1;
  58.             foreach (string str in bf1)
  59.             {
  60.                 if (CreateHash(str) == hash1)
  61.                 {
  62.                     Cracker1_Report r = new Cracker1_Report(CollisionFound1);
  63.                     Invoke(r, "Hash Cracked: " + str);
  64.                 }
  65.             }
  66.         }
  67.  
  68.         private void CollisionFound1(string collision)
  69.         {
  70.             bf_out.Items.Add(collision);
  71.             NotifyIcon n = new NotifyIcon();
  72.             n.ShowBalloonTip(5000, "Hash Cracked!", "The hash you have requested has been cracked! :)\n" + collision, ToolTipIcon.Info);
  73.         }
  74.  
  75.         private void HashCrack2()
  76.         {
  77.             bf2 = new Bruteforce();
  78.             bf2.min = min2;
  79.             bf2.max = max2;
  80.             foreach (string str in bf2)
  81.             {
  82.                 if (CreateHash(pbf_p.Text + "_" + str) == hash2)
  83.                 {
  84.                     Cracker1_Report r = new Cracker1_Report(CollisionFound2);
  85.                     Invoke(r, "Hash Cracked: " + str);
  86.                 }
  87.             }
  88.         }
  89.  
  90.         private void CollisionFound2(string collision)
  91.         {
  92.             pbf_out.Items.Add(collision);
  93.             NotifyIcon n = new NotifyIcon();
  94.             n.ShowBalloonTip(5000, "Hash Cracked!", "The hash you have requested has been cracked! :)\n" + collision, ToolTipIcon.Info);
  95.         }
  96.  
  97.         public Form1()
  98.         {
  99.             InitializeComponent();
  100.  
  101.             Cracker1_Cracking = false;
  102.  
  103.             Cracker2_Cracking = false;
  104.         }
  105.  
  106.         private void hashes_browse_Click(object sender, EventArgs e)
  107.         {
  108.             OpenFileDialog ofd = new OpenFileDialog();
  109.             ofd.Title = "Search for a Text Document with natives in it...";
  110.             if (ofd.ShowDialog() == DialogResult.OK)
  111.             {
  112.                 hashes_path.Text = ofd.FileName;
  113.                 hashes_natives.Text = File.ReadAllText(ofd.FileName);
  114.                 hashes_out.Text = "";
  115.             }
  116.         }
  117.  
  118.         private void hashes_create_Click(object sender, EventArgs e)
  119.         {
  120.             hashes_out.Text = "";
  121.             foreach (string str in hashes_natives.Text.Split("\n".ToCharArray()))
  122.                 hashes_out.Text += "0x" + CreateHash(str).ToString("X8") + "\n";
  123.             hashes_out.Text.TrimEnd("\n".ToCharArray());
  124.         }
  125.  
  126.         private void singlehash_create_Click(object sender, EventArgs e)
  127.         {
  128.             singlehash_out.Text = "0x" + CreateHash(singlehash_native.Text).ToString("X8");
  129.         }
  130.  
  131.         private void bf_toggle_Click(object sender, EventArgs e)
  132.         {
  133.             min1 = (int)bf_min.Value;
  134.             max1 = (int)bf_max.Value;
  135.             hash1 = uint.Parse(bf_hash.Text.Replace("0x", ""), NumberStyles.HexNumber);
  136.             if (Cracker1_Cracking)
  137.             {
  138.                 Cracker1.Abort();
  139.                 Cracker1_Cracking = false;
  140.             }
  141.             else
  142.             {
  143.                 Cracker1 = new Thread(HashCrack1);
  144.                 Cracker1.Start();
  145.                 Cracker1_Cracking = true;
  146.             }
  147.         }
  148.  
  149.         private void pbf_toggle_Click(object sender, EventArgs e)
  150.         {
  151.             min2 = (int)pbf_min.Value;
  152.             max2 = (int)pbf_max.Value;
  153.             hash2 = uint.Parse(pbf_hash.Text.Replace("0x", ""), NumberStyles.HexNumber);
  154.             if (Cracker2_Cracking)
  155.             {
  156.                 Cracker2.Abort();
  157.                 Cracker2_Cracking = false;
  158.             }
  159.             else
  160.             {
  161.                 Cracker2 = new Thread(HashCrack2);
  162.                 Cracker2.Start();
  163.                 Cracker2_Cracking = true;
  164.             }
  165.         }
  166.     }
  167.  
  168.     public class Bruteforce : IEnumerable
  169.     {
  170.         private StringBuilder sb = new StringBuilder();
  171.         public string charset = "abcdefghijklmnopqrstuvwxyz_";
  172.         private ulong len;
  173.         private int _max;
  174.         public int max { get { return _max; } set { _max = value; } }
  175.         private int _min;
  176.         public int min { get { return _min; } set { _min = value; } }
  177.  
  178.         public System.Collections.IEnumerator GetEnumerator()
  179.         {
  180.             len = (ulong)this.charset.Length;
  181.             for (double x = min; x <= max; x++)
  182.             {
  183.                 ulong total = (ulong)Math.Pow((double)charset.Length, (double)x);
  184.                 ulong counter = 0;
  185.                 while (counter < total)
  186.                 {
  187.                     string a = factoradic(counter, x - 1);
  188.                     yield return a;
  189.                     counter++;
  190.                 }
  191.             }
  192.         }
  193.  
  194.         private string factoradic(ulong l, double power)
  195.         {
  196.             sb.Length = 0;
  197.             while (power >= 0)
  198.             {
  199.                 sb = sb.Append(this.charset[(int)(l % len)]);
  200.                 l /= len;
  201.                 power--;
  202.             }
  203.             return sb.ToString();
  204.         }
  205.     }
  206. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement