第5讲

Post on 03-Sep-2014

1.914 views 0 download

Tags:

description

 

Transcript of 第5讲

2009-09-26

第5讲qingfeng@me.com

2009年9月25日金曜日

Python & Network

✤ 抓取一个网页

✤ 模拟浏览器行为,提交一些数据

✤ 刷校内之星

2009年9月25日金曜日

twill

✤ http://twill.idyll.org/

✤ python setup.py install

✤ twill-sh

2009年9月25日金曜日

twill

go http://www.renren.com/SysHome.doshowformsfv 1 email qingfeng@me.comfv 1 password xxxsubmitshow

登录校内

2009年9月25日金曜日

twill

go http://upload.renren.com/addphotoPlain.do?id=327316943showformsformfile 3 photo1 /Users/fengqing/Downloads/p1.jpgsubmit

上传照片

2009年9月25日金曜日

Python Network Library

✤ urllib

✤ httplib

✤ urllib2

✤ cookiejar

2009年9月25日金曜日

urllib.urlopen(“http://www.sina.com.cn”).read()

2009年9月25日金曜日

f = open(“c:/sina.html”,”w”)html = urllib.urlopen(“http://www.sina.com.cn”).read()f.write(html)f.close()

2009年9月25日金曜日

cookiejar = cookielib.CookieJar()opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))params = {'email':'qingfeng@me.com','password':'xxx','origURL':"http://www.renren.com/SysHome.do"}data = urllib.urlencode(params)fobj = opener.open('http://passport.renren.com/PLogin.do', data)

fobj = opener.open('http://renren.com/profile.do?id=260622588') print fobj.read()

2009年9月25日金曜日

HTTP协议

✤ GET

✤ POST

✤ HEAD

✤ PUT/DELETE

2009年9月25日金曜日

GET

✤ telnet www.renren.com 80

✤ GET / HTTP/1.0

2009年9月25日金曜日

Cookie

✤ 小甜饼

✤ Cookie只存在本地电脑

✤ Cookie & 隐私

2009年9月25日金曜日

Try

✤ 穷举密码,暴力破解

✤ 自动SQL注入程序

✤ WebGame外挂

2009年9月25日金曜日

Free Time

✤ 利用这节课学到的知识,模拟浏览器行为,完成校内一些应用的自动操作

✤ 自动加好友

✤ 刷人气之星

✤ 自动投票

✤ 总去他/她的页面看看

✤ 自动提醒

2009年9月25日金曜日