View Single Post
Old 01-06-2012, 02:55 PM   #4
kiavash
Old Linux User
kiavash began at the beginning.
 
Posts: 36
Karma: 12
Join Date: Jan 2012
Device: NST
Another (unsuccessful) try:

This time, I checked if there is a JavaScript messing with login process, so fired up Firebug and inspected the login page. I saw this JavaScript.

Spoiler:

PHP Code:
function setActiveStyleSheet(title) {
  var 
iamain;
  for(
i=0; (document.getElementsByTagName("link")[i]); i++) {
    if(
a.getAttribute("rel").indexOf("style") != -&& a.getAttribute("title")) {
      
a.disabled true;
      if(
a.getAttribute("title") == titlea.disabled false;
    }
  }
}

function 
getActiveStyleSheet() {
  var 
ia;
  for(
i=0; (document.getElementsByTagName("link")[i]); i++) {
    if(
a.getAttribute("rel").indexOf("style") != -&& a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return 
null;
}

function 
getPreferredStyleSheet() {
  var 
ia;
  for(
i=0; (document.getElementsByTagName("link")[i]); i++) {
    if(
a.getAttribute("rel").indexOf("style") != -1
       
&& a.getAttribute("rel").indexOf("alt") == -1
       
&& a.getAttribute("title")
       ) return 
a.getAttribute("title");
  }
  return 
null;
}

function 
createCookie(name,value,days) {
  if (
days) {
    var 
date = new Date();
    
date.setTime(date.getTime()+(days*24*60*60*1000));
    var 
expires "; expires="+date.toGMTString();
  }
  else 
expires "";
  
document.cookie name+"="+value+expires+"; path=/";
}

function 
readCookie(name) {
  var 
nameEQ name "=";
  var 
ca document.cookie.split(';');
  for(var 
i=0;ca.length;i++) {
    var 
ca[i];
    while (
c.charAt(0)==' 'c.substring(1,c.length);
    if (
c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return 
null;
}

window.onload = function(e) {
  var 
cookie readCookie("style");
  var 
title cookie cookie getPreferredStyleSheet();
  
setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var 
title getActiveStyleSheet();
  
createCookie("style"title365);
}

var 
cookie readCookie("style");
var 
title cookie cookie getPreferredStyleSheet();
setActiveStyleSheet(title); 


Now I am out of my comfort zone as I don't know this language, but I can see couple of functions with cookie in their names: readCookie(name) and createCookie(name,value,days)

Does get_browser() remove the JavaScript?

I tried removing remove_javascript = True from recipe and changing it to False, but didn't login.

I tried to follow this post,
Spoiler:
Some web developers like to submit their log in form by using a JavaScript function that, before submitting the form, manipulates some input values (perhaps to prevent the very thing we are discussing here). If you run into that, examine the function and mimic it's behavior. If the script is hard to find, use Firebug's find feature to search for it. Here is an example of setting the value of a hidden input:

PHP Code:
        br.select_form(nr 0)
        
# find by index
        
ctl_1 br.find_control(type 'hidden'nr 3)
        
# or by name
        
ctl_2 br.find_control(type 'hidden'name 'meal')
        
ctl_1.readonly False
        ctl_2
.readonly False

        ctl_1
.value 'spam'
        
ctl_2.value 'eggs' 
but completely lost.

Anybody? Please!
kiavash is offline   Reply With Quote