Giter Club home page Giter Club logo

filternet's People

Contributors

axiak avatar jsgoyette avatar skepticfx avatar wmertens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

filternet's Issues

´Error: listen EADDRINUSE` when proxying https

My code looks like this:

fs = require 'fs'
path = require 'path'
findFreePort = require 'find-free-port'
filternet = require('filternet')
pem = require('pem')
PROXY_PORT = null
findFreePort 8090, (err, freePort) ->
  PROXY_PORT = freePort
  pem.createCertificate {days:1, selfSigned:true}, (err, keys)->
    return console.error err if err?
    key = path.resolve 'cert.key'
    crt = path.resolve 'cert.crt'
    fs.writeFileSync key, keys.serviceKey
    fs.writeFileSync crt, keys.certificate

    sslCerts = {
      '*': [key, crt]
    }
    myProxy = filternet.createProxyServer
      port: PROXY_PORT
      transSslPort: 8129
      sslCerts: sslCerts

    myProxy.on 'interceptResponseHeaders', (request_info, response_status_code, response_headers, callback) ->
      response_headers['Content-Security-Policy'] = ''
      callback response_status_code, response_headers

and I get the following exception:

Error: listen EADDRINUSE
  at errnoException (net.js:905:11)
  at Server._listen2 (net.js:1024:19)
  at listen (net.js:1065:10)
  at Server.listen (net.js:1133:5)
  at Object.module.exports.createProxyServer (/Users/davidbuezas/shopco/awesome-phantom-node/node_modules/filternet/lib/proxy.js:306:21) Error: listen EADDRINUSE
  at errnoException (net.js:905:11)
  at Server._listen2 (net.js:1024:19)
  at listen (net.js:1065:10)
  at Server.listen (net.js:1133:5)
  at Object.module.exports.createProxyServer (/Users/davidbuezas/shopco/awesome-phantom-node/node_modules/filternet/lib/proxy.js:306:21)

What am I doing wrong?

Potential socket leak

Hi,

Thanks for sharing this awesome piece of code (and the funny story around it).

It looks like there's a potential connection leak if the socket (for whatever reason) is gone.

    clientSocket.on('data', function (data) {
        try {
            socket.write(data);
        } catch (error) {
            try {
                clientSocket.end();
            } catch (error) {}
            emitter.emit('error', error, 'httpsSocketData');
        }
    });

If socket.write throws an exception like "This socket is closed", the socket will show up as ESTABLISHED or FIN_WAIT2 until Node.js is being restarted. I've been unable to get rid of the socket, even socket.destroy() won't help.

bufferjs/concat was removed

The dependency bufferjs/concat was removed in version 2.0.0.
The following changes were necessary to resolve the issue.

Line 12:
require('bufferjs/concat'); (original)
//require('bufferjs/concat'); (changed)

Line 154:
buffer = Buffer.concat(buffer, chunk); (original)
buffer = Buffer.concat([buffer, chunk]); (changed)

Error listen EACCES when try to use SSL

Hi,
i try to get the HTTPS filtering to run but if i add an cert in the sslCerts objecti get an EACCES exception in createProxyServer.
Do i have to do something additional or is there something broken in my setup (actual nodeJS on windows 7 x64)
Any help would be very appreciated,
Szin

Standard SSL proxy

Hi, I'm trying to set up a standard SSL proxy with MITM for some research work. Say, I'm trying to create a MITM proxy for *.github.com

I've created the local CA as in the example and I see the sockets created in /tmp as per the example ssl proxy. However, I cannot get it to serve data as intended.

echo $http_proxy
http://localhost:9000
echo $HTTPS_PROXY
https://localhost:9000
export HTTPS_PROXY=http://localhost:9000
curl https://api.github.com/users/smsohan/repos
curl: (56) Proxy CONNECT aborted 

Here's my code, see the transSslPort config is set to undefined.

var myProxy = proxy.createProxyServer({
                                        sslCerts: sslCerts,
                                        sslSockDir: '/tmp',
                                        port: 9000,
                                        // transSslPort: 9001,
                                        via: 'my test proxy/1.1' // use false to turn off via
                                    });

In the code, I see the server waits for an upgrade event to start the sslProxy. Do I need to do something to trigger this? Thank you for your amazing code.

Redirect HTTPS requests

Hi,

I need to do following and wondered if it's possible to do using your library.

  1. Proxy all http/https requests transparently no MITM
  2. Perform a simple background check for either the http or https url's based on the host name
  3. If certain conditions are met redirect the url
  4. If conditions not met transparently proxy all traffic especially https

Best regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.