## Simple brute force output

Get help with using AutoHotkey and its commands and hotkeys
buzhard
Posts: 3
Joined: 13 Jan 2019, 11:37

### Simple brute force output

Hello,

I got AHK because I needed to make a macro, and didnt realise how complex it was setting it up ! To make it harder, english is not my first language, so I'll try explain what I need to build and hope somebody will help me I assume the script I need is quite easy and fast to build for somebody skilled. However any tips or advices are very welcome

The macro I need is :

my keybord has to output every possibility of eXXXX

----in eXXXX, each X is a number from 0 to 9
----It has to try every possible combination from e0000 to e9999

so it goes :

e0000, e0001, e0002, e0003 .......
......e0010, e0011, e0012, e0013 ......
..................e9997,e9998,e9999

Also, is there a way to generate all possible combination of eXXXX at once without having to write it down manually ? 10x10x10x10 = 10000 possibilities :S

Thanks in advance for your help, and sorry for the noob questions
Scr1pter
Posts: 1069
Joined: 06 Aug 2017, 08:21
Location: Germany

### Re: Simple brute force output

Hi,

I think this isn't so difficult.
Even though I don't like the words brute force, I'll help you anyway.

Try this:

Code: Select all

``````Pause::
Pause
return

Loop, 9999 ; 9999 possibilities
{
if A_Index < 10 ; For the first 9 rounds:
{
combination = 000%A_Index% ; combination = 3 leading zeroes + current round
}
if A_Index between 10 and 99 ; For the 10th till 99th round:
{
combination = 00%A_Index% ; combination = 2 leading zeroes + current round
}
if A_Index between 100 and 999 ; For the 100th till 999th round:
{
combination = 0%A_Index% ; combination = 2 leading zeroes + current round
}
if A_Index > 999 ; For the rest:
{
}
Send e%combination%,%A_Space% ; Send this combination with comma and space
Sleep, 5 ; Small buffer for having a chance to pause the script
}
return``````
Cheers!
Please use code tags when posting code!
Keyboard: Logitech G15 FE - Mice: Logitech G9 FE, G502 FE, G602 - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.29.00
rommmcek
Posts: 539
Joined: 15 Aug 2014, 15:18

### Re: Simple brute force output

Here is a bit quicker version:

Code: Select all

``````Numpad9::
Loop, 10000
combination .= "e" SubStr("000" A_Index-1, -3) ", "
Clipboard:=""
Clipboard:= Combination
ClipWait, 1
Send, ^v
return``````
Scr1pter
Posts: 1069
Joined: 06 Aug 2017, 08:21
Location: Germany

### Re: Simple brute force output

@rommmcek:
But one point is not clear to me:
Does it paste everything at once, or each combination in sequence?
(That's why I always prefer using { } )
According to your tab it looks like it generates all the combinations
and then pastes them at once.

It does not work for me, though.
This modified version works for me:

Code: Select all

``````Numpad9::
clipboardBackup := ClipboardAll ; Zwischenablage sichern
Loop, 10000 ; 10000 mögliche Kombinationen
{
kombination .= "e" SubStr("000" A_Index-1, -3) ", "
Sleep, 5
Clipboard := kombination ; Zwischenablage = Aktuell generierte Kombination
ClipWait, 0.1 ; 100 ms warten, dass die Zwischenablage Daten enthält
Send, ^v ; Kombination einfügen
}
Clipboard := clipboardBackup ; Zwischenablage wiederherstellen
return``````
I think pasting them in a sequence makes more sense, because any target application would expect only 1 value, not 10000 values at once

@buzhard:
Even though you deleted your post, I can remember some of the questions:
Yes, I originally forgot adding e0000 as starting combination.
The e was always a part of each combination, that's why it is: Send e%combination%,%A_Space%
And brute force sounds like hacking to me, that's why I dislike this word.
I'm not saying you're trying to hack something, though.

Cheers!
Please use code tags when posting code!
Keyboard: Logitech G15 FE - Mice: Logitech G9 FE, G502 FE, G602 - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.29.00
buzhard
Posts: 3
Joined: 13 Jan 2019, 11:37

### Re: Simple brute force output

Thanks a lot for your fast help, guys !
Yeah I deleted my response coz I asked questions, but got answers when re reading the script more carfully and didnt want to spam the forum uselessly.
Didnt have time to try the script in situation yet, I'll let you know when it's done !
buzhard
Posts: 3
Joined: 13 Jan 2019, 11:37

### Re: Simple brute force output

Okay I -almost- understand the script Tested it, it works fine but it is too fast I guess ...

So here comes another question : I need to put a delay between "e" and "XXXX". I also need to replace ", " with another delay.
More tricky, (not sure if I need it though), but maybe I'll need even a delay between each number.

How could I set, lets say, 1/10 or 1/100 of a second delay between each single character ?

(By the way, thanks a lot for your help, guys)
Scr1pter
Posts: 1069
Joined: 06 Aug 2017, 08:21
Location: Germany

### Re: Simple brute force output

Hi,

I think SetKeyDelay will be the right command for that.