zoukankan      html  css  js  c++  java
  • 评分

    #! /usr/bin/python
    #-*- couding=utf-8 -*-
    import requests
    import urllib,urllib.request,urllib.parse
    from bs4 import BeautifulSoup

    #定义常量
    UA = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.13 Safari/537.36"

    #生成URL
    u = input(' 请输入短链接 如:R6mfOj1:')
    u = ('http://t.cn/'+u)
    print(' 输入的链接为'+u)


    #获取短链接跳转地址
    u = urllib.request.urlopen(u).geturl()
    print(' '+u)

    #测试数量
    x = int(input(' 测试数量:'))


    #转换十进制
    nux = (u[-8:])
    numb= int(nux,16)
    print("十进制"+nux)

    #加入自身到列表
    li = [numb]
    print(li)
    #生成数量
    for i in range(0,x):


    #列表
    li.append(int(numb)-int(i*100))

    li.append(int(numb)+int(i*100))


    #hex1
    pid = ("%x" % li[(i)])
    print("PID"+pid)

    #完整URL
    url = (u[:-8]+pid)

    print(url)



    #header
    header={
    'Host':'xxxx.xxx.com',
    'Referee': url,
    'User-Agent':UA,
    }


    # 获取参数
    v2ex_session = requests.Session()
    f = v2ex_session.get(url, headers=header)
    soup = BeautifulSoup(f.content, "html.parser")
    once = soup.find('input', {'id': 'p'})['value']
    print(once)


    # Data
    postData = {'score': '5',
    'p': pid
    }


    # POST 目标URL
    v2ex_session.post(url='http://xxxx/xxx/x.do',
    data=postData,
    headers=header)

    # 查看源码
    print(f.content.decode())

      wireshark 发送POST 以及 返回 200OK抓包数据

      

  • 相关阅读:
    leetcode-409
    leetcode-836
    leetcode-1160
    leetcode-面试题13
    leetcode-695
    go的一些小lib
    leetcode-300
    cookie
    php上传文件
    PHP 文件创建/写入
  • 原文地址:https://www.cnblogs.com/bcode/p/6665115.html
Copyright © 2011-2022 走看看