Jump to content

_IECreate/Navigate Log in credentials in url?


Recommended Posts

Hello, I've been trying to use login credentials in urls with IECreate and IENavigate, but I couldn't get it to work :mellow:

Test 1:

#include <IE.au3>
$oIE = _IECreate ("http://username:password@192.168.1.1/",0,0,1)

_IENavigate($oIE, )
$sText = _IEBodyReadText ($oIE)
ConsoleWrite($sText)

Result: Windows Login pops up and asks me for username and password

Test 2:

#include <IE.au3>
$oIE = _IECreate ("",0,0,1)

_IENavigate($oIE, "http://username:password@192.168.1.1/")
$sText = _IEBodyReadText($oIE)
ConsoleWrite($sText)

Result: Same as first test..

Test 3:

#include <INet.au3>

_INetGetSource("http://username:password@192.168.1.1/Status_Conntrack.asp")
$sText = _IEBodyReadText ($oIE)
ConsoleWrite($sText)

Same results..

How can I login without needing to have the user to enter the credentials and without interfering the user?

Link to comment
Share on other sites

That syntax is entirely optional to the server end. It looks like you're trying to connect to the admin page of a router. If that router's web service was not coded to accept credentials that way, then you just don't.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

had the same problem when I wanted to access my router...

the only solution I found was to use a registry fix which allows the "username:password@" bit to work

save this as a .reg file and run it

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl] 
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE]
"iexplore.exe"=dword:00000000
"explorer.exe"=dword:00000000
Link to comment
Share on other sites

had the same problem when I wanted to access my router...

the only solution I found was to use a registry fix which allows the "username:password@" bit to work

That's cool, but still only works if the server (i.e. router) supports it. Because the HTTP request is plain text on the wire, I believe many do not.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

only ever used it on my netgear dg834gt for getting my stats in realtime on my desktop....

i use

$STATS = _INETGETSOURCE("http://admin:password@192.168.0.1/s_status.htm")

and it logs me in just fine

be interesting to see which routers it works on then :mellow:

Link to comment
Share on other sites

That "plain text on the wire" part doesn't bother you then? Because it also implies "plain text on the WiFi", if it's a WiFi/router/firewall combo box.

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I got Linksys WRT610N, with DD-WRT installed on it, I have tested this in firefox too, seems to work great there. but in IE its kinda funky.. some times it cant find the address because of the login credentials in the url and sometimes it will but then asks me for username and password(popup)

Edited by Chris86
Link to comment
Share on other sites

only ever used it on my netgear dg834gt for getting my stats in realtime on my desktop....

i use

$STATS = _INETGETSOURCE("http://admin:password@192.168.0.1/s_status.htm")

and it logs me in just fine

be interesting to see which routers it works on then :P

It worked :mellow: but I need to remove all html tags etc.

Im not really good at this but for stringregexpreplace pattern, if someone could give me a little hint how to replace a string and everything between those two strings ex: <head> CODE </head>

and can I replace serveral strings with only one stringregexpreplace? EX: <head> CODE </head> and <th> CODE </th> and ... and ...

Edited by Chris86
Link to comment
Share on other sites

Check this small example

$nOffset = 1
While 1
    $array = StringRegExp('<div id="likely_problems"><span class="congrats_msg"><img src="http://test.com/images/feedback.gif" alt="Feedback"/> Congratulations! No likely problems.</div>', '<(?i)div id="likely_problems">(.*?)</(?i)div>', 1, $nOffset)
    If @error = 0 Then
        $nOffset = @extended
    Else
        ExitLoop
    EndIf
    for $i = 0 to UBound($array) - 1
        msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i])
    Next
WEnd
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...