Fill Javascript form

M

Matteo

Hi everybody,
I have to fill a web form to authenticate and connect to the internet.
I thought it would have been easy to make a script to do that
automatically
on startup.

Unfortunately, it turned out that the form is written in JavaScript,
and
urllib2 therefore fails to even fetch the form.

The form itself is very simple, just name and password fields and a
"submit"
button.

Do you know of any workaround?
 
S

Shawn Milochik

How is the form "written in JavaScript"? Is it dynamically generated?

In any case, can you just send a POST request if you know the values required?
 
M

Matteo

How is the form "written in JavaScript"? Is it dynamically generated?

In any case, can you just send a POST request if you know the values required?

The problem is indeed that the form is dynamically generated.
That's the .js file:

if (navigator.appVersion.indexOf("MSIE")!=-1)
document.write("<script type='text/javascript' id='chillicontroller'></
script>");

if (!window.queryObj) {
window.queryObj = new Object();
window.location.search.replace(new RegExp("([^?=&]+)(=([^&]
*))?","g"), function($0,$1,$2,$3) { queryObj[$1] = $3; });
if (queryObj['uamip'] == null && queryObj['uamport'] == null)
{queryObj['uamip']='10.192.0.1';queryObj['uamport']='3990';}
}

if (queryObj['uamip'] != null && queryObj['uamport'] != null) {
var script = document.getElementById('chillicontroller');
if (script == null) {
// document.write('manutenzione');
script = document.createElement('script');
script.id = 'chillicontroller';
script.type = 'text/javascript';
script.src = 'http://'+queryObj['uamip']+':3990/www/
chillijs.chi';

var head = document.getElementsByTagName("head")[0];
if (head == null) head = document.body;
head.appendChild(script);
}
script=document.getElementById('chillicontroller');
if(script==null)document.write('manutenzione');
script.src = 'http://'+queryObj['uamip']+':3990/www/chillijs.chi';

} else {
//document.write('manutenzione');
var noLocation = document.getElementById("noLocation");
if (noLocation != null && noLocation.style) {
noLocation.style.display = 'inline';
}
}
 
A

Aahz

I have to fill a web form to authenticate and connect to the internet.
I thought it would have been easy to make a script to do that
automatically on startup.

Unfortunately, it turned out that the form is written in JavaScript,
and urllib2 therefore fails to even fetch the form.

Depending on whether you can reverse-engineer the form, you can either
just POST data to the webserver or you need to access a JavaScript
library. Selenium might be an answer to the latter problem; you could
also look into using WebKit.
 
Ð

Дамјан ГеоргиевÑки

The problem is indeed that the form is dynamically generated.
That's the .js file:


This seems to be generated by ChiliSpot (the most recent code is from
http://coova.org/wiki/index.php/CoovaChilli), which also has a
non-interactive or non-browser-based API/Interface.

They even have custom application for mobile phones, and a
Firefox extension for using that API.

if (navigator.appVersion.indexOf("MSIE")!=-1)
document.write("<script type='text/javascript'
id='chillicontroller'></ script>");

if (!window.queryObj) {
window.queryObj = new Object();
window.location.search.replace(new RegExp("([^?=&]+)(=([^&]
*))?","g"), function($0,$1,$2,$3) { queryObj[$1] = $3; });
if (queryObj['uamip'] == null && queryObj['uamport'] == null)
{queryObj['uamip']='10.192.0.1';queryObj['uamport']='3990';}
}

if (queryObj['uamip'] != null && queryObj['uamport'] != null) {
var script = document.getElementById('chillicontroller');
if (script == null) {
// document.write('manutenzione');
script = document.createElement('script');
script.id = 'chillicontroller';
script.type = 'text/javascript';
script.src = 'http://'+queryObj['uamip']+':3990/www/
chillijs.chi';

var head = document.getElementsByTagName("head")[0];
if (head == null) head = document.body;
head.appendChild(script);
}
script=document.getElementById('chillicontroller');
if(script==null)document.write('manutenzione');
script.src = 'http://'+queryObj['uamip']+':3990/www/chillijs.chi';

} else {
//document.write('manutenzione');
var noLocation = document.getElementById("noLocation");
if (noLocation != null && noLocation.style) {
noLocation.style.display = 'inline';
}
}

--
дамјан ( http://softver.org.mk/damjan/ )

Well when _I_ was in school, I had to run Netscape on HP/UX, displayed on my
local X Server running on a Windows 3.1 box. Displayed over a 2400 baud
modem. Uphill. Both ways. In the rain. With NOBODY to hold my hands. Because
the life of the geek is a lonely life.
- aclarke on /.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top