Sign in to follow this  
Followers 0
Pharon

Help with dictionary script...

7 posts in this topic

Alright, I'm trying to make a script that will type, in notepad, every combination of word and number using a-z, A-Z, and 1-0.

Example:

a

b

c

d

e....

then when it gets done with that it will go,

aa

ab

ac

ad....

then,

ba

bb

bc...

and so on. I've been messing around with this for a while and this is what I have to far. To be honest I don't even know how most of this script works, or if this is even the best way to do this. Please help.

CODE
HotKeySet("{DEL}", "MyStart")

HotKeySet("{INS}", "MyExit")

$alphabet = StringSplit('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')

$g = 1

While 1

Sleep (2000)

Wend

Func MyStart()

While $g = 1

For $a = 1 to 62

$letter = $alphabet[$a]

Send($letter)

Send("{Enter}")

Next

$g = 2

WEnd

While $g = 2

For $b = 1 to 62

$letterb = $alphabet[$b]

Send($letterb)

Next

For $a = 1 to 62

$letter = $alphabet[$a]

Send($letter)

Send("{Enter}")

Next

$g = 3

WEnd

EndFunc

FuncMyExit()

Exit

EndFunc

Also, why does codebox get rid of my tabs?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Alright, I'm trying to make a script that will type, in notepad, every combination of word and number using a-z, A-Z, and 1-0.

Example:

a

b

c

d

e....

then when it gets done with that it will go,

aa

ab

ac

ad....

then,

ba

bb

bc...

and so on. I've been messing around with this for a while and this is what I have to far. To be honest I don't even know how most of this script works, or if this is even the best way to do this. Please help.

CODE
HotKeySet("{DEL}", "MyStart")

HotKeySet("{INS}", "MyExit")

$alphabet = StringSplit('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')

$g = 1

While 1

Sleep (2000)

Wend

Func MyStart()

While $g = 1

For $a = 1 to 62

$letter = $alphabet[$a]

Send($letter)

Send("{Enter}")

Next

$g = 2

WEnd

While $g = 2

For $b = 1 to 62

$letterb = $alphabet[$b]

Send($letterb)

Next

For $a = 1 to 62

$letter = $alphabet[$a]

Send($letter)

Send("{Enter}")

Next

$g = 3

WEnd

EndFunc

FuncMyExit()

Exit

EndFunc

Also, why does codebox get rid of my tabs?

This seems like a mad thing to want to do, but no matter. For just 4 characters you will have generated nearly 15 million words so you need to limit it a bit.

Heres a way to 'count' through all the possible combinations.

$maxlen = 3; restrict to only 238,000 words
$output = ''
Dim $rep[$maxlen + 1]
for $n = 1 to $maxlen
    $Output &= ' '
    $rep[$n] = 0
Next
$rep[$maxlen] = 0

Global $alphabet = StringSplit('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890','')
$numChar = $alphabet[0]
$alphabet[0] = ' '

WHile $rep[$maxlen] = 0

    for $n = 1 to $numChar
        $rep[0] = $n
        $output = MakeString($rep)
; Send($output)
;Send("{ENTER}")
    Next
    $p = 1
    While 1
        $rep[$p] += 1
        if $rep[$p] > $numChar then
            $rep[$p] = 1
            $p += 1
        Else
            exitloop
        EndIf
    WEnd
    $output = MakeString($rep)
; Send($output)
; send("{ENTER}")
WEnd

Func MakeString($array)
    $res = ''
    for $t = 0 to UBound($array)-1
        $res &= $alphabet[$array[$t]]

    Next
    return $res
EndFunc
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I think this could easily crash a computer if used incorrectly.

Share this post


Link to post
Share on other sites

I don't believe this would crash a computer, as much as it would just take up a lot of space. Here's a function I made to aid in doing a similar thing:

Func FindPhrase($num, $set, $min_len=1)
    If $num = 0 Then Return ""
    Local $table = StringSplit($set,'')
    Local $set_len = $table[0]
    Local $total = 0, $i=0, $len=0, $value
    For $i = $min_len-1 To 1 Step -1
        $num += $set_len^$i
    Next
    While $total < $num
        $len+=1
        $total += $set_len^$len
    WEnd
    $total-=$set_len^$len
    While $total < $num And $len > 0
        $total += $set_len^($len-1)
        $i += 1
        If $total = $num Then
            $total -= $set_len^($len-1)
            $value &= $table[$i]
            $len-=1
            $i=0
        EndIf
        If $total > $num Then
            $total -= $set_len^($len-1)
            $value &= $table[$i]
            $len-=1
            $i=0
        EndIf
    WEnd
    Return $value
EndFunc

The num you put in is just to help you loop better, set is a string of all the numbers to go through, and min_len is the minimum length you want the 1st "phrase" to be. It's pretty quick, even for big numbers. Haven't put it in a loop quite yet, but I don't think it would be that bad on time. I also have it's inverse function, where you give it a phrase, along with the set and the min_len, and it tells you which number it is.

Hope this helps.

Share this post


Link to post
Share on other sites

I don't believe this would crash a computer, as much as it would just take up a lot of space. Here's a function I made to aid in doing a similar thing:

Func FindPhrase($num, $set, $min_len=1)
    If $num = 0 Then Return ""
    Local $table = StringSplit($set,'')
    Local $set_len = $table[0]
    Local $total = 0, $i=0, $len=0, $value
    For $i = $min_len-1 To 1 Step -1
        $num += $set_len^$i
    Next
    While $total < $num
        $len+=1
        $total += $set_len^$len
    WEnd
    $total-=$set_len^$len
    While $total < $num And $len > 0
        $total += $set_len^($len-1)
        $i += 1
        If $total = $num Then
            $total -= $set_len^($len-1)
            $value &= $table[$i]
            $len-=1
            $i=0
        EndIf
        If $total > $num Then
            $total -= $set_len^($len-1)
            $value &= $table[$i]
            $len-=1
            $i=0
        EndIf
    WEnd
    Return $value
EndFunc

The num you put in is just to help you loop better, set is a string of all the numbers to go through, and min_len is the minimum length you want the 1st "phrase" to be. It's pretty quick, even for big numbers. Haven't put it in a loop quite yet, but I don't think it would be that bad on time. I also have it's inverse function, where you give it a phrase, along with the set and the min_len, and it tells you which number it is.

Hope this helps.

The OP wanted all possible combinations of the 62 characters he gave which my function could achieve, (probably in only a few centuries, by which time maybe someone will have developed a storage system to hold all the answers), but I don't see how yours does that. I did warn about the huge numbers and I limited my function to search through only the first 238,328 which it finds in 60 seconds on my slow old laptop.

@weaponex: Why it would crash a computer? Or do you also mean that it would if you tried to store all the answers?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Local $set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
$set_len = StringLen($set)
Local $max_len = 3 ; I limit it to 3 just as an example, you can do more
Local $max
For $i = 0 To $max_len
    $max += $set_len^$i
Next

; $max now contains the highest "number" you'll need, so...

For $i = 1 To $max
    ConsoleWrite(FindPhrase($i, $set) & @CRLF)
NextoÝ÷ Ù.r¥u©l¡Ú"¶X¤zØb±«­¢+Ù1½°ÀÌØíÕÉɹÐôÄ)1½°ÀÌØíÍÐôÌäí¡¥©­±µ¹½ÁÅÉÍÑÕÙÝáåé    
!%)-159=AEIMQUY]aehÄÈÌÐÔØÜàäÀÌäì)]¡¥±MÑÉ¥¹1¸¡¥¹A¡ÉÍ ÀÌØíÕÉɹаÀÌØíÍФ¤±ÐìôÌìQ¡ÉÌäí̵äµà±¹Ñ ¥¸(
½¹Í½±]ɥѡ¥¹A¡ÉÍ ÀÌØíÕÉɹаÀÌØíÍФµÀì
I1¤(ÀÌØíÕÉɹЬôÄ)]¹

Now, your right that it will take an increasingly enormous amount of time to finally get through.

For max_len of 1, you'll have 62 "answers" (62^1)

For max_len of 2, you'll have 3,906 "answers" (62^1+62^2)

For max_len of 3, you'll have 242,234 "answers" (62^1+62^2+62^3)

For max_len of 4, you'll have 15,018,570 "answers (62^1+62^2+62^3+62^4)

And so on...

The main reason I made my function the way I did was so you could do this in a more distributed way.Just calculate the total number of phrases you want made, divide by the number of computers you have to run this, and then you can give each computer a script with this function, and different subsets of numbers to generate. Keeps you from having to run it all on one computer.

Of course, as with anything in this nature (highly repetitive, exponential increase of time), C would be a better choice of language to make it a LOT faster.

Edited by SkinnyWhiteGuy

Share this post


Link to post
Share on other sites

Now, your right that it will take an increasingly enormous amount of time to finally get through.

For max_len of 1, you'll have 62 "answers" (62^1)

For max_len of 2, you'll have 3,906 "answers" (62^1+62^2)

For max_len of 3, you'll have 242,234 "answers" (62^1+62^2+62^3)

For max_len of 4, you'll have 15,018,570 "answers (62^1+62^2+62^3+62^4)

And so on...

The main reason I made my function the way I did was so you could do this in a more distributed way.Just calculate the total number of phrases you want made, divide by the number of computers you have to run this, and then you can give each computer a script with this function, and different subsets of numbers to generate. Keeps you from having to run it all on one computer.

Of course, as with anything in this nature (highly repetitive, exponential increase of time), C would be a better choice of language to make it a LOT faster.

Fine.

Just a small point about your calculation 62^1 + 62^2 etc

I had thought that the number of combinations was 62^n but I now see that your calculation is correct, but it wasn't obvious to me at first. Thanks.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0