Advertisement
IAmXeClutch

[Project] GTA V Native Hash Cracker

Jun 29th, 2014
2,810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.14 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using System.Timers;
  11.  
  12. namespace BobJenkinsBrute
  13. {
  14.     class Program
  15.     {
  16.         static uint CreateHash(string Native)
  17.         {
  18.             tries++;
  19.             uint num = 0;
  20.             byte[] bytes = Encoding.UTF8.GetBytes(Native);
  21.             for (int i = 0; i < bytes.Length; i++)
  22.             {
  23.                 num += bytes[i];
  24.                 num += num << 10;
  25.                 num ^= num >> 6;
  26.             }
  27.             num += num << 3;
  28.             num ^= num >> 11;
  29.             return (num + (num << 15));
  30.         }
  31.  
  32.         static string hash = "";
  33.         static int min = 0;
  34.         static int max = 0;
  35.         static long tries = 0;
  36.         static int time = 0;
  37.  
  38.         static void Main(string[] args)
  39.         {
  40.             Console.Title = "GTA V Native Hash Cracker by xSonoro & XeClutch";
  41.             Logger.WriteLogo();
  42.             if(args.Length != 3)
  43.             {
  44.                 hash = Logger.LogQuestion("Enter Hash: ").Replace("0x", "");
  45.                 min = int.Parse(Logger.LogQuestion("Enter minimum numbers of characters for native: "));
  46.                 max = int.Parse(Logger.LogQuestion("Enter maximum numbers of characters for native: "));
  47.             }
  48.             else
  49.             {
  50.                 hash = args[0];
  51.                 min = int.Parse(args[1]);
  52.                 max = int.Parse(args[2]);
  53.             }
  54.             Bruteforce bf = new Bruteforce();
  55.             bf.min = min;
  56.             bf.max = max;
  57.             Logger.LogAction("Started cracking the hash: 0x" + hash);
  58.             time = Environment.TickCount;
  59.             foreach(string combo in bf)
  60.             {
  61.                 uint CrackMe = uint.Parse(hash.Replace("0x", ""), NumberStyles.HexNumber);
  62.                 if (CreateHash(combo) == CrackMe)
  63.                 {
  64.                     Logger.LogSubAction("Cracked: " + combo);
  65.                     Logger.LogSubSubAction("The process took " + tries + " tries.");
  66.                     Logger.LogSubSubAction("The process took " + ((Environment.TickCount - time) / 1000) + " seconds.");
  67.                     tries = 0;
  68.                     time = 0;
  69.                 }
  70.             }
  71.             Console.Read();
  72.         }
  73.     }
  74.  
  75.     public static class Logger
  76.     {
  77.         public static void WriteLogo()
  78.         {
  79.             Console.ForegroundColor = ConsoleColor.Green;
  80.             Console.WriteLine(@"             _________           _____          __                 ");
  81.             Console.WriteLine(@"             \_   ___ \_______  /  |  |   ____ |  | __ ___________ ");
  82.             Console.WriteLine(@"             /    \  \/\_  __ \/   |  |__/ ___\|  |/ // __ \_  __ \");
  83.             Console.WriteLine(@"             \     \____|  | \/    ^   /\  \___|    <\  ___/|  | \/");
  84.             Console.WriteLine(@"              \______  /|__|  \____   |  \___  >__|_ \\___  >__|   ");
  85.             Console.WriteLine(@"                     \/            |__|      \/     \/    \/       ");
  86.             Console.WriteLine();
  87.             Console.ForegroundColor = ConsoleColor.White;
  88.  
  89.         }
  90.         public static void LogError(string err)
  91.         {
  92.             Console.Write("[");
  93.             Console.ForegroundColor = ConsoleColor.Red;
  94.             Console.Write("!");
  95.             Console.ForegroundColor = ConsoleColor.White;
  96.             Console.Write("] " + err + "\n");
  97.             Console.Read();
  98.         }
  99.         public static void LogAction(string act)
  100.         {
  101.             Console.Write("[");
  102.             Console.ForegroundColor = ConsoleColor.Green;
  103.             Console.Write("*");
  104.             Console.ForegroundColor = ConsoleColor.White;
  105.             Console.Write("] " + act + "\n");
  106.         }
  107.         public static void LogSubAction(string subact)
  108.         {
  109.             Console.Write("->    [");
  110.             Console.ForegroundColor = ConsoleColor.Green;
  111.             Console.Write("*");
  112.             Console.ForegroundColor = ConsoleColor.White;
  113.             Console.Write("] " + subact);
  114.             Console.Write("\n");
  115.         }
  116.         public static void LogSubSubAction(string subsubact)
  117.         {
  118.             Console.Write("->          [");
  119.             Console.ForegroundColor = ConsoleColor.Green;
  120.             Console.Write("*");
  121.             Console.ForegroundColor = ConsoleColor.White;
  122.             Console.Write("] " + subsubact);
  123.             Console.Write("\n");
  124.         }
  125.         public static string LogQuestion(string q)
  126.         {
  127.             Console.Write("[");
  128.             Console.ForegroundColor = ConsoleColor.Cyan;
  129.             Console.Write("?");
  130.             Console.ForegroundColor = ConsoleColor.White;
  131.             Console.Write("] " + q);
  132.             return Console.ReadLine();
  133.         }
  134.     }
  135.  
  136.     public class Bruteforce : IEnumerable
  137.     {
  138.         private StringBuilder sb = new StringBuilder();
  139.         public string charset = "abcdefghijklmnopqrstuvwxyz_";
  140.         private ulong len;
  141.         private int _max;
  142.         public int max { get { return _max; } set { _max = value; } }
  143.         private int _min;
  144.         public int min { get { return _min; } set { _min = value; } }
  145.  
  146.         public System.Collections.IEnumerator GetEnumerator()
  147.         {
  148.             len = (ulong)this.charset.Length;
  149.             for (double x = min; x <= max; x++)
  150.             {
  151.                 ulong total = (ulong)Math.Pow((double)charset.Length, (double)x);
  152.                 ulong counter = 0;
  153.                 while (counter < total)
  154.                 {
  155.                     string a = factoradic(counter, x - 1);
  156.                     yield return a;
  157.                     counter++;
  158.                 }
  159.             }
  160.         }
  161.  
  162.         private string factoradic(ulong l, double power)
  163.         {
  164.             sb.Length = 0;
  165.             while (power >= 0)
  166.             {
  167.                 sb = sb.Append(this.charset[(int)(l % len)]);
  168.                 l /= len;
  169.                 power--;
  170.             }
  171.             return sb.ToString();
  172.         }
  173.     }
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement