zoukankan      html  css  js  c++  java
  • 【安全】requests和BeautifulSoup小试牛刀

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

     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次,分析返回的页面。

      

  • 相关阅读:
    C++中的结构体
    C++转换
    C++常见问题解答
    hdu 1491
    hdu 1253
    [恢]hdu 2529
    [恢]hdu 2539
    hdu 1708
    [恢]hdu 2512
    [恢]hdu 2401
  • 原文地址:https://www.cnblogs.com/raul-ac/p/4572766.html
Copyright © 2011-2022 走看看