Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https.proxy/http.proxy whitelist urls #508

Closed
pokevas opened this issue Mar 24, 2019 · 13 comments
Closed

https.proxy/http.proxy whitelist urls #508

pokevas opened this issue Mar 24, 2019 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@pokevas
Copy link

pokevas commented Mar 24, 2019

I think it would not be bad to do in http.proxy / https.proxy a white list of domains/ips that can only be proxied.

@pokevas
Copy link
Author

pokevas commented Mar 25, 2019

We can just filter the domains at the JS level (onLoad / onResponse), but ideally it would be at a higher level, so that even the connection will not proxied if the url is not in the whitelist.
I think it is not difficult task.
If HTTP request parse header, if HTTPS - parse SNI. After that check hostname, if dismatch whitelist - don't proxy, reset the request.

@buffermet buffermet self-assigned this Mar 26, 2019
@buffermet
Copy link
Member

buffermet commented Mar 26, 2019

I think we will also need a https.proxy.blacklist variable with default value * so users can choose to proxy (for example) one domain, or all but one domains.

@pokevas
Copy link
Author

pokevas commented Mar 26, 2019

I think we will also need a https.proxy.blacklist variable with default value * so users can choose to proxy (for example) one domain, or all but one domains.

Yes, ideally, it would be functional to make it possible to proxy both one site and several from the list. Other sites block, for example

@evilsocket
Copy link
Member

why not simply filtering it at the javascript level with a proxy plugin?

@pokevas
Copy link
Author

pokevas commented Mar 26, 2019

filtering at the Go level will load the system less, as well as how to abort the connection/request at the JS module level?

@evilsocket
Copy link
Member

abort the connection? you can't, neither at the go level or js ... once it reached the proxy, you can only forward it (via the proxy) without modifying it ... the overhead in doing that from a plugin is minimal, i'm not very inclined to implement new features that can be more easily (and elegantly) implemented at the module level ...

@pokevas
Copy link
Author

pokevas commented Mar 26, 2019

then how can you reduce the load on bettercap? because a bunch of domains are proxied, but only a few are needed. Since we can only forward requests, how to remove unnecessary domains and reduce the load in this way?

@evilsocket
Copy link
Member

actually i now think you do have a point ... and yeah, there's a place where i can put this in the code ... working on it! 👍

@evilsocket evilsocket assigned evilsocket and unassigned buffermet Mar 26, 2019
@evilsocket evilsocket added the enhancement New feature or request label Mar 26, 2019
@pokevas
Copy link
Author

pokevas commented Mar 26, 2019

Thanks you. Wait for this.
It would not hurt not only to filter unnecessary domains, but also thus reduce the load on the entire bettercap.

@evilsocket
Copy link
Member

yes, i'm adding both a blacklist and whitelist new parameters

@evilsocket
Copy link
Member

done! now, say you only want to intercept cnn.com, you can:

set http.proxy.blacklist *
set http.proxy.whitelist *cnn.com
http.proxy on

@pokevas
Copy link
Author

pokevas commented Mar 26, 2019

Looked at the implementation. Did I understand correctly: because we cannot break the connection, but we can only redirect it, then in the current implementation of the white and black lists you did not block the domains, but simply decide whether to skip the request through js proxy module or not. I understood correctly?
Thanks.

@evilsocket
Copy link
Member

Not just the js proxy module but the proxy all together, the request is only going to be "piped" from the proxy ... if you instead need a more selective approach, at the iptables level, you can use the any.proxy module to perform per-ip redirection to the http.proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants