Jump to content
Sign in to follow this  
sheck

Cannot get to password protected sites

Recommended Posts

sheck

I'm not able to navigate to password protected sites (example: https://einsof-haras.ca/pshs/)

As I understand IE gets some sort of responce, telling it to ask for login credentials. How do I capture it? I looked through help file and search forums, but couldn't find anything.

#include <GUIConstants.au3>
#include<IE.au3>
$Main_Window = GUICreate("Custom Web Browser", 907, 565, -1, -1)
$IE_Obj = _IECreateEmbedded()
$IE_GUI_Obj = GUICtrlCreateObj($IE_Obj, 3, 63, 900, 477)
_IENavigate($IE_Obj, "https://" & "einsof-haras.ca/pshs/", 1)
GUISetState()

While 1
 Sleep(100)
WEnd
Edited by sheckandar

Live and Learn, 'cause Knowledge is Super Power.

Share this post


Link to post
Share on other sites
LuI

I'm not able to navigate to password protected sites (example: https://einsof-haras.ca/pshs/)

As I understand IE gets some sort of responce, telling it to ask for login credentials. How do I capture it? I looked through help file and search forums, but couldn't find anything.

sheckandar,

here's what I did

; open IE & navigate to Visualweb, wait for load
$o_IE = _IECreate ()
_IENavigate ($o_IE, "http://getemed1:8080/visualtime/index.jsp")
_IELoadWait($o_IE)
; get the frame_object, form and controls
$o_Doc =_IEDocGetObj($o_IE)
$o_Mainframe =_IEFrameGetObjByName($o_IE, "mainframe")
$o_LoginForm = _IEFormGetObjByName($o_Mainframe, "login")
$o_UserID = _IEFormElementGetObjByName($o_LoginForm , "userid")
$o_Passphrase = _IEFormElementGetObjByName ($o_LoginForm , "password")
; set values, submit & wait for reload
_IEFormElementSetValue ($o_UserID, "YourUserName")
_IEFormElementSetValue ($o_Passphrase, "YourPW")
_IEFormSubmit ($o_LoginForm)
;Check for reload of page
$Result = _IELoadWait($o_IE, 1000)

The problem is you need to know some details about the visited page. Try to 'view' its source code.

In my example 'mainframe' is the name of one of the frames containing the login-form. That form is named 'login' and has the elements named 'userid' and 'password'. After having set those contents I submit the form and check for the reload of that page

HTH

Share this post


Link to post
Share on other sites
Draygoes

This is going to produce an error. You cannot simply call a .jps file from a password protected page. The server is likely to redirect you, and log your ip adress.

Could you explain what you are trying to do a little bit better?


Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 

Share this post


Link to post
Share on other sites
Prophet

If its Basic http authentification (not Form) you can use https://username:password@thesite.com

I dont know the _IE library, but you could use something similar with a post request. For example: https://somesite.com/auth.cgi?user=username...p;submit=submit.

Offcourse youd have to replace the user,pass,action,etc, with the variables from the form login page. And you have to be able to use cookies.


+==================================================================+| The Definition of Madness: Creating a GUI, with GUI automation scripts |+==================================================================+

Share this post


Link to post
Share on other sites
sheck

I'm making a browser for myself. I cannot use http://user:password@domain.com format, because I don't know which sites that I will use in the future will be protected with user name and password. If I use that then, i will have to reprogram browser every time I use a new site.

No to frames either, becuase these sites do not have frames. It's a GUI login.

What I need is a way for the IE ActiveX to know which websites require login. I'm not talking about site like GMail, click on the link I provided in the first post and it will become clear what I need. If you click on the link from within IE, it will prompt you for login info, but if you use the code I provided it will go to Page Cannot Be Displayed or Action Canceled. How to program browser to know when a site is proteced ?

Edited by sheckandar

Live and Learn, 'cause Knowledge is Super Power.

Share this post


Link to post
Share on other sites
NELyon

I'm making a browser for myself. I cannot use http://user:password@domain.com format, because I don't know which sites that I will use in the future will be protected with user name and password. If I use that then, i will have to reprogram browser every time I use a new site.

No to frames either, becuase these sites do not have frames. It's a GUI login.

What I need is a way for the IE ActiveX to know which websites require login. I'm not talking about site like GMail, click on the link I provided in the first post and it will become clear what I need. If you click on the link from within IE, it will prompt you for login info, but if you use the code I provided it will go to Page Cannot Be Displayed or Action Canceled. How to program browser to know when a site is proteced ?

Why over-complicate things? Just check for an authentication window (WinExists) whenever you call the Navigate method on the object.

Share this post


Link to post
Share on other sites
sheck

Why over-complicate things? Just check for an authentication window (WinExists) whenever you call the Navigate method on the object.

Well, that's the problem, authentication window doesn't come up - nothing comes up. It just goes to Page cannot be displayed or Action cancelled. Please note that I use embedded object, not IE window.

Edited by sheckandar

Live and Learn, 'cause Knowledge is Super Power.

Share this post


Link to post
Share on other sites
sheck

No one ever had this issue ? How about the creator of IE.au3 ? Is there a way ?


Live and Learn, 'cause Knowledge is Super Power.

Share this post


Link to post
Share on other sites
Legacy99

The authentication box that get's presented looks like NTLM auth. I'm not that experienced with security and webpages but if that's the case then you can't interact with it easily. (I've tried 6 ways to Sunday and have not found a way). Our Intranet site uses the users logged on creditials when your on the LAN and you gain access without being prompted but it has an external portal using NTLM logon (internet connect). I have not been able to login using AutoIt over the web without some kind of manual intervention to push the script through, even by emulating mouse clicks to select the username and password boxes. It behaves similar to the logon screen with CTRL ALT DEL. The idea is to disable keyloggers and the like so if you find a way, I would be interested in seeing it.

Share this post


Link to post
Share on other sites
DaleHohm

Are you able to provide a reproducer whith which I could test?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
sheck

Are you able to provide a reproducer whith which I could test?

Dale

If you use the code in my 1st post, that should give you an idea. Navigate commad works normally, but it doesn't work when accessing sites protected by .htaccess Let mw know if you need more info.


Live and Learn, 'cause Knowledge is Super Power.

Share this post


Link to post
Share on other sites
DaleHohm

If you use the code in my 1st post, that should give you an idea. Navigate commad works normally, but it doesn't work when accessing sites protected by .htaccess Let mw know if you need more info.

Ah yes, thanks. This site is complicated by the fact that it has a problem with its ssl security certificate.

There may be some things that can be done with navigation events -- I'll play with it when I have some time.

You may also want to read this Microsoft KB: http://support.microsoft.com/kb/834489

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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  

×