python - How to identify login form variables -


i'm trying login website requests module. login form in javascript think. need identify form names contain username , password. tried sort our firebug, hover on username field on website , here code:

<div id="ctl00_main_login_dvusertxt" class="dvusr visible"> <input id="ctl00_main_login_usernametext" class="f10 b txmain tx" type="text"  ondrop="javascript: return false;" ondrag="javascript: return false;" oncut="javascript:   return false;" oncontextmenu="javascript: return false;" onblur="javascript: return  false;" onpaste="javascript: return false;" oncopy="javascript: return false;"  autocomplete="off" tabindex="1" readonly="readonly" maxlength="20" value="uzytkownik"  name="ctl00$main$login$usernametext">  

i did same password , tried combination of , none correct.

i page source , here believe appropriate function:

<div> <input type="hidden" name="__lastfocus" id="__lastfocus" value="" /> <input type="hidden" name="__eventtarget" id="__eventtarget" value="" /> <input type="hidden" name="__eventargument" id="__eventargument" value="" /> <input type="hidden" name="__viewstate" id="__viewstate"   value="/wepdwullte2njy0nzyzmdhkzbd9ab2vcpcoefqj+zqlpm7gs1ia" /> </div>  <script type="text/javascript"> //<![cdata[ var theform = document.forms['aspnetform']; if (!theform) {     theform = document.aspnetform;  } function __dopostback(eventtarget, eventargument) {     if (!theform.onsubmit || (theform.onsubmit() != false)) {         theform.__eventtarget.value = eventtarget;         theform.__eventargument.value = eventargument;         theform.submit();     } } //]]> </script> 

i thought eventtarget may username form, not though.

am on right path of finding form names or how can identify these form names?

i'd go http://www.crummy.com/software/beautifulsoup/ or similar analyze data , finding elements need, it's way easier trying build parser on own if works too.

or little more light-weight library: http://scrapy.org/

and form name aspnetform , username , password field not described in post, it's earlier in data. try searching <form , locate every <input in between </form

basicly you're looking in between:

<form ...>  *all <input> objects*  </form> 

also, you're doing.. way easier check in say: firefox + https://addons.mozilla.org/en-us/firefox/addon/tamper-data/

that way can see actual post data sent server , can ignore every web-parsing , go straight post part of process. (might id's hidden input fields meeh.. figure out)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -