【安全】requests和BeautifulSoup小试牛刀
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小试牛刀的更多相关文章
- $python爬虫系列(2)—— requests和BeautifulSoup库的基本用法
本文主要介绍python爬虫的两大利器:requests和BeautifulSoup库的基本用法. 1. 安装requests和BeautifulSoup库 可以通过3种方式安装: easy_inst ...
- python爬虫系列(2)—— requests和BeautifulSoup
本文主要介绍python爬虫的两大利器:requests和BeautifulSoup库的基本用法. 1. 安装requests和BeautifulSoup库 可以通过3种方式安装: easy_inst ...
- 【网络爬虫入门01】应用Requests和BeautifulSoup联手打造的第一条网络爬虫
[网络爬虫入门01]应用Requests和BeautifulSoup联手打造的第一条网络爬虫 广东职业技术学院 欧浩源 2017-10-14 1.引言 在数据量爆发式增长的大数据时代,网络与用户的沟 ...
- 基于Requests和BeautifulSoup实现“自动登录”
基于Requests和BeautifulSoup实现“自动登录”实例 自动登录抽屉新热榜 #!/usr/bin/env python # -*- coding:utf-8 -*- import req ...
- Python使用urllib,urllib3,requests库+beautifulsoup爬取网页
Python使用urllib/urllib3/requests库+beautifulsoup爬取网页 urllib urllib3 requests 笔者在爬取时遇到的问题 1.结果不全 2.'抓取失 ...
- python爬虫之requests+selenium+BeautifulSoup
前言: 环境配置:windows64.python3.4 requests库基本操作: 1.安装:pip install requests 2.功能:使用 requests 发送网络请求,可以实现跟浏 ...
- requests和BeautifulSoup
一:Requests库 Requests is an elegant and simple HTTP library for Python, built for human beings. 1.安装 ...
- Python 爬虫实战(一):使用 requests 和 BeautifulSoup
Python 基础 我之前写的<Python 3 极简教程.pdf>,适合有点编程基础的快速入门,通过该系列文章学习,能够独立完成接口的编写,写写小东西没问题. requests requ ...
- #1 爬虫:豆瓣图书TOP250 「requests、BeautifulSoup」
一.项目背景 随着时代的发展,国人对于阅读的需求也是日益增长,既然要阅读,就要读好书,什么是好书呢?本项目选择以豆瓣图书网站为对象,统计其排行榜的前250本书籍. 二.项目介绍 本项目使用Python ...
随机推荐
- leetcode4 Valid Palindrome回文数
Valid Palindrome回文数 whowhoha@outlook.com Question: Given a string, determine if it is a palindrome, ...
- WPF MultiDataTrigger
huhu <Style x:Key="Cell" TargetType="{x:Type Button}"> <Setter Property ...
- 分析函数调用关系图(call graph)的几种方法
绘制函数调用关系图对理解大型程序大有帮助.我想大家都有过一边读源码(并在头脑中维护一个调用栈),一边在纸上画函数调用关系,然后整理成图的经历.如果运气好一点,借助调试器的单步跟踪功能和call sta ...
- Tarjan+模板
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #in ...
- html代码究竟什么用途
1.html代码,只能浏览器识别并读出.渲染出网页图形 2.html代码可以本地写,用浏览器渲染出.也可以服务器端通过http协议传送过来,在网页显示. 咱们上网看的网页都是服务器端通过http协议传 ...
- 使用LinkedList实现Stack与Queue
LinkedList数据结构是一种双向的链式结构,每一个对象除了数据本身外,还有两个引用,分别指向前一个元素和后一个元素. 栈的定义栈(Stack)是限制仅在线性表的一端进行插入和删除运算.(1)通常 ...
- ogg实现oracle到sql server 2005的同步
一.源端(oracle)配置1.创建同步测试表create table gg_user.t01(name varchar(20) primary key);create table gg_user.t ...
- hibernate实体的几种状态:
hibernate实体的几种状态: 实体的生命周期中,实体主要经过瞬时(Transient),托管(Attatched或Managed),游离(Detached)和销毁(Removed)四个状态. 瞬 ...
- mappingResources,annotatedClasses(映射)
这两个是有本质区别的,光看名字也能看出来,哈哈,好了,入正题: mappingResources用于指定少量的hibernate配置文件像这样 Xml代码 1 2 3 4 5 6 7 <prop ...
- CodeForces Round #285 Div.2
C.Misha and Forest (图论 BFS) 比赛进行了一半才想起来有场CF没打,=_=|| 前两道题快速切掉,C题一直卡没什么好的思路 憋了几天,忍不住偷偷瞄了一下别人AC的代码,发现我题 ...