Re: HTTPS access
- From: Uwe Klein <uwe_klein_habertwedt@xxxxxxxxxxx>
- Date: Sun, 22 Feb 2009 11:55:12 +0100
Why Tea wrote:
We need to perform hourly login on an https site
in order to gain access to a secured part of the
network. Can this be scripted with TCL?
Here is the sequence:
1) start with an http URL
2) click on a button to get to the https site
3) a pop-up form for user authentication
where user id and password are to be
filled
4) after the correct authentication access
to a special part of the network will
be granted
/Why Tea
I had written something for changing DNS entries
at my providers WebOnly interface.
the stuff i wrote is a bit overspecific, but :
#!/usr/bin/tclsh
package require http
package require tls
http::register https 443 ::tls::socket
# my next step was getting the login page
# the token actually is an array at global scope
set token [ http::geturl $url ]
set content [::http::data $token ]
# i scraped the form data from the page and posted
# the form url
set url <form_url>
append url <form_path>
set query [ ::http::formatQuery \
name1 value1 \
name2 value2 \
user $user \
passwd $passwd \
]
set ltoken [ http::geturl $url -query $query ]
# you will have to handle some cookies after successfull login.
upvar #0 $ltoken state
set cookies [list]
foreach {name value} $state(meta) {
if { $name eq "Set-Cookie" } {
lappend cookies [lindex [split $value {;}] 0]
}
}
# continue from there.
uwe
.
- Follow-Ups:
- Re: HTTPS access
- From: Alex
- Re: HTTPS access
- References:
- HTTPS access
- From: Why Tea
- HTTPS access
- Prev by Date: Re: SIMPLE web-app framework a la PHP? (Not rivet, methinks)
- Next by Date: help required
- Previous by thread: HTTPS access
- Next by thread: Re: HTTPS access
- Index(es):