You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
636 B
32 lines
636 B
#!/usr/bin/python |
|
# -*- coding: utf-8 -*- |
|
|
|
import mechanize |
|
|
|
# Note: mechanize takes care of cookies. |
|
|
|
br=mechanize.Browser() |
|
|
|
br.open('http://student.securitytube.net/login/index.php') |
|
|
|
for form in br.forms(): |
|
print form |
|
|
|
br.select_form(nr=0) |
|
|
|
br.form['username'] = 'demo-user' |
|
br.form['password'] = 'demouser1]M' # It won't work ;) |
|
|
|
br.submit() |
|
print br.response().read |
|
|
|
for link in br.links(): |
|
print link.url + ' + ' + link.text |
|
|
|
# It's different url now, just for example: |
|
#new_link = br.click_link(text='moodle[IMG]Change Password') |
|
#br.open(new_link) |
|
#print br.response().read() |
|
|
|
#for form in br.forms(): |
|
# print form
|
|
|