Today you will (hopefully) learn how to make a bruteforcer in VB.NET
Its pretty simple once you get the system
WARNING: VB.NET ISN'T a good language for bruteforcers since its slow, it will take ages to break more complex passes. Use C for some serious job
So, lets start
to prevent leachers, Ill make a console app that will just print the letters, but its pretty easy to make it into working bruteforcer
The code:
Code:
Module Module1
Dim a As String = String.Empty
Dim b As String = String.Empty
Dim c As String = String.Empty
Dim d As String = String.Empty
Dim e As String = String.Empty
Dim f As String = String.Empty
Dim g As String = String.Empty
Dim h As String = String.Empty
Sub Bruteforce()
For eigth = 97 To 122
For seventh = 97 To 122
For sixth = 97 To 122
For fifth = 97 To 122
For fourth = 97 To 122
For third = 97 To 122
For second As Integer = 97 To 122
For first As Integer = 97 To 122
a = Chr(first)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next first
b = Chr(second)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next second
c = Chr(third)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next third
d = Chr(fourth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next fourth
e = Chr(fifth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next fifth
f = Chr(sixth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next sixth
g = Chr(seventh)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next seventh
h = Chr(eigth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next eigth
End Sub
Sub Main()
Console.WriteLine("Press any key to start...")
Console.ReadLine()
Bruteforce()
End Sub
End Module
Okay, so what does what:
Code:
Dim a As String = String.Empty
Dim b As String = String.Empty
Dim c As String = String.Empty
Dim d As String = String.Empty
Dim e As String = String.Empty
Dim f As String = String.Empty
Dim g As String = String.Empty
Dim h As String = String.Empty
Public declarations, they can be private... I like them public, in case I need them somewhere else
Code:
For first As Integer = 97 To 122
a = Chr(first)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next first
This sets an variable "first" as an integer. The variable has assigned a number: 97 for beginning, then it executes the code and moves to next number, this is repeated untill the number is 122, then in moves to next code, in our case another loop With the next loop, this one starts again.... and thats how the bruteforcing works
Code:
Chr(first)
"Chr" is an ASCII character code, where the number in the brackets is the character number, Asc() does exactly the oposite
Ok, now you should get the idea how it works, if you have any problem, just post it here =)
Alternative (faster) way by Coder-san:
Spoiler:
Code:
Sub Bruteforce()
'CheckForIllegalCrossThreadCalls = False 'For MultiThreading
For eigth As Byte = 97 To 122
For seventh As Byte = 97 To 122
For sixth As Byte = 97 To 122
For fifth As Byte = 97 To 122
For fourth As Byte = 97 To 122
For third As Byte = 97 To 122
For second As Byte = 97 To 122
For first As Byte = 97 To 122
TextBox2.Text = Chr(first) & Chr(second) & Chr(third) & Chr(fourth) & Chr(fifth) & Chr(sixth) & Chr(seventh) & Chr(eigth)
Next first
Next second
Next third
Next fourth
Next fifth
Next sixth
Next seventh
Next eigth
End Sub
Today you will (hopefully) learn how to make a bruteforcer in VB.NET
Its pretty simple once you get the system
WARNING: VB.NET ISN'T a good language for bruteforcers since its slow, it will take ages to break more complex passes. Use C for some serious job
So, lets start
to prevent leachers, Ill make a console app that will just print the letters, but its pretty easy to make it into working bruteforcer
The code:
Code:
Module Module1
Dim a As String = String.Empty
Dim b As String = String.Empty
Dim c As String = String.Empty
Dim d As String = String.Empty
Dim e As String = String.Empty
Dim f As String = String.Empty
Dim g As String = String.Empty
Dim h As String = String.Empty
Sub Bruteforce()
For eigth = 97 To 122
For seventh = 97 To 122
For sixth = 97 To 122
For fifth = 97 To 122
For fourth = 97 To 122
For third = 97 To 122
For second As Integer = 97 To 122
For first As Integer = 97 To 122
a = Chr(first)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next first
b = Chr(second)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next second
c = Chr(third)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next third
d = Chr(fourth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next fourth
e = Chr(fifth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next fifth
f = Chr(sixth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next sixth
g = Chr(seventh)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next seventh
h = Chr(eigth)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next eigth
End Sub
Sub Main()
Console.WriteLine("Press any key to start...")
Console.ReadLine()
Bruteforce()
End Sub
End Module
Okay, so what does what:
Code:
Dim a As String = String.Empty
Dim b As String = String.Empty
Dim c As String = String.Empty
Dim d As String = String.Empty
Dim e As String = String.Empty
Dim f As String = String.Empty
Dim g As String = String.Empty
Dim h As String = String.Empty
Public declarations, they can be private... I like them public, in case I need them somewhere else
Code:
For first As Integer = 97 To 122
a = Chr(first)
Console.WriteLine(a & b & c & d & e & f & g & h)
Next first
This sets an variable "first" as an integer. The variable has assigned a number: 97 for beginning, then it executes the code and moves to next number, this is repeated untill the number is 122, then in moves to next code, in our case another loop With the next loop, this one starts again.... and thats how the bruteforcing works
Code:
Chr(first)
"Chr" is an ASCII character code, where the number in the brackets is the character number, Asc() does exactly the oposite
Ok, now you should get the idea how it works, if you have any problem, just post it here =)
Alternative (faster) way by Coder-san:
Spoiler:
Code:
Sub Bruteforce()
'CheckForIllegalCrossThreadCalls = False 'For MultiThreading
For eigth As Byte = 97 To 122
For seventh As Byte = 97 To 122
For sixth As Byte = 97 To 122
For fifth As Byte = 97 To 122
For fourth As Byte = 97 To 122
For third As Byte = 97 To 122
For second As Byte = 97 To 122
For first As Byte = 97 To 122
TextBox2.Text = Chr(first) & Chr(second) & Chr(third) & Chr(fourth) & Chr(fifth) & Chr(sixth) & Chr(seventh) & Chr(eigth)
Next first
Next second
Next third
Next fourth
Next fifth
Next sixth
Next seventh
Next eigth
End Sub
RE: [TuT]Making a Bruteforcer - Coder-san - 03-19-2011
Even though I agree that VB would be too slow for this, I have to say this code can be a lot more faster than it is now.
Currently you have a huge loop running in a single thread which would hang the app, which can be ignored since this is a Tutorial, and a Programmer can find his way out.
Data-types you can change to increase speed and consume less memory:
Code:
Object (In 6 For Loops) -> Byte
Integer(In 2 For Loops) -> Byte
String (8 variables) -> Char
You don't need to Console.WriteLine in every Loop, only in the most inner Loop (or just keep storing in a String variable).
Refreshing a Control slows down the Loop as well. I'm not sure if this would affect Commandline (It looks pretty cool though).
I'm assuming you knew most of them, I'm just mentioning this for others who will read the Thread.
Good Tutorial.
RE: [TuT]Making a Bruteforcer - Coder-san - 03-19-2011
Even though I agree that VB would be too slow for this, I have to say this code can be a lot more faster than it is now.
Currently you have a huge loop running in a single thread which would hang the app, which can be ignored since this is a Tutorial, and a Programmer can find his way out.
Data-types you can change to increase speed and consume less memory:
Code:
Object (In 6 For Loops) -> Byte
Integer(In 2 For Loops) -> Byte
String (8 variables) -> Char
You don't need to Console.WriteLine in every Loop, only in the most inner Loop (or just keep storing in a String variable).
Refreshing a Control slows down the Loop as well. I'm not sure if this would affect Commandline (It looks pretty cool though).
I'm assuming you knew most of them, I'm just mentioning this for others who will read the Thread.
Good Tutorial.
RE: [TuT]Making a Bruteforcer - 1llusion - 03-19-2011
(03-19-2011, 03:31 PM)Coder-san Wrote: Even though I agree that VB would be too slow for this, I have to say this code can be a lot more faster than it is now.
Currently you have a huge loop running in a single thread which would hang the app, which can be ignored since this is a Tutorial, and a Programmer can find his way out.
Data-types you can change to increase speed and consume less memory:
Code:
Object (In 6 For Loops) -> Byte
Integer(In 2 For Loops) -> Byte
String (8 variables) -> Char
You don't need to Console.WriteLine in every Loop, only in the most inner Loop (or just keep storing in a String variable).
Refreshing a Control slows down the Loop as well. I'm not sure if this would affect Commandline (It looks pretty cool though).
I'm assuming you knew most of them, I'm just mentioning this for others who will read the Thread.
Good Tutorial.
Well, the command line loops work a lot faster then with form, example: Cmd catches up form that was running for 10 mins in less then 30 secs.
Anyway, can you please explain me your idea? didn't really get it This loop idea came from my friend when he needed a quick bruteforcer and he got the idea while watching a clock
Thanks!!!!
RE: [TuT]Making a Bruteforcer - 1llusion - 03-19-2011
(03-19-2011, 03:31 PM)Coder-san Wrote: Even though I agree that VB would be too slow for this, I have to say this code can be a lot more faster than it is now.
Currently you have a huge loop running in a single thread which would hang the app, which can be ignored since this is a Tutorial, and a Programmer can find his way out.
Data-types you can change to increase speed and consume less memory:
Code:
Object (In 6 For Loops) -> Byte
Integer(In 2 For Loops) -> Byte
String (8 variables) -> Char
You don't need to Console.WriteLine in every Loop, only in the most inner Loop (or just keep storing in a String variable).
Refreshing a Control slows down the Loop as well. I'm not sure if this would affect Commandline (It looks pretty cool though).
I'm assuming you knew most of them, I'm just mentioning this for others who will read the Thread.
Good Tutorial.
Well, the command line loops work a lot faster then with form, example: Cmd catches up form that was running for 10 mins in less then 30 secs.
Anyway, can you please explain me your idea? didn't really get it This loop idea came from my friend when he needed a quick bruteforcer and he got the idea while watching a clock
Thanks!!!!
RE: [TuT]Making a Bruteforcer - Coder-san - 03-20-2011
Code:
Sub Bruteforce()
'CheckForIllegalCrossThreadCalls = False 'For MultiThreading
For eigth As Byte = 97 To 122
For seventh As Byte = 97 To 122
For sixth As Byte = 97 To 122
For fifth As Byte = 97 To 122
For fourth As Byte = 97 To 122
For third As Byte = 97 To 122
For second As Byte = 97 To 122
For first As Byte = 97 To 122
TextBox2.Text = Chr(first) & Chr(second) & Chr(third) & Chr(fourth) & Chr(fifth) & Chr(sixth) & Chr(seventh) & Chr(eigth)
Next first
Next second
Next third
Next fourth
Next fifth
Next sixth
Next seventh
Next eigth
End Sub
This would do the same thing using less resources.
At some times, these optimizations don't matter much, but when these datatypes are inside multiple-loops they slow down the code too much.
A Bruteforce algorithm using a varied length is much trickier by the way. :p
RE: [TuT]Making a Bruteforcer - Coder-san - 03-20-2011
Code:
Sub Bruteforce()
'CheckForIllegalCrossThreadCalls = False 'For MultiThreading
For eigth As Byte = 97 To 122
For seventh As Byte = 97 To 122
For sixth As Byte = 97 To 122
For fifth As Byte = 97 To 122
For fourth As Byte = 97 To 122
For third As Byte = 97 To 122
For second As Byte = 97 To 122
For first As Byte = 97 To 122
TextBox2.Text = Chr(first) & Chr(second) & Chr(third) & Chr(fourth) & Chr(fifth) & Chr(sixth) & Chr(seventh) & Chr(eigth)
Next first
Next second
Next third
Next fourth
Next fifth
Next sixth
Next seventh
Next eigth
End Sub
This would do the same thing using less resources.
At some times, these optimizations don't matter much, but when these datatypes are inside multiple-loops they slow down the code too much.
A Bruteforce algorithm using a varied length is much trickier by the way. :p
RE: [TuT]Making a Bruteforcer - 1llusion - 03-20-2011
(03-20-2011, 06:59 AM)Coder-san Wrote:
Code:
Sub Bruteforce()
'CheckForIllegalCrossThreadCalls = False 'For MultiThreading
For eigth As Byte = 97 To 122
For seventh As Byte = 97 To 122
For sixth As Byte = 97 To 122
For fifth As Byte = 97 To 122
For fourth As Byte = 97 To 122
For third As Byte = 97 To 122
For second As Byte = 97 To 122
For first As Byte = 97 To 122
TextBox2.Text = Chr(first) & Chr(second) & Chr(third) & Chr(fourth) & Chr(fifth) & Chr(sixth) & Chr(seventh) & Chr(eigth)
Next first
Next second
Next third
Next fourth
Next fifth
Next sixth
Next seventh
Next eigth
End Sub
This would do the same thing using less resources.
At some times, these optimizations don't matter much, but when these datatypes are inside multiple-loops they slow down the code too much.
A Bruteforce algorithm using a varied length is much trickier by the way. :p
oh cool =) I will add it to the OP as more efficient way
thanks for explaining
EDIT: tested it and its like 2x faster then my code, with the difference that my code doesn all combinations from 1 to 8 characters and yours does just 8 characters
RE: [TuT]Making a Bruteforcer - 1llusion - 03-20-2011
(03-20-2011, 06:59 AM)Coder-san Wrote:
Code:
Sub Bruteforce()
'CheckForIllegalCrossThreadCalls = False 'For MultiThreading
For eigth As Byte = 97 To 122
For seventh As Byte = 97 To 122
For sixth As Byte = 97 To 122
For fifth As Byte = 97 To 122
For fourth As Byte = 97 To 122
For third As Byte = 97 To 122
For second As Byte = 97 To 122
For first As Byte = 97 To 122
TextBox2.Text = Chr(first) & Chr(second) & Chr(third) & Chr(fourth) & Chr(fifth) & Chr(sixth) & Chr(seventh) & Chr(eigth)
Next first
Next second
Next third
Next fourth
Next fifth
Next sixth
Next seventh
Next eigth
End Sub
This would do the same thing using less resources.
At some times, these optimizations don't matter much, but when these datatypes are inside multiple-loops they slow down the code too much.
A Bruteforce algorithm using a varied length is much trickier by the way. :p
oh cool =) I will add it to the OP as more efficient way
thanks for explaining
EDIT: tested it and its like 2x faster then my code, with the difference that my code doesn all combinations from 1 to 8 characters and yours does just 8 characters