Created
April 24, 2012 03:39
-
-
Save rgov/2476215 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handler(host, port, request): | |
| # Doesn't actually seem to show up in the UI, but I can dream | |
| request.setHeader('Content-Type', 'image/png') | |
| return file('owned.png').read() | |
| resolver = dnsclient.Resolver(servers=[ ('4.2.2.2', 53) ]) | |
| dnsproxy = DNSReverseProxy(resolver=resolver) | |
| dnsproxy.rewrite('google.com') | |
| dnsproxy.start() | |
| webproxy = WebReverseProxy(resolver=resolver) | |
| webproxy.rewrite(lambda host, port, path: host == 'google.com' and port == 80 and path.endswith('.png'), handler) | |
| webproxy.start() | |
| reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment