mitmproxy抓包 | Python篡改请求参数实战(五)

抓包工具mitmproxy环境配置使用(一)

抓包工具mitmproxy | mitmweb基本用法(二)

mitmproxy抓包 | Python实时生成接口自动化用例(三)

mitmproxy抓包 | Python实时生成接口自动化用例

mitmproxy抓包 | Python疑难测试场景mock实战(四)

篡改GET请求参数,实例一:

拉钩app,我的页面,显示推荐banner为8点一课

b663f618996eaad492a8e893ecc50a13.png

抓包信息如下,参数type=1

GET https://gate.lagou.com/v1/neirong/edu/ads/ad?type=1 HTTP/2.0{"content": {"adAppHref": "https://kaiwu.lagou.com/course/courseInfo.htm?courseId=1405&decorateId=13c247ae6d4845708fb582f6ad3ab8d6&utm_source=lagouedu&utm_medium=wode&utm_campaign=8%E7%82%B9%E4%B8%80%E8%AF%BE&_channel_track_key=fdgm67Bq&lgec_type=website&lgec_sign=9A0FAD8D532161C641529DEDC5C30AFC","adAppImage": "https://s0.lgstatic.com/i/image6/M00/66/58/CioPOWGwda-AVSDaAAB4wgdnzvg703.png","adId": 170,"adName": "8点一课","adPcHref": "","adPcImage": "","adType": null},"message": "操作成功","state": 1,"uiMessage": null
}

我们想篡改GET请求参数type=2,代码如下,看看什么效果?

class Demo:def request(self, flow):# 匹配指定的urlif 'https://gate.lagou.com/v1/neirong/edu/ads/ad' in flow.request.url:keyword = flow.request.query.get ( "type" )print(keyword)if keyword == "1":flow.request.query.set_all ( "type", ["2"] )addons = [Demo()
]

启动mitmproxy服务,再次在app刷新请求此页面,页面显示推荐banner为大数据训练营,抓包请求参数也是篡改后的数据,说明篡改生效了

GET https://gate.lagou.com/v1/neirong/edu/ads/ad?type=2 HTTP/2.0{"content": {"adAppHref": "https://edu.lagou.com/growth/sem/data_enhancement.html?utm_campaign=%E5%A4%A7%E6%95%B0%E6%8D%AE%E9%AB%98%E8%96%AA&utm_medium=xuexibanner&_channel_track_key=zaqT1dVC&utm_source=lagouedu&lgec_type=website&lgec_sign=A321FD5BDD413A5BC4B9AA31E61DCED2","adAppImage": "https://s0.lgstatic.com/i/image/M00/8F/E6/Ciqc1GAJYdOAFnqRAABV2-XV0hA152.png","adId": 11,"adName": "大数据训练营","adPcHref": "","adPcImage": "","adType": null},"message": "操作成功","state": 1,"uiMessage": null
}

ede7c8cfeca8ec1305a95553c37ee892.png

5eb218c70935139c987f21f340487f5d.png

篡改POST请求参数,实例二:

花生app,本地生活页面,搜索面,页面显示面相关的商品

c95f82a29bcc278fddaee2d4489ecd40.png

抓包信息如下:

POST 
https:/ /hsrj-api.huashengjia100.com/general-rest/life/searchcontent-type:  application/x-www-form-urlencoded
accept-language:  zh-Hans-CN;q=1
appinfo:  PeanutHot_50109
accept:  */ *
content-length:  143
appversion:  50109
deviceidfa:  DA568519-790F-4FE3-A744-36F3B7CF4877
accept-encoding:  gzip
regid:  18171adc03a77f73a9d
osinfo:  iOS_15.1
token:  c2ab281bc23e458fa585eb108e5fad06_15320861_2
actime:  1639016889000
deviceinfo:  DeviceName_iPhone13,3
user-agent:  Mozilla%2F5.0%20%28iPhone%3B%20CPU%20iPhone%20OS%2014_4%20like%20Mac%20OS%20X%29%20AppleWebKit%2F605.1.15%20%28KHTML%2C%20like%20Gecko%29%20Mobile%2F15E148
platforms:  iOS
nettype:  1
deviceuuid:  84964BB5-8897-4717-9AA8-487059D2D8F1channelId: 28
cityId:    306
keyWords:  面
lat:       31.228150
lng:       121.512936
pageNum:   1
pageSize:  20
token:     c2ab281bc23e458fa585eb108e5fad06_15320861_2{"code": null,"data": [{"address": "浦东新区中国(上海)自由贸易试验区浦东南路1271-1289号(单)1层107、108室","cateName": "小吃快餐","cityName": "上海","dealsList": [{"dealGroupId": null,"description": "","discountRatio": 6.3,"discountRatioText": "6.3折","earnSum": 0.28,"earnSumText": "返¥0.28元","halfYearSale": -1,"orgPrice": 24.0,"pic": "https://p0.meituan.net/320.0/merchant/9cd2c719178ae2191b93bcd09f231d312409890.png%40320w_240h_1e_1c_1l%7Cwatermark%3D0","price": 15.0,"receiveUrl": null,"savePrice": 9.0,"title": "牛肉凉皮1份,可免费使用包间","type": 1}],"detailUrl": "https://hsrjh5.huashengjia100.com/page/localStore/#/index?shopId=161953838&channelId=28","distance": 39,"distanceToShow": "39m","maxSavePrice": 9.0,"regionName": "八佰伴","shopId": "161953838","shopName": "蔡记热干面(美克店)","shopPic": "https://p0.meituan.net/320.0/merchant/9cd2c719178ae2191b93bcd09f231d312409890.png%40320w_240h_1e_1c_1l%7Cwatermark%3D0","shopPower": 44,"sort": 0},{"address": "浦东新区张杨路500号华润时代广场6楼608A","cateName": "小吃快餐","cityName": "上海","dealsList": [{"dealGroupId": null,"description": "","discountRatio": 4.7,"discountRatioText": "4.7折","earnSum": 0.47,"earnSumText": "返¥0.47元","halfYearSale": -1,"orgPrice": 53.0,"pic": "https://p0.meituan.net/320.0/deal/8014afffd3f8ece057b7dafcf0a133101791008.png%40320w_240h_1e_1c_1l%7Cwatermark%3D0","price": 25.0,"receiveUrl": null,"savePrice": 28.0,"title": "葱油蛤蜊拌面单人套餐","type": 1}],"detailUrl": "https://hsrjh5.huashengjia100.com/page/localStore/#/index?shopId=1592150348&channelId=28","distance": 108,"distanceToShow": "108m","maxSavePrice": 28.0,"regionName": "八佰伴","shopId": "1592150348","shopName": "心樂麵館XINLE NOODLES(华润店)","shopPic": "https://p0.meituan.net/320.0/deal/8014afffd3f8ece057b7dafcf0a133101791008.png%40320w_240h_1e_1c_1l%7Cwatermark%3D0","shopPower": 38,"sort": 4}

篡改POST请求参数为搜索米,代码如下,看看什么效果?

class Demo:def request(self, flow):# 匹配指定的urlif 'https://hsrj-api.huashengjia100.com' in flow.request.url:flow.request.urlencoded_form = [("keyWords", "米"),("channelId","28"),("cityId","306")]addons = [Demo()
]

启动mitmproxy服务,再次在app刷新请求此页面,页面显示为米相关的商品,抓包请求参数也是篡改后的数据,说明篡改生效了

POST https://hsrj-api.huashengjia100.com/general-rest/life/search HTTP/2.0content-type:  application/x-www-form-urlencoded
accept-language:  zh-Hans-CN;q=1
appinfo:  PeanutHot_50109
accept:  */*
content-length:  42
appversion:  50109
deviceidfa:  DA568519-790F-4FE3-A744-36F3B7CF4877
accept-encoding:  gzip
regid:  18171adc03a77f73a9d
osinfo:  iOS_15.1
token:  c2ab281bc23e458fa585eb108e5fad06_15320861_2
actime:  1639017504000
deviceinfo:  DeviceName_iPhone13,3
user-agent:  Mozilla%2F5.0%20%28iPhone%3B%20CPU%20iPhone%20OS%2014_4%20like%20Mac%20OS%20X%29%20AppleWebKit%2F605.1.15%20%28KHTML%2C%20like%20Gecko%29%20Mobile%2F15E148
platforms:  iOS
nettype:  1
deviceuuid:  84964BB5-8897-4717-9AA8-487059D2D8F1keyWords:  米
channelId: 28
cityId:    306{"code": null,"data": [{"address": "宝山区上大路680号—6","cateName": "面包甜点","cityName": "上海","dealsList": [{"dealGroupId": null,"description": "","discountRatio": 6.9,"discountRatioText": "6.9折","earnSum": null,"earnSumText": "","halfYearSale": -1,"orgPrice": 268.0,"pic": "https://p1.meituan.net/320.0/deal/6b189ad0db0ba7fbe8414797c75b8d71103091.jpg%40320w_240h_1e_1c_1l%7Cwatermark%3D0","price": 184.0,"receiveUrl": null,"savePrice": 84.0,"title": "12英寸卡奇创意双层卡通1个,约12英寸,圆形","type": 1}],"detailUrl": "https://hsrjh5.huashengjia100.com/page/localStore/#/index?shopId=571123170&channelId=28","distance": null,"distanceToShow": null,"maxSavePrice": 84.0,"regionName": "上海大学","shopId": "571123170","shopName": "卡奇米酥(上海总店)","shopPic": "https://p1.meituan.net/320.0/deal/6b189ad0db0ba7fbe8414797c75b8d71103091.jpg%40320w_240h_1e_1c_1l%7Cwatermark%3D0","shopPower": 41,"sort": 0},{"address": "浦东新区川周公路4399号蚂蚁美食城","cateName": "粤菜","cityName": "上海","dealsList": [{"dealGroupId": null,"description": "","discountRatio": 6.8,"discountRatioText": "6.8折","earnSum": null,"earnSumText": "","halfYearSale": -1,"orgPrice": 54.0,"pic": "https://p0.meituan.net/320.0/deal/02f5b3d62f81bc881fb04b59ee362fa162918.jpg%40320w_240h_1e_1c_1l%7Cwatermark%3D0","price": 36.8,"receiveUrl": null,"savePrice": 17.2,"title": "双人套餐,包间免费","type": 1}],"detailUrl": "https://hsrjh5.huashengjia100.com/page/localStore/#/index?shopId=1653182204&channelId=28","distance": null,"distanceToShow": null,"maxSavePrice": 17.2,"regionName": "迪士尼","shopId": "1653182204","shopName": "香港九咔米澜(周浦店)","shopPic": "https://p0.meituan.net/320.0/deal/02f5b3d62f81bc881fb04b59ee362fa162918.jpg%40320w_240h_1e_1c_1l%7Cwatermark%3D0","shopPower": 0,"sort": 1}

75cb3c2f014417f82239b74ab428969b.png

b31472f3992174f92dddd4e4f737d78b.png

d48ab56f18fa203724a464b172f88246.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/568137.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

数据结构-链表1-顺序存储

DynamicArray.h #ifndef DYNAMIC_ARRAY_H #define DYNAMIC_ARRAY_H #define _CRT_SECURE_NO_WARNINGS #include<stdlib.h> #include<stdio.h> #include<string.h>//动态数组结构体 typedef struct DYNAMICARRAY {int* pAddr; //具体存放数据的地址int size…

全网都在用的超全【面试刷题小程序】,最新版激活教程

前几天&#xff0c;我的一个粉丝留言给我说&#xff0c;他在面试美团的自动化测试岗的时候&#xff0c;不幸挂掉了。越想越觉得可惜&#xff0c;回想面试经过&#xff0c;好好总结了几个点&#xff0c;发现面试没过的主要原因是在几个关键的问题没有给到面试官想要的答案。从而…

数据结构-链表2-链式存储

LinkList.h #ifndef LINKLIST_H #define LINKLIST_H #define _CRT_SECURE_NO_WARNINGS #include<stdlib.h> #include<stdio.h> #include<string.h>//链表结点 typedef struct LINKNODE {void* data; //无类型指针&#xff0c;指向任何类型的数据struct LIN…

字节内部自动化测试培训资料,明年涨薪用得上

今天是12月27日&#xff0c;2021年还剩下最后4天。昨晚我收到一位粉丝朋友的涨薪喜讯&#xff0c;他踩着2021的尾巴&#xff0c;成功跳进广州海珠的互联网巨头&#xff0c;涨薪幅度达284%。其实每年的年末&#xff0c;圈子里的朋友都特别忙&#xff0c;大家都在为来年跳槽做准备…

数据结构-链表3-循环链表

LinkList.h #ifndef LINKLIST_H #define LINKLIST_H #define _CRT_SECURE_NO_WARNINGS #include<stdlib.h> #include<stdio.h> #include<string.h>//链表小结点 typedef struct CIRCLELINKNODE {struct LinkNode *next; }CircleLinkNode;//链表结构体 type…

探索篇 | 接口字段容错测试(三)

往期关联文章&#xff1a;探索测试 | 新奇深层测试策略之案例剖析&#xff08;一&#xff09;探索篇 | 新奇测试策略剖析&#xff0c;大家都觉得多此一举(二)探索篇|越权测试策略之案例剖析&#xff08;一&#xff09;重磅福利 | 全网唯一,多年踩坑经验&#xff0c;探索测试策略…

数据结构-链表4-企业链表

LinkList.h #ifndef LINKLIST_H #define LINKLIST_H#include<stdio.h> #include<stdlib.h> //链表结点 typedef struct LINKNODE {struct LINKNODE *next; }LinkNode;//链表 typedef struct LINKLIST{LinkNode head; //放在第一个&#xff0c;防止有偏移量.//不…

全网都在看的Jmeter精选原创文章

点击上方“蓝字”&#xff0c;轻松关注我们Jmeter 原创合集‍‍‍‍‍‍‍1、【Jmeter篇】Linux环境下安装部署运行Jmeter2、Jmeter跨线程组传递参数3、Jmeter中JDBC Connection Configuration实现MySQL JDBC Request数据库处理4、Jmeter JDBC Request执行多条SQL语句5、Jmeter…

opencv之namedWindow,imshow出现两个窗口

初学opencv&#xff0c;代码如下&#xff0c;按理来说结果应该是&#xff1a;一个cmd命令行窗口&#xff0c;一个显示照片的窗口 #include<opencv2\opencv.hpp> #include<iostream> using namespace cv; using namespace std; int main() {const char* win_name …

全网都在看的Fiddler、mitmproxy抓包秘籍,花钱都买不到

点击上方“蓝字”&#xff0c;轻松关注我们Fiddler、mitmproxy、Stream抓包工具原创集合1、Fiddler抓取APP请求&#xff08;环境搭建&#xff09;之mama再也不用担心抓不到包了2、Fiddler抓包神器带你遨游网络&#xff0c;叱咤风云&#xff0c;为所欲为3、Fiddler抓包 | 竟然有…

无法打开文件“python35_d.lib”

在windows10安装opencv时&#xff0c;执行cmake之后&#xff0c;用vs2015打开工程&#xff0c;在debug下&#xff0c;生成INSTALL会出现 错误 1 error LNK1104: 无法打开文件“python35_d.lib” 。 转自 http://blog.csdn.net/Chris_zhangrx/article/details/78947526 在用…

缺陷定位 | 如何精准效率分析推测BUG定位(二)

点击上方“蓝字”&#xff0c;轻松关注我们明天就是除夕了&#xff0c;很多人都回到了老家&#xff0c;吃上了妈妈做的饭菜&#xff0c;这时候应该是最幸福的时刻&#xff0c;我也用年前上班仅剩的几小时把 缺陷定位&#xff08;二&#xff09;分享给大家&#xff0c;希望大家能…

VS2015+cmake3.8+opencv3.2+opencv-contrib3.2编译及配置步骤

一、下载以下文件并解压和安装cmake。并在同目录下新建文件夹mybuild 文件1 opencv-3.2.0-vc14.exe 文件2 opencv_contrib-3.2.0.zip 文件3 cmake-3.8.0-win64-x64.msi 二、打开cmake&#xff0c;并填写路径 .cmake第一行输入的是opencv的源码即opencv的source文件&…

缺陷定位 | 分析推理定位BUG案例(三)

往期关联文章&#xff1a;缺陷定位 | 测试发现了Bug&#xff0c;还要分析定位Bug&#xff1f;&#xff08;一&#xff09;缺陷定位 | 如何精准效率分析推测BUG定位&#xff08;二&#xff09;运营反馈&#xff0c;生产环境&#xff0c;WEB端管理后台&#xff0c;岗位审核详情&a…

数据结构-栈1-顺序存储

LinkList.h: #include<stdlib.h> #include<stdio.h> #include<string.h> #define MAX_SIZE 1024 #define TRUE 1 #define FALSE 0typedef struct LINKLIST {void* data[MAX_SIZE];int size;}LinkList;//初始化 LinkList* Init_linkList();//压入元素 void Pu…

构建测试的体系化思维(基础篇)

读完需要22分钟速读仅需 8 分钟之前写过一篇文章《神圣的QA》&#xff0c;是面向想从事 QA 工作的毕业生同学的&#xff0c;文中有讲到 QA 的五个基本职责&#xff1a;理解和澄清业务需求制定策略并设计测试实现和执行测试缺陷管理与分析质量反馈与风险识别最近有朋友希望我能分…

数据结构-栈2-链式存储

LinkList.h #include<stdlib.h> #include<stdio.h> #include<string.h> #define MAX_SIZE 1024 #define TRUE 1 #define FALSE 0//链表结点--存储下一个结点指针 typedef struct LINKNODE {struct LINKNODE *next; }LinkNode;//链表--保存头结点,和链表长度…

构建测试的体系化思维(进阶篇)

读完需要24分钟速读仅需 8 分钟00 引言1. 三个层次聊测试体系测试人员缺乏体系化思维&#xff1f;新建产品团队或者新启项目&#xff0c;如何搭建质量保障体系&#xff1f;大家都接触过不计其数的测试、质量方面的文章或者培训课程&#xff0c;内容不乏测试实践、技术相关&…

opencv源码查看

首先看看cmake后的mybuild文件夹&#xff1a; 一、打开opencv.sln文件。然后找到对应的cpp文件。

2022大厂面试必问要点总结

Hi&#xff0c;大家好&#xff0c;又到了一年一度的“金三银四”&#xff0c;圈子里的朋友都在为跳槽做准备&#xff0c;每个人都想抓住机会跳槽大厂涨薪升职。近段时间来咨询面试、进阶、跳槽问题的朋友也越来越多。↑后台留言仅最近三天&#xff0c;就收到近百条关于进阶和面…