Sign in to follow this  
Followers 0
colombeen

Captive Portal-like script?

7 posts in this topic

Hi guys

I'd like to know if it is possible to create some kind of script that acts like a captive portal for IE?

We want the browser to start at a specific page where users have to provide their name and select an item from a dropdown list and until they have done that they shouldn't be able to go to any other page.

Does anyone know if this is possible?

Greetz

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

at the moment I wrote this : 

#NoTrayIcon
#cs
#   Local Captive Portal
#   by colombeen
#ce
; Includes
    #include <Misc.au3>
    #include <MsgBoxConstants.au3>
    #include <WindowsConstants.au3>
; Prevent Multiple processes of LCP
    If _Singleton("LCP", 0) = 0 Then Exit
; Variables
    Global $LCP
    Global $LCPTitle        =   "Test Captive Portal"
    Global $LCPDefaultURL   =   "http://www.google.com"
    Global $LCPExitPwd      =   "test"
    Global $LCPExitMsg      =   "Provide the password to exit " & @CRLF & $LCPTitle
; Set HotKeys
    HotKeySet ("+!^{F8}", "_ExitLCP")
; Init the LCP app
    While 1
        $LCPBrowser         =   ObjGet ("", "InternetExplorer.Application")
        If Not @error Then
            MsgBox (0, "test", "IE found")
        Else
            MsgBox (0, "test", "ObjGet Error: " & @error)
        EndIf
        Sleep (5000)
    WEnd
; Functions
    Func _ExitLCP ()
        $ExitPwd            =   InputBox ($LCPTitle, $LCPExitMsg, "", "*", -1, -1, Default, Default, 30)
        If $ExitPwd = $LCPExitPwd Then
            MsgBox ($MB_SYSTEMMODAL, $LCPTitle, $LCPTitle & " is closed")
            Exit
        EndIf
    EndFunc

But when I start an IE screen i keep getting a very large error number (-2147352570) but I can't seem to find an explanation for the error code

Anyone who can help?

If you can do ObjCreate ("InternetExplorer.Application") you should be able to get it also with ObjGet ("", "InternetExplorer.Application"), or am I wrong?

Edited by colombeen

Share this post


Link to post
Share on other sites

Anyone?

Yes!

In order to manipulate Internet explorer (IE), you must first include it in your script and make some programmatic effort use a function in the UDF.

Posting a bunch of unrelated code as some token is not enough.

Like I said, "beforenavigte" is what I think you need.

The only example of it off my head is '?do=embed' frameborder='0' data-embedContent>>.

It triggers a function, and then you tell it what to do.

Put some effort in.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

The problem isn't creating an IE window etc... I don't want to create anything, only capture the obj when someone opens IE and handle it from that point.

When I start with objcreate internetexplorer.application it actually is an obj i can use but i don't want to do that.

the script needs to "listen" for the creation of new IE windows and when it sees a new IE window it should apply my rules.

so i can capture stuff from a script created IE obj but not from an IE obj that was created by clicking the IE-shortcut on the desktop... (there is the issue)

do you know how to help me with that? i've been looking around and some scripts say that i need to use shell.application etc instead of internetexplorer.application but none of the classes have worked so far.

Also, none of the code I've tried so far requires the IE.au3 file... When I'm able to get the IE obj, I think I'll need the udf from that point on...

Edited by colombeen

Share this post


Link to post
Share on other sites

Just use _IEAttach instead of objget, then follow the advice given.

Share this post


Link to post
Share on other sites

Pfff... the script sucks in my opinion... Maybe something else: is there a way to create more of an actual captive portal script for a local workstation (not server etc) that listens for http/https traffic and redirects the request to a different page?

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