![]() |
|
[TuT]Making a Bruteforcer - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: [TuT]Making a Bruteforcer (/Thread-TuT-Making-a-Bruteforcer) Pages:
1
2
|
RE: [TuT]Making a Bruteforcer - spsum60 - 06-09-2011 Uhhh... Im pretty n00b at coding/programming, language stuffs, devices names n its definitions. [questions] -Cn u explain wats the difference with javascript n vb.net? -how do u use dis code? (step by step) -cn dis be used for hackin accounts? pls answer :o !! thx
RE: [TuT]Making a Bruteforcer - 1llusion - 06-11-2011 (06-09-2011, 12:01 AM)spsum60 Wrote: Uhhh... Im pretty n00b at coding/programming, language stuffs, devices names n its definitions. 1) Imagine javascript as a cookie and vb.net as a bread. Now whats the difference? Both of them are food, but thats it, same with javascript and vb.net ![]() 2) You have to have some compiler, preferably with IDE such as: MonoDevelop (Linux, MAC OS, Windows) or Microsoft Visual Studio (Windows only) 3) Yes, but you have to edit it for your purpose, this is just an example. I suggest you to get some proper cracker since this one is slow... RE: [TuT]Making a Bruteforcer - Hatsune Miku_mybb_import5879 - 06-16-2011 Good TUT but if you could enable your GPU to do this instead it would go much faster. RE: [TuT]Making a Bruteforcer - blowdoof - 06-17-2011 you can try a recursive function as well... recursive = calling a method from within a method (same method)... f.e Dim charList As New Generic.List(Of Char) Dim output As String Sub Bruteforce(ByVal currentString As String, ByVal maximum As Integer) For Each fC As Char In charList If currentString.Length < maximum Then Console.WriteLine(currentString & fC) Bruteforce(currentString & fC, maximum) End If Next End Sub Sub Main() Static start_time As DateTime Static stop_time As DateTime Dim elapsed_time As TimeSpan For L As Byte = 97 To 122 charList.Add(Chr(L)) Next Console.WriteLine("Press any key to start...") start_time = Now Bruteforce("", 8) stop_time = Now elapsed_time = stop_time.Subtract(start_time) Console.WriteLine(elapsed_time.TotalSeconds.ToString("0.000000")) Console.ReadLine() End Sub as you'll notice, it generates all possibilities (define the max length in calling the bruteforce method) from 1 to ... about the same routine as provided above, but cleaner code and used a generic list for easy iteration trough the list. Added some functionality to time the calculation for testing purposes. happy coding
RE: [TuT]Making a Bruteforcer - 1llusion - 06-20-2011 wow nice one, thanks!!!! RE: [TuT]Making a Bruteforcer - Psycho_Coder - 04-06-2013 well this method would work only if the word has a length of 8, and that too all in lowercase.I think it would be wise to use a ArrayList of the characters with which we need to bruteforce the password, instead of using so many loops. I think this is what that makes the program slow, since you have used 8 loops so it has a complexity of Big-O of 8 i.e. O(n^8) which is very inefficient. The method that I am telling that is using ArrayList of characters and then a loop to iterate the ArrayList and print the values, It will have a complexity of O(n^2), which is better. well I maybe wrong, but this is my idea. I am sorry, if is said something wrong. RE: [TuT]Making a Bruteforcer - Deque - 04-06-2013 (04-06-2013, 02:17 PM)Psycho_Coder Wrote: well this method would work only if the word has a length of 8, and that too all in lowercase.I think it would be wise to use a ArrayList of the characters with which we need to bruteforce the password, instead of using so many loops. Please note that this thread is very old. I don't think you can have a better time complexity. You can of course do it in more flexible manner. The missing flexibility is actually the big disadvantage of the code shown here. But it is not slow in terms of time complexity. To talk about that in detail you need to clear a few things up: What is n for you? In this case it could be the length of the password, but since this algorithm shown above can only be used for one password length it is not possible to make an estimation about the time complexity for other inputs than n = 8. Do you have pseudocode or real code for your algorithm? The only possibilities I see in making this fast is by the usage of parallelism. This can be accomplished either with threads or the use of the GPU. But it doesn't make sense to do this without the applying the concrete password cracking tasks to the parallel computation too. Flexibility can be accomplished like I explained here: http://www.hackcommunity.com/Thread-Tut-Create-a-wordlist-generator-i-e-for-bruteforcing This is an alternative code I made after the same principle, because it is a bit better to handle (Java): Code: public class WordlistGen {
private int wordNumber;
private final int wordlength;
private final char[] alphabet;
private final long maxWords;
private final int radix;
/**
* Inits a wordlist generator with given alphabet and wordlength
* @param alphabet
* @param wordlength
*/
public WordlistGen(char[] alphabet, int wordlength) {
this.wordlength = wordlength;
this.alphabet = alphabet;
this.maxWords = (long) Math.pow(alphabet.length, wordlength);
this.radix = alphabet.length;
}
/**
*
* @return next generated word, null if no word is left
*/
public String generateNext() {
if (hasNext()) {
int[] indices = convertToRadix(wordNumber);
char[] word = new char[wordlength];
for (int k = 0; k < wordlength; k++) {
word[k] = alphabet[indices[k]];
}
wordNumber++;
return new String(word);
}
return null;
}
/**
*
* @return true if there are more words to generate, false otherwise
*/
public boolean hasNext() {
return (wordNumber < maxWords);
}
private int[] convertToRadix(long number) {
int[] indices = new int[wordlength];
for (int i = wordlength - 1; i >= 0; i--) {
if (number > 0) {
int rest = (int) (number % radix);
number /= radix;
indices[i] = rest;
} else {
indices[i] = 0;
}
}
return indices;
}
}RE: [TuT]Making a Bruteforcer - 1llusion - 04-06-2013 Oh...uh... my coding beginning... closing the thread because of its age. RE: [TuT]Making a Bruteforcer - Psycho_Coder - 04-06-2013 (04-06-2013, 02:57 PM)Deque Wrote:(04-06-2013, 02:17 PM)Psycho_Coder Wrote: well this method would work only if the word has a length of 8, and that too all in lowercase.I think it would be wise to use a ArrayList of the characters with which we need to bruteforce the password, instead of using so many loops. Well co-incidentally but your post is my actual algorithm that I wanted for a bruteforcer. Suppose three checkboxes text - [0-9], [a-z], and [A-Z]. Now if we make a bruteforcer then we will give the user the options to choose the charecters he wants for bruteforcing a pass. we declare the max and min length of the pass. Code: Private minlen As Integer = 1
Private maxlen As Integer = 14this will hold the characters Code: Private charset As New ArrayList()All the characters for bruteforcing Code: Private lcase As String() = {"a", "b", "c", "d", "e", "f", _
"g", "h", "i", "j", "k", "l", _
"m", "n", "o", "p", "q", "r", _
"s", "t", "u", "v", "w", "x", _
"y", "z"}
Private ucase As String() = {"A", "B", "C", "D", "E", "F", _
"G", "H", "I", "J", "K", "L", _
"M", "N", "O", "P", "Q", "R", _
"S", "T", "U", "V", "W", "X", _
"Y", "Z"}
Private numbers As String() = {"0", "1", "2", "3", "4", "5", _
"6", "7", "8", "9"}Now we create a Subroutine named createCharset() Code: Private Sub createCharset()
If ckhlcase.Checked Then
charset.AddRange(lower)
End If
If chkucase.Checked Then
charset.AddRange(upper)
End If
If chknumbers.Checked Then
charset.AddRange(digits)
End If
End SubNow the code that does the real job. Code: Private pwdarr As String()
Private maxr As String
Private stopbgwork As Boolean
Private Sub brute()
'Setting up the password array
pwdarr = New String(maxlen - 1) {}
For i = 0 To maxlen - 1
pwdarr(i) = "-999"
Next
num = charset.Count
'We Calculate here the total no of possible characters
total = Math.Pow(num, maxlen)
For i = 0 To maxlen
maxr = maxr & Convert.ToString(charset(Convert.ToInt32(num- 1)))
Next
'We setup the password string here
For i = 0 To min - 1
pwdarr(i) = charset(0).ToString()
Next
i = 0
'Set the First Value
While pwdarr(i) <> "-999" AndAlso stopbgwork = False
firstval += pwdarr(i)
i += 1
current += 1
End While
testpwd = firstval
updatePassword() 'A function call to check the generated pass with the encrypted pass(if any, this is an optional step, I created this just to cover all the possibilities of Bruteforcing)
While True AndAlso stopbgwork = False
For i = 0 To (maxlen + 1) - 1
If pwdarr(i) = "-999" Then
Exit For
End If
Next
i -= 1
inc_comp = False
While Not inc_comp
For j = 0 To num - 1
If pwdarr(i) = charset(j).ToString() Then
Exit For
End If
Next
If j = (numVals - 1) Then
pwdarr(i) = charset(0).ToString()
updatePassword()
current += 1
i -= 1
If i < 0 Then
For i = 0 To (max + 1) - 1
If pwdarr(i) = "-999" Then
Exit For
End If
Next
pwdarr(i) = charset(0).ToString()
pwdarr(i + 1) = "-999"
updatePassword()
current += 1
inc_comp = True
End If
Else
pwdarr(i) = charset(j + 1).ToString()
updatePassword()
current += 1
inc_comp = True
End If
End While
End While
i = 0
currentval = ""
While pwdarr(i) <> "-999"
currentval = currentval & pwdarr(i)
i += 1
testpwd = currentval
updatelabel(label1, passString()) 'A label in the GUI where the randomly generated passwords are displayed.
If currentval = maxr Then
Exit While
End If
End While
End Sub
Private Function passString() As String
Dim tmp As String = ""
For x As Integer = 0 To maxlen - 1
tmp += pwdarr(x)
Next
Return tmp.Replace("-999", "")
End FunctionThis is a rough code and might contains error, but I think I made my point clear. However , your paper on bruteforcing is best. I have tried to do like it. |