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

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

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

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

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

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

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

继续! 伪造请求头

表单:

python代码:登录接口:

代码语言:javascript代码运行次数:0运行复制# 登录

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代码运行次数:0运行复制# 获取用户信息

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代码运行次数:0运行复制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)

相关推荐

软件游戏哪些好玩 下载量高的软件游戏推荐
365bet足球网站

软件游戏哪些好玩 下载量高的软件游戏推荐

📅 07-01 👁️ 3598
一文说清alpha和beta,这是买基金必须搞懂的内容
365bet足球网站

一文说清alpha和beta,这是买基金必须搞懂的内容

📅 06-29 👁️ 5149
刬的意思,刬的解释,刬的拼音,刬的部首
365bet手机投注网

刬的意思,刬的解释,刬的拼音,刬的部首

📅 06-30 👁️ 5026