Jump to content

Automated Basic Auth Utility


 Share

Recommended Posts

Good Evening. This is my first post. :)

For the short version, skip to Paragraph 4...

My university employs a very simple tactic to make sure only students and faculty have the ability to use their network. To every non-university computer that connects to the outside internet, the firewall brings up a basic auth challenge that asks for you username and password before giving you access to the internet. This would be perfectly fine, if it didnt ask me every 4 hours. As a resident student, it irks me to have my computer's internet "break" every time I go to class.

Because of this frequent re-authorization, my schools firewall breaks many of my internet-enabled applications when it trys to access the net when not authorized. For example, even though IE/Firefox/Opera will ask me for my cridentials again, AIM and other programs will not, so if they happen to get the "authorization request" before my browser does, everything gets screwed, and I have to restart programs to "force" them to "see" the internet.

I created a very simple hack using AutoIt to help maintain my internet connection authorization. It basically asks for the size of a file on the web, passing my cridentials in a username@password:website fashion. It works by asking quickly enough to catch the authorization request before any other app, but this leads to several complications: (1) it isnt 100% foolproof, (2) it needs to constantly ask for a file size, and (3) it sends your cridentials even when not necessary. As the prompt only comes up roughly every 4 hours, I could time the action, but this program can start at any time, and there is no way to detect when a challenge is encountered.

The Short Version (The Actual Question)

So I am looking for a way to make it detect a Basic Authorization challenge behind the scenes, fill it out with a user-defined set of cridentials, and complete the authorization request, while passing the rest of the data to whatever program asked for it. It needs to intercept the request and ONLY the request, fill it out, and return to being behind the scenes, meaning I NEVER see this prompt again. I noticed in the 3.2.1.1 BETA help files that AutoIt has added an expanded set of network functions, and I was wondering if any of these will help me solve this task, or if there is another way.

Thanks.

-Cool-

Link to comment
Share on other sites

Good Evening. This is my first post. :P

For the short version, skip to Paragraph 4...

<skip>

The Short Version (The Actual Question)

So I am looking for a way to make it detect a Basic Authorization challenge behind the scenes, fill it out with a user-defined set of cridentials, and complete the authorization request, while passing the rest of the data to whatever program asked for it. It needs to intercept the request and ONLY the request, fill it out, and return to being behind the scenes, meaning I NEVER see this prompt again. I noticed in the 3.2.1.1 BETA help files that AutoIt has added an expanded set of network functions, and I was wondering if any of these will help me solve this task, or if there is another way.

Thanks.

-Cool-

So, what form does this challenge take? How does it prompt you? Is this a pop-up window from a VPN client, an IE pop-up from a proxy, or what? :)

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

It is an IE Pop-up. I can provide a picture if necessary. Its the same window that pops up when you want to access a "restricted" section of a site; the one with the keys with the blue background, the username/password fields, a "remember my info" checkbox, and OK/CANCEL.

Its application specific, so in Firefox the window looks completely different, but it asks for exactly the same things.

-Cool-

Link to comment
Share on other sites

  • Moderators

Since this is for your benefit only and not something you are going to be putting out to the public, I'd have a look at _IE.au3 in the help file, and stick to using IE ( :) ) while I was in class. Firefox is going to be more of a challenge to automate, I believe lod3n posted a link to a 3rd party program that was able to hook to Firefox where you could call objects from there... but other than that, I'd know no way of doing it for them and always being successful.

Edit:

Found it:

http://www.autoitscript.com/forum/index.ph...st&p=232038

I haven't verified for myself that it works or is workable however.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The challenge response dialogs are standard windows (not HTML popups) so they can be manipulated with standard AutoIt Win* functions. It works well to have a function in AdLib that you can activate when you expect one of these can appear.

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

Link to comment
Share on other sites

Many thanks for all your input.

From what I see you guys saying, most of the solutions seem to be a manipulation of the authorization pop-up window. I dont know how hidden Dale's method is (I will look into it), but I was looking for something that interrupts the 401 challenge at a lower level, about as low as a firewall, instead of being dependent on another application to handle the request first. I figure if I work with the challenge at that level, I wont have to worry about which browser or program I use because my app will intercept it before that becomes an issue.

I guess what I am asking is if I can make a firewall or firewall-like app out of AutoIt.

-Cool-

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...