mIRC Home    About    Download    Register    News    Help

Print Thread
Script Help #176298 07/05/07 05:46 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
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.

Re: Script Help [Re: Solo1] #176313 08/05/07 01:29 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
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.

Re: Script Help [Re: RusselB] #176316 08/05/07 02:39 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I don't think this is possible within the confines of mIRC.

-genius_at_work

Re: Script Help [Re: genius_at_work] #176319 08/05/07 04:08 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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
Re: Script Help [Re: Riamus2] #176321 08/05/07 05:00 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
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

Re: Script Help [Re: Solo1] #176324 08/05/07 05:48 AM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
here's a couple of neat little snippets i had lying around that relate to this :P

Code:
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

Code:
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
Re: Script Help [Re: genius_at_work] #176334 08/05/07 01:41 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Originally Posted By: genius_at_work
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. smile

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. laugh

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
Re: Script Help [Re: jaytea] #176343 08/05/07 04:38 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Thank-You Jaytea, it was better then what i needed. and the code fantastically small.

Re: Script Help [Re: Riamus2] #176373 09/05/07 03:57 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
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:

Code:
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.
Re: Script Help [Re: genius_at_work] #176375 09/05/07 04:05 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
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.

Re: Script Help [Re: genius_at_work] #176406 09/05/07 02:26 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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
Re: Script Help [Re: Riamus2] #176445 10/05/07 12:54 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
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

Re: Script Help [Re: genius_at_work] #176446 10/05/07 12:58 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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
Re: Script Help [Re: Riamus2] #176453 10/05/07 02:07 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
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.