码迷,mamicode.com
首页 > 其他好文 > 详细

利用cookie访问需要登陆验证的某人主页

时间:2020-11-08 17:51:35      阅读:20      评论:0      收藏:0      [点我收藏+]

标签:--   htm   ott   awk   div   x64   网址   webkit   post   

#利用抓包工具,抓取需要cookie的网址一般cookie就在第一个post请求中,或与它挨着的地方里
#网址就用浏览器的网址
from urllib import request
from urllib import parse
url=‘https://www.cnblogs.com/Eric-Z-Hack/p/13942616.html‘
headers={‘User-Agent‘:‘ Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763‘,
         ‘Cache-Control‘:‘max-age=0‘,
         ‘Accept‘: ‘text/plain, */*; q=0.01‘,
         ‘Accept-Language‘: ‘zh-CN‘,
         ‘Host‘:‘ www.cnblogs.com‘,
         ‘Connection‘: ‘Keep-Alive‘,
         ‘Cookie‘:‘ .Cnblogs.AspNetCore.Cookies=CfDJ8AHUmC2ZwXVKl7whpe9_lascvWoVO_crmbNzkcl-zSZ8ihbKN_VoTt8w9sAegu81QlvBtG6o8GZ2dZJni3ku7d1yNsZJ74hIsioZ0VKA6Ih0iLnQEDfdmniDDkZeQ43BWZxKVgsw2nSsopBco2h5--iyc3J90dhWxPD52jj29sGuRDfHB0AWkqe_wOJQcxgVx3jgtAsqwcO03C-jUOBbE7K5udnTw3OqlUAuI9l5jEMwoKhMVOi8vkXt8IqrmzwYWvNrnMWAnU39AzlcVIJSULHFSz6RE-j4a4Ag6xnt_tzaQUtWs76RCObWQLa-NFlBcHoE9nEMS_zRjpZifxp478TElC8bNIu3rFva-TmLsW-lHSWGzFPDloD1vCqKYVnkrl8VkKm-0P2Q7q5EbUuh15gvddH6bDwuNTD1yuEz7Euj5lCQUVWdNjEQAhKpdg7XKu30aQ52MAwXW2CXzXMKqJ0pnF1QxcdJszMj3rozwVgAtYAr4mNH2UZ4xOrhd2cTHm_C_IntENaTlukPCPG6IbJqtGvq5KMZcWiRXrjdzOeTgzDBtzgA1Sjzf6xmopzxYQ; Hm_lvt_39b794a97f47c65b6b2e4e1741dcba38=1601101050,1601433996,1601436994,1601464118; __gads=ID=0c2e95af400abb19:T=1597366405:S=ALNI_MaopazTcpj3ATLsy-4l5Qj_AzkpeQ; _gid=GA1.2.960121964.1604735641; _ga=GA1.2.646321723.1597366046‘
         }
req=request.Request(url,headers=headers)
res=request.urlopen(req)
print(res.read().decode(‘utf-8‘))
 

利用cookie访问需要登陆验证的某人主页

标签:--   htm   ott   awk   div   x64   网址   webkit   post   

原文地址:https://www.cnblogs.com/Eric-Z-Hack/p/13943800.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!