Monks:
I'm working on a project for work where I need to screen scrape an internal website. All of the internal sites use Single Signon (SSO).
This is the current code I've been working with:
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
my ($ua, $req, $res, $output);
$ua = new LWP::UserAgent(keep_alive=>1);
$ua->agent('Internet Explorer/6.0');
$ua->credentials('domain.com:80', '', "domain\\user", 'pass');
$req = HTTP::Request->new(POST => 'http://domain.com/cgi-bin/test.cgi'
+, HTTP::Headers->new('WWW-Authenticate' => 'NTLM'));
$req->content_type('application/x-www-form-urlencoded');
$req->content('testvar=testvalue');
$res = $ua->request($req);
$output = $res->content;
print "output:\n".$output;
This is the output I get when running this script:
output:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY onLoad="document.AUTOSUBMIT.submit();">
This page is used to hold your data while you are being authorized for
+ your request.<BR><BR>You will be forwarded to continue the authoriza
+tion process. If this does not happen automatically, please click the
+ Continue button below.
<FORM NAME="AUTOSUBMIT" METHOD="POST" ACTION="http://logon.domain.com/
+ntlm/creds.ntc?CHALLENGE=&SMAGENTNAME=$SM$7itOP8YnQhR1qQcOO6pp75JDJJF
+C96mLihRDilLmOSr8oAm7zddwfw%3d%3d&TARGET=$SM$http%3a%2f%2domain%2ecom
+%2fcgi-bin%2ftest%2ecgi">
<INPUT TYPE="HIDDEN" NAME="SMPostPreserve" VALUE="L2JDNDdmSXpOWVVOT2wy
+YUt4VjZpb1JkbkkxRVlZbUd4ZVdadkFoaGpQZWJVZHE4eW9IcGNJNEx3dUdmYi81Qw">
<INPUT TYPE="SUBMIT" VALUE="Continue">
</FORM>
</BODY>
</HTML>
I've tried a number of methods to handle the challenge/response, but to no avail. I've even tried using a stand-alone curl command, which has a --ntlm option.
Any input from the ranks is appreciated.
Thanks!
- Justin