前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Python】记录抓包分析自动领取芝麻HTTP每日免费IP(成品+教程)

【Python】记录抓包分析自动领取芝麻HTTP每日免费IP(成品+教程)

作者头像
德宏大魔王
发布2023-08-08 13:21:59
2620
发布2023-08-08 13:21:59
举报
文章被收录于专栏:cloud stdio

背景:

这里说一下,上次我发表了,如何用芝麻ip搭建代理池,可以看这里,后面免费的套餐用完了(并不是我用量大 :有时常限制),这个教程可以对 ip需求不高的人做一个参考,因为芝麻代理每天的ip够我做项目用的了,没必要付钱,坏处就是这个免费的ip每天都需要进来领取且当天失效,但是好处就是 领取后 原服务正常使用

在这里插入图片描述
在这里插入图片描述

抓包:

F12,通过观察发现都是通过cookie来进行验证的,

在这里插入图片描述
在这里插入图片描述

对比观察下登录接口的响应体

在这里插入图片描述
在这里插入图片描述

显然是一致的,说明登录接口获取得到的 ret_data就是PHPSESSID的值

在这里插入图片描述
在这里插入图片描述

于是找到登录接口,post请求、url

在这里插入图片描述
在这里插入图片描述

继续! 伪造请求头

在这里插入图片描述
在这里插入图片描述

表单:

在这里插入图片描述
在这里插入图片描述

python代码:

登录接口:

代码语言:javascript
复制
# 登录
url = "https://wapi.http.linkudp.com/index/users/login_do"
body = {
'phone': '手机号',
'password': '密码',
'remember': '0'
}
headers = {
"Accept": "text/html, */*; q=0.01",
"Accept-Encoding": 'gzip, deflate, br',
"Accept-Language": 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '48',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Host': 'wapi.http.linkudp.com',
"Origin": 'https://www.zmhttp.com',
"Referer": 'https://www.zmhttp.com/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.post(url, json=body, headers=headers)
print(response.text)
result=response.json()
print(result['ret_data'])

获取用户信息:

代码语言:javascript
复制
# 获取用户信息
url="https://wapi.http.linkudp.com/index/users/user_info"
body = {

}
headers = {
"Accept": "text/html, */*; q=0.01",
"Accept-Encoding": 'gzip, deflate, br',
"Accept-Language": 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '0',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Host': 'wapi.http.linkudp.com',
"Origin": 'https://www.zmhttp.com',
"Referer": 'https://www.zmhttp.com/ucenter/?first_time=0',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'session-id': result['ret_data'],
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.post(url, json=body, headers=headers)
print(response.text)

成功图: 登录后返回值

在这里插入图片描述
在这里插入图片描述

返回用户信息值

在这里插入图片描述
在这里插入图片描述

原图:

在这里插入图片描述
在这里插入图片描述

最后:

今天就先到这里,后面更新,因为今天已经领取过了,不想熬夜,收藏+关注哦!

在这里插入图片描述
在这里插入图片描述

好啦!完整代码在这里:

代码语言:javascript
复制
import requests

# 登录
url = "https://wapi.http.linkudp.com/index/users/login_do"
body = {
'phone': '手机号',
'password': '密码',
'remember': '0'
}
headers = {
"Accept": "text/html, */*; q=0.01",
"Accept-Encoding": 'gzip, deflate, br',
"Accept-Language": 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '48',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Host': 'wapi.http.linkudp.com',
"Origin": 'https://www.zmhttp.com',
"Referer": 'https://www.zmhttp.com/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.post(url, json=body, headers=headers)
print(response.text)
result=response.json()
print(result['ret_data'])

# 获取用户信息
url="https://wapi.http.linkudp.com/index/users/user_info"
body = {

}
headers = {
"Accept": "text/html, */*; q=0.01",
"Accept-Encoding": 'gzip, deflate, br',
"Accept-Language": 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '0',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Host': 'wapi.http.linkudp.com',
"Origin": 'https://www.zmhttp.com',
"Referer": 'https://www.zmhttp.com/ucenter/?first_time=0',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'session-id': result['ret_data'],
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.post(url, json=body, headers=headers)
print(response.text)

#自动领取每日免费ip
url = "https://wapi.http.linkudp.com/index/users/get_day_free_pack"
body = {
'geetest_challenge': '',
'geetest_validate': '',
'geetest_seccode': ''
}
headers = {
"Accept": "text/html, */*; q=0.01",
"Accept-Encoding": 'gzip, deflate, br',
"Accept-Language": 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Content-Length': '53',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Host': 'wapi.http.linkudp.com',
"Origin": 'https://www.zmhttp.com',
"Referer": 'https://www.zmhttp.com/ucenter/?first_time=0',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'session-id': result['ret_data'],
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.post(url, json=body, headers=headers)
print(response.text)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-02-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 背景:
  • 抓包:
  • python代码:
  • 最后:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档