Jump to content

Iterating Character Generator


JonathanChan
 Share

Recommended Posts

Hi,

Here's a character generator for anyone interested... I can't think of any other uses for it than bruteforce, but it was a fun exercise writing....

There are actually 2 programs here... Run char_list_generator seperately to copy and paste a character list in $char_list variable... Current charlist is all ascii characters....

#include<Array.au3>

; Seed string (the first character in the char_list array is a good way to start - ours is space)
$chars=" "

while True
    tooltip(""""&$chars&"""")
    sleep(1)
    $chars=generate_character($chars)
WEnd

func generate_character($cur_string)
    $char_list=" !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
    $char_list=StringSplit($char_list,"")
    $split_string=StringSplit($cur_string,"")
    for $i = 1 to $split_string[0] Step 1
        $cur_char=_ArraySearch($char_list,$split_string[$i],1,0,1)
        if $cur_char = $char_list[0] Then ; Reached end of array, time to loop again.
            $split_string[$i]=$char_list[1]
            ;ExitLoop
            $reset=True
            if $split_string[0]=$i Then
                ExitLoop
            EndIf
        else
            $reset=False
            $split_string[$i]=$char_list[$cur_char+1]
            ExitLoop
        EndIf
    Next
    
    if $reset=True Then
        _ArrayAdd($split_string," ")
    EndIf
    return _ArrayToString($split_string,"",1)
EndFunc

func char_list_generator()
    $tmp=""
    for $i=32 to 126
        $tmp=$tmp&chr($i)
    Next
    InputBox("Character String Generator","Characters:",$tmp)
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...