1、下载 Fiddler Everywhere 5.10.0 并安装。
下载地址:https://downloads.getfiddler.com/win/Fiddler%20Everywhere%205.10.0.exe
2、下载 libfiddler.dll 和 hostpolicy.dll。
下载地址:Release v1.0.4 · project-yukihana/Yukihana-patch (github.com)
3、将 libfiddler.dll 放到 Fiddler Everywhere 根目录,原文件需要重命名为libfiddler.original.dll。
4、将 hostpolicy.dll 放到 Fiddler Everywhere\resources\app\out\WebServer 目录,原文件需要重命名为 hostpolicy.original.dll。
5、在 Fiddler Everywhere\resources\app\out\WebServer 目录创建 patch.json 。
{
"ClientApp\\dist\\main.5f4387a481528ff0.js": {
"target": "ClientApp\\dist\\main.5f4387a481528ff0.original.js",
"content": "",
"cur": 0,
"start": 0,
"end": 1
},
"..\\main.js": {
"target": "..\\main.original.js",
"content": "",
"cur": 0,
"start": 0,
"end": 1
}
}
6、修改文件 Fiddler Everywhere\resources\app\out\WebServer\ClientApp\dist\main.5f4387a481528ff0.js,原文件需要重命名为 main.5f4387a481528ff0.original.js 。
替换所有 https:~/~/api.getfiddler.com 为 http:~/~/127.0.0.1:5678/api.getfiddler.com
替换所有 https:~/~/identity.getfiddler.com 为 http:~/~/127.0.0.1:5678/identity.getfiddler.com
7、修改文件 Fiddler Everywhere\resources\app\out\main.js,原文件需要重命名为 main.original.js 。
将以下代码放到 main.js 文件开头。
(async () => {
const http = require('http')
const path = require('path')
const fs = require('fs')
const { subtle } = require('crypto').webcrypto;
// 准备密钥
const key = await subtle.generateKey({
name: 'ECDSA',
hash: 'SHA-256',
namedCurve: 'P-256',
length: 256,
}, true, ['sign', 'verify']);
const pubKey = await subtle.exportKey('spki', key.publicKey)
const priKey = await subtle.exportKey('pkcs8', key.privateKey)
http.createServer(async (req, res) => {
const fullPath = req.url
const url = new URL(fullPath, 'http://127.0.0.1:5678')
console.log(req.method, url.pathname)
// let body = '';
// req.on('data', chunk => {
// body += chunk.toString();
// });
// req.on('end', () => {
// console.log(`Received data: ${body}`);
// });
let data = ''
if (url != null) {
try {
const loc = path.resolve(__dirname, `./file/${url.pathname}`)
if (fs.existsSync(loc + '.json'))
{
// 在后面加上.json后缀,存在就用这个
res.setHeader('Content-Type', 'application/json; charset=utf-8')
data = fs.readFileSync(loc + '.json').toString()
const headers = {
'content-type': 'application/json; charset=utf-8'
}
const body = data
const signData = Object.keys(headers).map(k => `${k}:${headers[k]}`).join('\n') + body
// console.log('原始数据:', signData)
const signPriKey = await subtle.importKey('pkcs8', priKey, { name: "ECDSA", namedCurve: "P-256" }, true, ['sign'])
// console.log('signPriKey ok')
const bodyBuf = Buffer.from(signData, 'binary')
// console.log('signData length:', bodyBuf.length)
const signature = await subtle.sign({ name: "ECDSA", hash: "SHA-256" }, signPriKey, bodyBuf)
// console.log('signature ok')
// 生成签名头数据
const len = Buffer.from(new Uint8Array(4))
len.writeInt32BE(pubKey.byteLength)
// console.log('len:', pubKey.byteLength, len)
const signatureHeader = Buffer.concat([new Uint8Array(len), new Uint8Array(pubKey), new Uint8Array(signature)])
// console.log('signatureHeader length:', signatureHeader.length)
res.setHeader('Signature', `SignedHeaders=content-type, Signature=${signatureHeader.toString('base64')}`)
}
else if (fs.existsSync(loc)) { // 直接使用原始路径
data = fs.readFileSync(loc).toString()
}
else {
data = 'not implement'
console.log(`error: ${fullPath}`)
}
}catch(e) {
console.error(e)
}
}
res.end(data)
}).listen(5678)
})();
8、双击打开 Fiddler Everywhere,点击登录,会自动打开浏览器,出现 not implemented。等待比较长的一段时间,就会进入应用,并显示999天后过期。