Sign in to follow this  
Followers 0
juk

Catching user input

7 posts in this topic

I'm trying to make a script that runs a certain software application and uses an ini-file to store a username and a password for this program. Those may change when on another workstation so the application let's the user know that the username or password was wrong and asks for them again. Now, I want to have the script catch the retyped username and password when the user types them and then store the right ones into the ini-file. That's the big picture, but I've got a little problem with the catching part.

The login comes in a popup window ("Login") and it closes when user presses "ok". I was trying to do the catching like this:

Do
     $user=ControlGetText("Login","","Edit1")
     $passwd=ControlGetText("Login","","Edit2")
Until WinExists("Login")=0
But it failed. Any suggestions?

-juk

Share this post


Link to post
Share on other sites



I'm trying to make a script that runs a certain software application and uses an ini-file to store a username and a password for this program. Those may change when on another workstation so the application let's the user know that the username or password was wrong and asks for them again. Now, I want to have the script catch the retyped username and password when the user types them and then store the right ones into the ini-file. That's the big picture, but I've got a little problem with the catching part.

The login comes in a popup window ("Login") and it closes when user presses "ok". I was trying to do the catching like this:

Do
     $user=ControlGetText("Login","","Edit1")
     $passwd=ControlGetText("Login","","Edit2")
Until WinExists("Login")=0
But it failed. Any suggestions?

-juk

<{POST_SNAPBACK}>

why not supress the error? i mean, assuming that the person knows their password is going to be saved (and this isn't a password stealer) why can't you make a gui with the same coordinates and dimensions as the bad pass pop up, then do something like:

; assumes you have made a gui with the same dimensions and location coords as the error in code above this
while 1
if winactive("Bad Pass Error Title")  then GUISetState (@SW_SHOW)
if winactive("The window title that loads if pass is right") then exitloop
wend

your gui could say like 'password failed please re-enter username and password to have them saved and resubmitted'. and position itself to exactly cover the other window where they would be typing them in themselves. after they enter the info, you write the data to your ini file, and controlsend() them to the window that your window has hidden in the background...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

why not supress the error? i mean, assuming that the person knows their password is going to be saved (and this isn't a password stealer) why can't you make a gui with the same coordinates and dimensions as the bad pass pop up, then do something like:

<{POST_SNAPBACK}>

It's not for stealing passwords, but just automating a certain run with different workstations. The popup login window comes always when starting that program and it then shows a msgbox, if you typed in wrong username or passwd. Now I'm already supressing that msgbox, but the login is still there unless correct ones are entered. I think it closes for a split second or so even with wrong login, because it exited that loop in my code, with wrong username.

In anycase, I'd rather do this without extra gui hassle. If there is a way to catch the strings from the original login window when (or just before) user pressed ok and the window closes, I'd rather do it that way.

-juk

Share this post


Link to post
Share on other sites

It's not for stealing passwords, but just automating a certain run with different workstations. The popup login window comes always when starting that program and it then shows a msgbox, if you typed in wrong username or passwd. Now I'm already supressing that msgbox, but the login is still there unless correct ones are entered. I think it closes for a split second or so even with wrong login, because it exited that loop in my code, with wrong username.

In anycase, I'd rather do this without extra gui hassle. If there is a way to catch the strings from the original login window when (or just before) user pressed ok and the window closes, I'd rather do it that way.

-juk

<{POST_SNAPBACK}>

it is possible with dll calls, but that would be tougher code to write than the little gui with 3 controls. although i don't see why you're not able to just log the keyboard input in the event of failed send, using the appearance of the success window (the program that should have loaded) as your exit condition. example in psuedo code:

;above would be the code to send the password saved to file
...
while 1
if WinExists("Bad Pass") then ExitLoop
if WinExists("Good Pass") then Exit
WEnd
keylogger();you have to write your own keylogger script or find one that fits your purpose 
Func keylogger()
...
your actual logging code above
if winexists("Good Pass") Then
$blah = StringSplit($logged,chr(9));parses logged input, assumes they pressed tab to change fields, and clicked to submit
IniWrite("passfile.ini","USERID","UN",$blah[1])
IniWrite("passfile.ini","USERID","PW",$blah[2])
EndFunc

but i still say that a gui asking them to type in info themselves, then it is saved and sent by your gui would be the best way to go.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

it is possible with dll calls, but that would be tougher code to write than the little gui with 3 controls. although i don't see why you're not able to just log the keyboard input in the event of failed send, using the appearance of the success window (the program that should have loaded) as your exit condition.

<{POST_SNAPBACK}>

Hmm, yes.. didn't really even think of logging, cause I thought this would be much more simple. Maybe I'll try that and if it doesn't work, I guess I have to make that gui box.

- juk

Share this post


Link to post
Share on other sites

Hmm, yes.. didn't really even think of logging, cause I thought this would be much more simple. Maybe I'll try that and if it doesn't work, I guess I have to make that gui box.

- juk

<{POST_SNAPBACK}>

as far as which method is simple, "simple" is very subjective.

dll calls would be least amount of code, but probably most amount of research required.

keylogger would be most amount of code, but not much research.

gui is middle ground for amount of code to be added with far less than keylogger, but more than dll calls would need, but very little research necessary... that's why i would have gone with that solution first...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

as far as which method is simple, "simple" is very subjective.

<{POST_SNAPBACK}>

As far as ControlGetText is simple. :) Unfortunately that didn't do the trick.

-juk

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