Sign in to follow this  
Followers 0
RogFleming

How to submit credentials to webpages

7 posts in this topic

I been looking and trying many ways to submit credentials to webpages. I had issues with focus, getting the browser window

to remain focused. Have credentials sent tot eh wrongs fields and exposing the password. Is this a better way to submit

usernaem and passwords to e-mails sites like gmal, yahoo. msn. hotmail?

I found this and was curious if it was a method to use

$chiusura = FileRead("D:\repe\chiusura.txt")
$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, $chiusura)
_IEFormSubmit ($oForm)
_IEAction ($oIE, "back")
_IELoadWait ($oIE)

$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oSubmit = _IEGetObjByName ($oIE, "whocares")
_IEAction ($oSubmit, "click")

My current scripts just use the send command to the active window.

Func _StartApp()
    If WinExists($Login_Win) Then
        _SetWinMax($Login_Win)
        _LoginApp()
    Elseif WinExists($Suc_Login_Win) Then
        _SetWinMax($Suc_Login_Win)
        MsgBox(1,"","Program is already running")
        Exit
    Else
        $pid =Run($Program_Exe&" "&$Program_Arg)
        If ProcessExists($pid) Then
            WinWaitActive($Login_Win,"",$_TIMEOUT)
            _SetWinMax($Login_Win)
            _LoginApp()
        Else
            ConsoleWrite("StartApp Error"&" "&"No defined window was found")
            Exit
        EndIf
    EndIf
Endfunc

;LoginApp Procedure
Func _LoginApp()
        WinActivate($Login_Win)
        WinSetState($Login_Win, "", @SW_MAXIMIZE)
        Send($applogin)
        Send("{TAB}")
        Send($apppwd)
        Send("{ENTER}")
        _LoginResults()
Endfunc

thanks for any assistance you can provide.

Share this post


Link to post
Share on other sites



Heya RogFleming

Using the ie.au3 library is the best idea cause it's really efficient.

Check out this site, it has examples using the ie.au3 liberary to login to hotmail and gmail:

http://quadryders.com/phpcc/browse.php?cid=2

Share this post


Link to post
Share on other sites

Hello,

I think it's not good to put usernames and passwords directly into programs. I'm using a scheme where all the access details are in separate text files, one per site. All the these files are stored in a TrueCrypt file. The script looks on every drive for the plain-text file. If it fails to find, it uses TrueCrypt to mount the drive and I enter the TrueCrypt password manually. TrueCrypt is set to dismount after 1 hour of non-use.

I'm using FireFox and FF.au3. For the methods of sending the details to the site it seems like every site is different. Some work easily with FFSetValue, others need more tedious methods.

Richard.

Share this post


Link to post
Share on other sites

Richard,

thanks for your reply, I using an LDAP directory and storing each site's credentials with AES 256 bit encryption. You can look at Apache Directory Server and Sun LDAPSearch and LDAPModify executables. My remaining question would be about how to handle table sused for authentication instead of forms. forms was easy to figure out, but tables not so much.

thanks,

Roger

Share this post


Link to post
Share on other sites

Heya RogFleming

Using the ie.au3 library is the best idea cause it's really efficient.

Check out this site, it has examples using the ie.au3 liberary to login to hotmail and gmail:

http://quadryders.com/phpcc/browse.php?cid=2

how about tables instead of forms?

Share this post


Link to post
Share on other sites

I been looking and trying many ways to submit credentials to webpages. I had issues with focus, getting the browser window

to remain focused. Have credentials sent tot eh wrongs fields and exposing the password. Is this a better way to submit

usernaem and passwords to e-mails sites like gmal, yahoo. msn. hotmail?

I found this and was curious if it was a method to use

$chiusura = FileRead("D:\repe\chiusura.txt")
$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, $chiusura)
_IEFormSubmit ($oForm)
_IEAction ($oIE, "back")
_IELoadWait ($oIE)

$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oSubmit = _IEGetObjByName ($oIE, "whocares")
_IEAction ($oSubmit, "click")

My current scripts just use the send command to the active window.

Func _StartApp()
    If WinExists($Login_Win) Then
        _SetWinMax($Login_Win)
        _LoginApp()
    Elseif WinExists($Suc_Login_Win) Then
        _SetWinMax($Suc_Login_Win)
        MsgBox(1,"","Program is already running")
        Exit
    Else
        $pid =Run($Program_Exe&" "&$Program_Arg)
        If ProcessExists($pid) Then
            WinWaitActive($Login_Win,"",$_TIMEOUT)
            _SetWinMax($Login_Win)
            _LoginApp()
        Else
            ConsoleWrite("StartApp Error"&" "&"No defined window was found")
            Exit
        EndIf
    EndIf
Endfunc

;LoginApp Procedure
Func _LoginApp()
        WinActivate($Login_Win)
        WinSetState($Login_Win, "", @SW_MAXIMIZE)
        Send($applogin)
        Send("{TAB}")
        Send($apppwd)
        Send("{ENTER}")
        _LoginResults()
Endfunc

thanks for any assistance you can provide.

New updated code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=..\..\..\Program Files\Xyloc\XSOServer\apps\gmail.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;IE_BASED_SCRIPT Created: 02162011
#include-once
#include <sso.au3>

;Global Values
AutoItSetOption("PixelCoordMode", 0)
AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("WinTitleMatchMode", 2)
AutoItSetOption("WinTextMatchMode", 2)
AutoItSetOption("MustDeclareVars", 1)


;Global Variables


;Defined Variables
Global $_TIMEOUT=15
Global $app="gmail"
Global $pid,$found_win, $found_text, $hwnd, $oIE, $ActWin, $AD_USERNAME, $oform, $ologin, $opassword, $osubmit
;Program Start Variables
Global $Program_Exe= "C:\Program Files\Internet Explorer\iexplore.exe"
Global $Program_Arg= "www.gmail.com"
;Login dialog Variables
Global $Login_Win="Gmail: Email from Google"
Global $Login_Txt="Username"
;Logon Credentials Variables
Global $applogin
Global $apppwd
;Login Result Variables
Global $Inv_Login_win= "Gmail: Email from Google"
Global $Inv_Login_Txt= "incorrect"
Global $Exp_Pwd_win= ""
Global $Exp_Pwd_Txt= ""
Global $Locked_win= ""
Global $Locked_Txt= ""
Global $Err_App_win= ""
Global $Err_App_Txt= ""
Global $Suc_Login_Win= "Gmail - Inbox"
Global $Suc_Login_Txt= "Inbox"
;Password Change Variables
Global $Accept_Pwd_win= ""
Global $Accept_Pwd_Txt= ""
Global $Makeup_Pwd_win= ""
Global $Makeup_Pwd_Txt= ""
Global $History_Pwd_Win= ""
Global $History_Pwd_Txt= ""

If $cmdline[0] = "" Then
        Msgbox(1,"Syntax Error","You must define a unique user.")
        Exit
Else
        $AD_USERNAME = $cmdline[1]
        _GetAppCredentials($AD_USERNAME,$app)
        StartApp()
EndIf

Func StartApp()
                $oIE = _IECreate("http://mail.google.com",1)
                _IEPropertySet ( $oIE, "left", "0")
                _IEPropertySet ( $oIE, "top", "0")
                _IEPropertySet ( $oIE, "height", @DesktopHeight)
                _IEPropertySet ( $oIE, "width", @DesktopWidth)
                LoginApp()
Endfunc

;LoginApp Procedure
Func LoginApp()
        ; get pointers to the login form and username and password fields
        $oform = _IEFormGetObjByName($oIE, "gaia_loginform")
        $ologin = _IEFormElementGetObjByName($oform, "Email")
        $opassword = _IEFormElementGetObjByName($oform, "Passwd")
        $osubmit = _IEFormElementGetObjByName($oform, "signIn")
        ; Set field values and submit the form
        _IEFormElementSetValue($ologin, $applogin)
        _IEFormElementSetValue($opassword, $apppwd)
        _IEAction ($osubmit, "click")
        _LoginResults()
Endfunc

;LoginResults Procedure
Func    _LoginResults()

        $found_win = WinWaitActive($Suc_Login_Win,"",$_TIMEOUT)
        If $found_win = 0 Then

        Select

            Case    WinExists($Login_Win,"")
                    $hwnd = WinWait($Login_Win)
                    $oIE = _IEAttach($hwnd,"HWND")
                    $found_text = _IEBodyReadText($oIE)
                        Select

                        Case StringInStr($found_text,$Inv_Login_Txt,2)
                            _InvLogin($AD_USERNAME,$app)
                            $oform = _IEFormGetObjByName($oIE, "gaia_loginform")
                            $ologin = _IEFormElementGetObjByName($oform, "Email")
                            $opassword = _IEFormElementGetObjByName($oform, "Passwd")
                            $osubmit = _IEFormElementGetObjByName($oform, "signIn")
                            ; Set field values and submit the form
                            _IEFormElementSetValue($ologin, $applogin)
                            _IEFormElementSetValue($opassword, $apppwd)
                            _IEAction ($osubmit, "click")
                            _LoginResults()

                        Case StringInStr($found_text,$Login_Txt,2)
                            MsgBox(1,"IE Error","Logon Dialog text did not change.")

                        Case StringInStr($found_text,$Suc_Login_Txt,2)
                            MsgBox(1,"Logon Results","Logon Successful!",2)

                        Case Else
                            ConsoleWrite("IE Error"&" "&"No defined text was found: "&$found_text)
                            Exit
                        EndSelect

            Case    WinExists($Inv_Login_win,"")
                    _InvLogin($AD_USERNAME,$app)
                    $oform = _IEFormGetObjByName($oIE, "gaia_loginform")
                    $ologin = _IEFormElementGetObjByName($oform, "Email")
                    $opassword = _IEFormElementGetObjByName($oform, "Passwd")
                    $osubmit = _IEFormElementGetObjByName($oform, "signIn")
                    ; Set field values and submit the form
                    _IEFormElementSetValue($ologin, $applogin)
                    _IEFormElementSetValue($opassword, $apppwd)
                    _IEAction ($osubmit, "click")
                    _LoginResults()


            Case    WinExists($Err_App_win,"")
                    $hwnd = WinWait($Err_App_win)
                    $oIE = _IEAttach($hwnd,"HWND")
                    $found_text = _IEBodyReadText($oIE)
                    Select

                        Case StringInStr($found_text,"Maintenance",2)
                        MsgBox(1,"","Website is done for maintenance")

                        Case StringInStr($found_text,"500",2)
                        MsgBox(1,"","You do not permission to access this site.")

                        Case Else
                        ConsoleWrite("Login Results "&"No defined text was found.")

                    EndSelect


            Case Else
                        ConsoleWrite("Login Results "&"No defined text was found: "&$found_text)
                        Exit
            EndSelect
        Else
            _SetWinMax($Suc_Login_Win)
            MsgBox(1,"","Logon Successful!",1)
        EndIf
EndFunc

Share this post


Link to post
Share on other sites

Roger,

Sorry, no experience with tables and IE. Some with FireFox/js/GreaseMonkey, which should transfer to FF.au3 but I haven't needed to try yet.

Richard.

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