|
Joined: Mar 2007
Posts: 139
Vogon poet
|
OP
Vogon poet
Joined: Mar 2007
Posts: 139 |
Greetings. I amm looking for help with a script that will echo into a window every possible denomination of the alphabet, very similar to how the brute-forcers work. starting with a ab ba.. etc. I am in the middle of something myself but i have seen some excellent scripts written here and would like to see other peoples ideas to help structure my project. Its complicated for me but i get the feeling the code does not need to be to large. Any help or idea would be appreciated.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
well, the good news is that I have an idea as to how to do this, the bad news is the fact that the output keeps generating a line too long error, since you're looking at 26^27 possibilities.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
I don't think this is possible within the confines of mIRC.
-genius_at_work
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
I'm sure it's possible, though it would freeze mIRC while echoing that many combinations. I also have a basic idea of how to do it, but it's not something I really want to try to get into. Especially when I am pretty sure there is a site somewhere that has all of the combinations up to a certain length.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
Just to list all permutations of a-z with a length of 26, there would be 403,291,461,126,605,635,584,000,000 lines. Thats 403 billion billion billion lines. And that doesn't even include the permutations that are 25 characters long, 24 characters long, 23 characters long, etc.
(26!/(26-26)!) + (26!/(26-25)!) + (26!/(26-24)!) + ...
n! = n*(n-1)*(n-2)...*2*1 *note: 0! = 1
If my calculations are correct, there would be 1,096,259,850,353,149,600,000,000,000 lines (mIRC rounding limits apply).
-genius_at_work
|
|
|
|
Joined: Feb 2006
Posts: 546
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 546 |
here's a couple of neat little snippets i had lying around that relate to this :P
alias brute {
var %a
while %a < $str(z,$1) {
%a = $regsubex(%a,([^z]?)(z*$),$iif(\1,$chr($calc(1+$asc(\1))),a) $+ $str(a,$len(\2)))
echo -a %a
}
}
/brute <N> echos all possible combinations of a-z for string lengths of up to and including N. so /brute 2 echos a, b, c, ..., x, y, z, aa, ab, ..., zy, zz
alias permute {
var %x 0,%y
while ($regsub($1,(.{ $+ %x $+ })(.),\1,%y)) scon -r inc $(%x |,) $iif(? iswm $1,echo -a,permute %y) $2 $+ $regml(2)
}
/permute <string> echos all permutations of the string, doesnt take duplicate characters into account though. so /permute abc echos: abc acb bac bca cab cba they're not extremely practical, especially for what you want, but they're fun to play around with :>
"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Just to list all permutations of a-z with a length of 26, Who said you needed that many letters? Setting it to allow a person to list all of the combinations for N number of characters would let a person just do shorter lists if desired (4-8 length, perhaps). Yes, it's still a lot of lines, but it's *considerably* fewer than a length of 26. EDIT: Besides, Jaytea's does what was asked. It's still slow for large lengths, but here's a timetable on some of the shorter lenghts... 1 length = 0.015s 2 lengths = 0.578s 3 lengths = 15.000s Basically, mutliply by 26 each time, so length 4 would be 15*26=390s or 6.5 minutes. Length 5 would be 169 minutes or 2.8 hours. Etc. For 8 characters, which may be as far as the OP would want, it would take 2062.74 days to complete. Doesn't that sound like fun. Of course, that may be what you were referring to... not the limit of mIRC, but the speed. And, for that, yes, it would take too long. Though, you could probably speed it up by just doing a list of, say 4 characters, then copy the lines, automatically insert a in front of every line, paste those and insert b in front of every line, paste again, insert c, etc. I don't feel like seeing if that's any faster for the larger lengths, but it may be.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Mar 2007
Posts: 139
Vogon poet
|
OP
Vogon poet
Joined: Mar 2007
Posts: 139 |
Thank-You Jaytea, it was better then what i needed. and the code fantastically small.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
I took this phrase "I amm looking for help with a script that will echo into a window every possible denomination of the alphabet" to mean every possibility from 'a' to 'zyx..cba' (or whatever the last 26-character long string would be). Of course it theoretically could be done with mIRC, assuming you had centuries to wait, and billions of MB of RAM to spare. :P In any case, the Op has what he needs. BTW, if anyone is interested, here is the code for calculating the number of total permutations:
alias factorial {
;$1=n
var %n = 1, %c = 0
while (%c < $1) { inc %c | %n = $calc(%n * %c) }
return %n
}
alias nCr {
;$1=n, $2=r
return $calc($factorial($1) / ($factorial($2) * $factorial($calc($1 - $2))))
}
alias nPr {
;$1=n, $2=r
return $calc($factorial($1) / $factorial($calc($1 - $2)))
}
alias allPr {
;$1=n
var %c = 0, %t = 0
while (%c < $1) {
inc %c
%t = $calc(%t + $nPr(26,%c))
echo -a %c = $nPr(26,%c)
}
echo -a T = %t
}
//echo -a $nPr(26,26) => shows number of 26-character permutations /allPr 26 => lists number of permutations for all lengths up to 26 and total The $factorial $nCr and $nPr functions may be useful for other scripts. Feel free to use them. nCr = Combinations, nPr = Permutations -genius_at_work
Last edited by genius_at_work; 09/05/07 03:58 AM.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
You and I were thinking along the same lines, only I thought he wanted every possibility from 'a' to 'zzzzzzzzzzzzzzzzzzzzzzzzzz'
Which, simply put, would make the calculations that much longer.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
I still think that isn't what was meant. Even if "every possible denomination of the alphabet" is taken to mean a specific length, there's no reason why it would have to be 26. Isn't a 27 character string still a "possible denomination of the alphabet"? Or a 100 character string?
"Every possible denomination of the alphabet" could be a valid request for a maximum of 4 characters. It would mean every possible combination of letters from a to zzzz. Because the OP never specified a number of characters, I'd side on the idea of around 8 being the maximum.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
The way I read it was to mean that every possible set of letters without duplicating any. Strings of 1-26 characters can be made without duplication.
-genius_at_work
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
He mentioned brute force programs. Such things will check every possible combination of letters up to a certain length trying to crack a code/password. If the password could be up to 30 characters, the brute force program would need to check all combinations up to 30 characters in length. Or, if it could only be 8 characters, then you'd only need to check up to that length. In any case, duplicates wouldn't happen using the code provided regardless if you were looking at 100 character strings or 2 character strings.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Seems we have a number of excellent helpers all with a similar problem, specifically, insufficient detailed information to determine exactly what it was the OP was wanting.
|
|
|
|
|