Skip to content

Instantly share code, notes, and snippets.

@rgov
Created April 24, 2012 03:39
Show Gist options
  • Select an option

  • Save rgov/2476215 to your computer and use it in GitHub Desktop.

Select an option

Save rgov/2476215 to your computer and use it in GitHub Desktop.
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