当前位置: 首页 > news >正文

深圳定制网站制作靠谱seo排名优化排行

深圳定制网站制作靠谱,seo排名优化排行,东营招标信息网官网,个人工商营业执照查询官网一、抓包第一次请求 url aHR0cDovL2N5eHcuY24vQ29sdW1uLmFzcHg/Y29saWQ9MTA抓包&#xff0c;需要清理浏览器cookie&#xff0c;或者无痕模式打开网址&#xff0c;否则返回的包不全&#xff0c;依照下图中的第一个包进行requests请求 第一次请求后返回 <!DOCTYPE html>…

一、抓包第一次请求

url = 'aHR0cDovL2N5eHcuY24vQ29sdW1uLmFzcHg/Y29saWQ9MTA='

抓包,需要清理浏览器cookie,或者无痕模式打开网址,否则返回的包不全,依照下图中的第一个包进行requests请求

在这里插入图片描述

第一次请求后返回

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, post-check=0, pre-check=0"/><meta http-equiv="Connection" content="Close"/><script type="text/javascript">function stringToHex(str){var val="";for(var i = 0; i < str.length; i++){if(val == "")val = str.charCodeAt(i).toString(16);else val += str.charCodeAt(i).toString(16);}return val;}function YunSuoAutoJump(){ var width =screen.width; var height=screen.height; var screendate = width + "," + height;var curlocation = window.location.href;if(-1 == curlocation.indexOf("security_verify_")){ document.cookie="srcurl=" + stringToHex(window.location.href) + ";path=/;";}self.location = "/Column.aspx?colid=10&security_verify_data=" + stringToHex(screendate);}</script><script>setTimeout("YunSuoAutoJump()", 50);</script></head><!--2023-10-11 11:55:23--></html>

其中stringToHex方法,用于将字符串转换为十六进制表示:

function stringToHex(str) {var val = "";for (var i = 0; i < str.length; i++) {if (val == "") val = str.charCodeAt(i).toString(16);else val += str.charCodeAt(i).toString(16);}return val;
}

用python实现

def stringToHex(data):valu = ''for i in range(0, len(data), 1):# 获取字符串中索引为 i 的字符的 Unicode 值,并转换为十六进制字符串表示unicode_value = ord(data[i])val = hex(unicode_value)[2:]  # [2:] 是为了去掉十六进制字符串前面的 '0x' 前缀valu = valu + val                     # 顺序不能反,否则转换的十六进制是倒着的return valu

YunSuoAutoJump()方法,设置了cookies中的一个srcurl值,还有第二次请求的url:

function YunSuoAutoJump() {var width = screen.width;var height = screen.height;var screendate = width + "," + height;var curlocation = window.location.href;if (-1 == curlocation.indexOf("security_verify_")) {document.cookie = "srcurl=" + stringToHex(window.location.href) + ";path=/;";}self.location = "/Column.aspx?colid=10&security_verify_data=" + stringToHex(screendate);
}

screendate是定值,因此

url2 = url + '&security_verify_data=313232302c363836'

二、第二次请求

观察浏览器抓到的第二个请求的cookies:

在这里插入图片描述

发现cookies中除srcurl还有security_verify_data,与第一次请求对比发现,在第一次请求时携带security_verify_data,如下图:

在这里插入图片描述

因此第二次请求的cookies为:

headers1 = resp1.headers.get('Set-Cookie')
result = headers1.split(';')[0]
cookies = {}
key, value = result.split('=')
cookies[key] = valuekey = 'srcurl'
value = stringToHex(url)
cookies[key] = value

进行第二次请求,返回

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, post-check=0, pre-check=0"/><meta http-equiv="Connection" content="Close"/>
<script>var cookie_custom = {hasItem: function(sKey) {return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);},removeItem: function(sKey, sPath) {if (!sKey || !this.hasItem(sKey)) {return false;}document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sPath ? "; path=" + sPath : "");return true;}
};function YunSuoAutoJump() {self.location = "aHR0cDovL2N5eHcuY24vQ29sdW1uLmFzcHg/Y29saWQ9MTA=";}
</script>
<script>setTimeout("cookie_custom.removeItem('srcurl');YunSuoAutoJump();", 50);</script></head></html>

由返回可知,第三次请求的url与第一次请求一致,cookies要除去第二次请求的srcurl这个键,再与浏览器中的第三次请求进行对比。

在这里插入图片描述

cookies中多了security_session_mid_verify这个键,同理可知,这个值在第二次请求的Set-Cookie处取得,cookies如下

headers2 = resp2.headers.get('Set-Cookie')
key, value = headers2.split(';')[0].split('=')
cookies[key] = value
cookies.pop('srcurl')    # 删去srcurl键值对

三、第三次请求

resp3 = requests.get(url, headers=headers, verify=False, cookies=cookies).content

此网站如果使用requests.get().text返回的内容不对,所以用content查看返回内容,发现是乱码,部分如下:

\xe5\x9b\xbe\xe7\x89\x87\xe6\x87\x92\xe5\x8a\xa0\xe8\xbd\xbd\r  

先解码,再删去返回中的\r,即返回正文内容

text = resp3.decode().replace('\r', '')
http://www.mmbaike.com/news/49432.html

相关文章:

  • 旅游类网站建设受众分析百度广告怎么做
  • 如何做盗版网站优化关键词排名提升
  • 什么是网站站点建设介绍公司网站推广方案
  • 上海品牌网站建设公司某一网站seo策划方案
  • 惠州市做网站的公司旺道seo
  • 郭仓镇做网站最近一周的国内新闻
  • 现在做网站到底需要多少钱数据平台
  • 网站搭建代码大全小红书搜索优化
  • 网站建设网络推广首选公司深圳百度seo怎么做
  • pascal建设网站seo实战技巧100例
  • 政府网站建设政治要求能够免费换友链的平台
  • 正邦做网站多少钱百度网络营销中心app
  • 基层建设 官方网站独立站seo实操
  • 优惠券怎么做自己的网站成都网站建设技术外包
  • 装修平台app有哪些seo人员工作内容
  • 哪个网站 的域名最便宜汽车网站建设方案
  • 海口建设网站的公司神马推广
  • 网站导航作用短视频推广app
  • 秦皇岛网络淄博seo培训
  • 推广引流系统站长工具seo查询软件
  • 深圳营销型网站seo网站推广的公司
  • 政府网站集约化建设管理webview播放视频
  • 实惠的网站建设网址导航推广
  • 网站功能谷歌外链工具
  • 苏州做网站价格百度不收录网站
  • 建筑网站设计大全百度指数批量
  • 网站建设音乐代码百度公司招聘官网
  • 网站优化方案范文市场推广计划怎么写
  • 可以做网站首页的图片淘宝流量
  • 网站开发经理招聘东莞seo建站