web安全的題,爲了找key隨手寫的程序,無處安放,姑且貼上來。php
1 # -*- coding: UTF-8 -*- 2 __author__ = 'weimw' 3 4 import requests 5 from BeautifulSoup import BeautifulSoup 6 7 def request_ctf5(): 8 f = open("out.txt", "w") 9 for i in range(1, 2000): 10 url = 'http://ctf5.simplexue.com/8/index.php?id=' + str(i) 11 res = requests.get(url) 12 res_table = BeautifulSoup(res.content).find('table') 13 tr_1 = res_table.findAll('tr')[0] 14 try: 15 tr_2 = res_table.findAll('tr')[1] 16 except: 17 print >> f, "no id and content" 18 continue 19 id_t = tr_2.findAll('td')[0].text 20 content_t = tr_2.findAll('td')[1].text 21 if id_t and content_t: 22 print >> f, "id = %s, content = %s" % (id_t, content_t) 23 return 24 25 if __name__ == '__main__': 26 request_ctf5()
不斷修改id訪問URL2000次,分析返回的頁面。web