Jump to content

Using random to create a username then save to a variable... ERROR! HELP!


Recommended Posts

Hey guys im trying to generate a password and username based off A-Z. Im trying to get it to then save the generated password to a permeate variable.

Heres my code sofar.

$UsernameLength = Random(10, 15)
$PassLength = Random(10, 15)

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    For $x2 = 0 To $UsernameLength
        $UsernameSaved = Chr(Random(Asc("A"), Asc("Z"), 1))
        Send($UsernameSaved)
        Iniwrite("Config.ini", "Account", "Username", $UsernameSaved)
    Next


    Sleep(500)
    Send("{TAB}")
    Sleep(500)

    For $x3 = 0 To $PassLength
        $SavedPassword = Chr(Random(Asc("A"), Asc("Z"), 1))
        Send($SavedPassword)
        $SavedPassword = $Password
        Iniwrite("Config.ini", "Account", "Password", $Password)
    Next
    Send("{TAB}")
    Sleep(500)
    Send($Password)
    Sleep(500)
    Mouseclick("Left", 703, 580)
    Sleep(500)
    Mouseclick("Left", 597, 524)
    Send($SavedPassword & "@" & "gmail.com")
    Sleep(500)
    Send($SavedPassword & "@" & "gmail.com")
    Sleep(500)
    Mouseclick("Left", 205, 536)
    Sleep(500)
    Mouseclick("Left", 390, 301)
    Send($SavedPassword)
    Sleep(500)
    Send("{Enter}")
    Sleep(500)

As you can see, it is generating an account. Non Malicous dont worry.

The account layout is like so.

Account: ***Generated by my script*** then saved to variable $UsernameSaved

Pass: ****Generated by my script *** Then saved to variable $SavedPassword

Pass Confirmation: $SavedPassword

It uses tab to navigate, however it is incorrectly saving my generated username and password to a variable.

Whats wrong with the script?

Edited by ecstatic
Link to comment
Share on other sites

i don't see where you are GETTING the password\username

EDIT

alright i see it now :) its at the VERY top above the other code...

im thinking an error in the Send parts.. or the Chr part

Edited by CodyBarrett
Link to comment
Share on other sites

Your sending the characters and saving before generating the entire string. Try something like this instead: (not tested code)

$UsernameLength = Random(10, 15)
$PassLength = Random(10, 15)

;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    
    $UsernameSaved = CreateRandom($UsernameLength)
    Iniwrite("Config.ini", "Account", "Username", $UsernameSaved)
    $SavedPassword = CreateRandom($PassLength)
    Iniwrite("Config.ini", "Account", "Password", $SavedPassword)
    
    
    
    Send($UsernameSaved)
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    
    Send($SavedPassword)
    Iniwrite("Config.ini", "Account", "Password", $SavedPassword)
    Send("{TAB}")
    Sleep(500)
    Send($Password)
    Sleep(500)
    Mouseclick("Left", 703, 580)
    Sleep(500)
    Mouseclick("Left", 597, 524)
    Send($SavedPassword & "@" & "gmail.com")
    Sleep(500)
    Send($SavedPassword & "@" & "gmail.com")
    Sleep(500)
    Mouseclick("Left", 205, 536)
    Sleep(500)
    Mouseclick("Left", 390, 301)
    Send($SavedPassword)
    Sleep(500)
    Send("{Enter}")
    Sleep(500)
    
Func CreateRandom($length)
    For $i = 0 to $length
        $chr = Chr(Random(Asc("A"), Asc("Z"), 1))
        $returned &= $chr
    Next
    
    Return $returned
    
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...