https://github.com/131/mitm-proxy
Mitm https proxy
https://github.com/131/mitm-proxy
Last synced: about 1 year ago
JSON representation
Mitm https proxy
- Host: GitHub
- URL: https://github.com/131/mitm-proxy
- Owner: 131
- Created: 2017-09-23T19:26:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-26T20:00:21.000Z (over 8 years ago)
- Last Synced: 2025-02-17T09:16:43.344Z (over 1 year ago)
- Language: JavaScript
- Size: 23.4 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mitm-proxy
An ES7 (async/await) supported version of [node-http-mitm-proxy](https://github.com/joeferner/node-http-mitm-proxy).
# CA
Move all ca related stuffs to a dedicated [mitm-ca](https://github.com/131/mitm-ca) module.
Drop sni/wildcard support (for now). Proxy constructor now need a CA instance.
# WS
Remove all WS related features (for now)
# Plugins
Replace .use with async event flow.
# Logs & traces
Use [debug](https://github.com/tj/debug) for traces. Start proxy with DEBUG=* to view all traces.
# APIs
```
"use strict";
const CA = require('mitm-ca/fs');
const ca = new CA('.trashmeca');
const Proxy = require('mitm-http');
const gunzip = require('mitm-http/middleware/gunzip');
const proxy = new Proxy(ca);
proxy.onError(function(ctx, err) {
console.error('proxy error:', err);
});
proxy.on('onRequest', async function(ctx) {
if (ctx.req.headers.host.indexOf('.google.') !== -1) {
gunzip(ctx);
ctx.onResponseData(function(ctx, chunk) {
chunk = new Buffer(chunk.toString().replace(//g, '
Pwned!
'));
return chunk;
});
}
});
proxy.listen({port: 8080}, function(){
console.log("Now listening");
});
```