更改程序发送的 HTTP 请求的响应
Change Response from HTTP Request sent by a program
我有一个程序可以激活芯片以获得赛车结果。 (它只是一个硬件)。
当我将芯片连接到我的电脑时,我用 Fiddler(嗅探程序)观察我电脑的进出流量。
程序发送以下 HTTP 请求:
POST http://example.com/index.php HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Content-Length: 185
Content-Type: application/x-www-form-urlencoded
Host: example.com
Pragma: no-cache
User-Agent: SomeProgram 1.2.3
Data==%0D%0AAjlFNEEw-SOMELONGSECRETKEY-RGAw%3D%3D%0D%0A
我收到以下回复:
<?xml version="1.0" encoding="utf-8"?>
<message type="3" result="1" txid="someid" activationdate="" availablecredits="732" firstname="John" lastname="Doe" email="JohnDoe@outlook.com" phonenumber="00123445" notification_email="1" notification_text="1"/>
是否可以编辑响应,以便当程序检查 availablecredits
变量时,他得到值 9999
而不是 732
。
我正在 Windows 8 笔记本电脑上工作。
当然 - Fiddler 允许您 modify requests and responses by adding rules to FiddlerScript。引用 Fiddler 文档:
To make custom changes to web requests and responses, use
FiddlerScript to add rules to Fiddler's OnBeforeRequest or
OnBeforeResponse function. Which function is appropriate depends on
the objects your code uses: OnBeforeRequest is called before each
request, and OnBeforeResponse is called before each response.
因此,您所要做的就是向 OnBeforeResponse 添加用于将 availablecredits
属性值替换为您想要的任何值的逻辑。
我有一个程序可以激活芯片以获得赛车结果。 (它只是一个硬件)。
当我将芯片连接到我的电脑时,我用 Fiddler(嗅探程序)观察我电脑的进出流量。
程序发送以下 HTTP 请求:
POST http://example.com/index.php HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Content-Length: 185
Content-Type: application/x-www-form-urlencoded
Host: example.com
Pragma: no-cache
User-Agent: SomeProgram 1.2.3
Data==%0D%0AAjlFNEEw-SOMELONGSECRETKEY-RGAw%3D%3D%0D%0A
我收到以下回复:
<?xml version="1.0" encoding="utf-8"?>
<message type="3" result="1" txid="someid" activationdate="" availablecredits="732" firstname="John" lastname="Doe" email="JohnDoe@outlook.com" phonenumber="00123445" notification_email="1" notification_text="1"/>
是否可以编辑响应,以便当程序检查 availablecredits
变量时,他得到值 9999
而不是 732
。
我正在 Windows 8 笔记本电脑上工作。
当然 - Fiddler 允许您 modify requests and responses by adding rules to FiddlerScript。引用 Fiddler 文档:
To make custom changes to web requests and responses, use FiddlerScript to add rules to Fiddler's OnBeforeRequest or OnBeforeResponse function. Which function is appropriate depends on the objects your code uses: OnBeforeRequest is called before each request, and OnBeforeResponse is called before each response.
因此,您所要做的就是向 OnBeforeResponse 添加用于将 availablecredits
属性值替换为您想要的任何值的逻辑。