web安全的题,为了找key随手写的程序,无处安放,姑且贴上来。

 # -*- coding: UTF-8 -*-
__author__ = 'weimw' import requests
from BeautifulSoup import BeautifulSoup def request_ctf5():
f = open("out.txt", "w")
for i in range(1, 2000):
url = 'http://ctf5.simplexue.com/8/index.php?id=' + str(i)
res = requests.get(url)
res_table = BeautifulSoup(res.content).find('table')
tr_1 = res_table.findAll('tr')[0]
try:
tr_2 = res_table.findAll('tr')[1]
except:
print >> f, "no id and content"
continue
id_t = tr_2.findAll('td')[0].text
content_t = tr_2.findAll('td')[1].text
if id_t and content_t:
print >> f, "id = %s, content = %s" % (id_t, content_t)
return if __name__ == '__main__':
request_ctf5()

不断修改id访问URL2000次,分析返回的页面。

  

【安全】requests和BeautifulSoup小试牛刀的更多相关文章

  1. $python爬虫系列(2)—— requests和BeautifulSoup库的基本用法

    本文主要介绍python爬虫的两大利器:requests和BeautifulSoup库的基本用法. 1. 安装requests和BeautifulSoup库 可以通过3种方式安装: easy_inst ...

  2. python爬虫系列(2)—— requests和BeautifulSoup

    本文主要介绍python爬虫的两大利器:requests和BeautifulSoup库的基本用法. 1. 安装requests和BeautifulSoup库 可以通过3种方式安装: easy_inst ...

  3. 【网络爬虫入门01】应用Requests和BeautifulSoup联手打造的第一条网络爬虫

    [网络爬虫入门01]应用Requests和BeautifulSoup联手打造的第一条网络爬虫 广东职业技术学院 欧浩源 2017-10-14  1.引言 在数据量爆发式增长的大数据时代,网络与用户的沟 ...

  4. 基于Requests和BeautifulSoup实现“自动登录”

    基于Requests和BeautifulSoup实现“自动登录”实例 自动登录抽屉新热榜 #!/usr/bin/env python # -*- coding:utf-8 -*- import req ...

  5. Python使用urllib,urllib3,requests库+beautifulsoup爬取网页

    Python使用urllib/urllib3/requests库+beautifulsoup爬取网页 urllib urllib3 requests 笔者在爬取时遇到的问题 1.结果不全 2.'抓取失 ...

  6. python爬虫之requests+selenium+BeautifulSoup

    前言: 环境配置:windows64.python3.4 requests库基本操作: 1.安装:pip install requests 2.功能:使用 requests 发送网络请求,可以实现跟浏 ...

  7. requests和BeautifulSoup

    一:Requests库 Requests is an elegant and simple HTTP library for Python, built for human beings. 1.安装 ...

  8. Python 爬虫实战(一):使用 requests 和 BeautifulSoup

    Python 基础 我之前写的<Python 3 极简教程.pdf>,适合有点编程基础的快速入门,通过该系列文章学习,能够独立完成接口的编写,写写小东西没问题. requests requ ...

  9. #1 爬虫:豆瓣图书TOP250 「requests、BeautifulSoup」

    一.项目背景 随着时代的发展,国人对于阅读的需求也是日益增长,既然要阅读,就要读好书,什么是好书呢?本项目选择以豆瓣图书网站为对象,统计其排行榜的前250本书籍. 二.项目介绍 本项目使用Python ...

随机推荐

  1. PAT-乙级-1044. 火星数字(20)

    1044. 火星数字(20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 火星人是以13进制计数的: 地球人的 ...

  2. firefly 环境配置所需工具

    原地址:http://www.9miao.com/question-15-59032.html http://down.9miao.com/attachment/forum/201405/19/120 ...

  3. 用MT.exe将exe中的manifest文件提取出来和将manifest文件放入exe中

     前一种方法是将manifest文件放入exe中,但是要记得需要在工程中设置 这样的话exe中就不存在manifest了,在debug目录下就会看到相应的manifest文件.后者是将exe中的man ...

  4. 96. Unique Binary Search Trees

    题目: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For e ...

  5. cdev[典]

    linux-2.6.22/include/linux/cdev.hstruct cdev {   struct kobject kobj;          // 每个 cdev 都是一个 kobje ...

  6. A9逻辑编译问题

    root@phone-desktop:~# cd '/opt/BARE/01led' root@phone-desktop:/opt/BARE/01led# makearm-linux-gnueabi ...

  7. cf A. Inna and Pink Pony(思维题)

    题目:http://codeforces.com/contest/374/problem/A 题意:求到达边界的最小步数.. 刚开始以为是 bfs,不过数据10^6太大了,肯定不是... 一个思维题, ...

  8. MySQL优化器 limit影响的case

    测试的用例中,因为limit的大小不同,而产生了完全不同的执行计划: 1. 测试case: create table t1 ( f1 ) not null, f2 ) not null, f3 ) n ...

  9. 函数fsp_alloc_seg_inode

    从inode page中申请inode entry inode = fsp_alloc_seg_inode(space_header, mtr); /************************* ...

  10. 使用LINQ 對List分頁/區

    listview之類的服務器控件分頁自不用多說,拖拖控件改改屬性分分鐘的事.就不浪費大家時間了.   這裏只寫大概思路及關鍵代碼了.   LINQ裏有一個對集合進行分區的操作可用於分頁.   page ...