So I was planing to make a "password brute forcer" that will try all the possible combinations to crack a password but I would like to know how would I make a string change like this? Example 1,2,3,4,5,6,7,8,9,0,-,=,q ect...
[Question] How do I do this?
Started by basdxz, Nov 02 2012 12:57 AM
10 replies to this topic
#1
Posted 02 November 2012 - 12:57 AM
#2
Posted 02 November 2012 - 01:31 AM
I think you would need to make tables with all possible values o.O no clue the rest lol
#3
Posted 02 November 2012 - 01:33 AM
I'm not sure how you are going to use the generated string but you would do so by using. string.char(n) . I'm not sure which character code will generate which character on computercraft, but here is an example.
This would go through every character from character code 1 to 100
If you wish to combine 2 characters you can by using a for loop inside a for loop
This would create every combination of the 100 characters combined when used twice in one string.
But remember, if you start generating strings this way the time it takes increases exponentially for every character in the finished string, if you are trying to get 26 characters, every time you add another character to the string the time necessary to calculate it is the old time * 26
for i = 1 , 100 do somestring = string.char(i) dosomething(somestring) end
This would go through every character from character code 1 to 100
If you wish to combine 2 characters you can by using a for loop inside a for loop
for i = 1 , 100 do for j = 1, 100 do somestring = string.char(i,j) dosomething(somestring) end end
This would create every combination of the 100 characters combined when used twice in one string.
But remember, if you start generating strings this way the time it takes increases exponentially for every character in the finished string, if you are trying to get 26 characters, every time you add another character to the string the time necessary to calculate it is the old time * 26
#4
Posted 02 November 2012 - 03:13 AM
XoX, on 02 November 2012 - 01:33 AM, said:
I'm not sure how you are going to use the generated string but you would do so by using. string.char(n) . I'm not sure which character code will generate which character on computercraft, but here is an example.
This would go through every character from character code 1 to 100
If you wish to combine 2 characters you can by using a for loop inside a for loop
This would create every combination of the 100 characters combined when used twice in one string.
But remember, if you start generating strings this way the time it takes increases exponentially for every character in the finished string, if you are trying to get 26 characters, every time you add another character to the string the time necessary to calculate it is the old time * 26
for i = 1 , 100 do somestring = string.char(i) dosomething(somestring) end
This would go through every character from character code 1 to 100
If you wish to combine 2 characters you can by using a for loop inside a for loop
for i = 1 , 100 do for j = 1, 100 do somestring = string.char(i,j) dosomething(somestring) end end
This would create every combination of the 100 characters combined when used twice in one string.
But remember, if you start generating strings this way the time it takes increases exponentially for every character in the finished string, if you are trying to get 26 characters, every time you add another character to the string the time necessary to calculate it is the old time * 26
#5
Posted 02 November 2012 - 04:03 AM
I'm not sure, I would simple figure out by trial and error which characters you want to use, 97 - 120 or so is lowercase letters and symbols, somewhere around 70 is uppercase letters and different symbols.
One sec I have an idea
/>
Now you just open the file chars and you got all the chars you need with their charcode.
I already checked it out, it's 33 - 126 for pretty much all letters and symbols.
One sec I have an idea
a = fs.open("chars", "w") ; for i = 1 , 150 do a.writeLine( i .. " : " .. string.char(i) ) end ; a.close()
Now you just open the file chars and you got all the chars you need with their charcode.
I already checked it out, it's 33 - 126 for pretty much all letters and symbols.
#6
Posted 02 November 2012 - 05:42 AM
So
for i = 33 , 126 do
somestring = string.char(i)
dosomething(somestring)
end
will do?
#7
Posted 02 November 2012 - 06:10 AM
This would make the string somestring the value of the character and then pass it to the function dosomething(s)
But this would only make it 1 character long, so it would make it a, then b, then c, then d, etc.
But this would only make it 1 character long, so it would make it a, then b, then c, then d, etc.
#8
Posted 02 November 2012 - 08:06 AM
here is my take on it. replace the print with the submit of password of course
tChoices={}
for i=33,126 do
tChoices[#tChoices+1]=string.char(i)
end
local function cycleChar(char)
for num=1,#tChoices do
if char==tChoices[num] then
return tChoices[num+1]
end
end
return false
end
local function cycleStr(str)
for dist=#str,1,-1 do
local cycled=cycleChar(string.sub(str,dist,dist))
if cycled then
return (dist>1 and string.sub(str,1,dist-1) or '')..cycled..string.rep(tChoices[1],#str-dist)
end
end
return string.rep(tChoices[1],#str+1)
end
local s=tChoices[1]
while true do
term.clear()
term.setCursorPos(1,1)
print(s)
s=cycleStr(s)
sleep(0)
end
#9
Posted 03 November 2012 - 02:58 AM
Thanks Kaos, but is it possible to start with three digits instead of one?
#10
Posted 03 November 2012 - 04:23 AM
Sure, but why bother? You shouldn't make a brute-forcer that can be defeated by a two character password. And, as mentioned above, doing the one and two character combos takes no time at all compared to even doing all the three character strings, let alone the rest.
#11
Posted 03 November 2012 - 04:46 AM
sure. just replace
local s=tChoices[1]with
local s=string.rep(tChoices[1],3)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











