Created
November 23, 2010 21:20
-
-
Save zodman/712561 to your computer and use it in GitHub Desktop.
fliddler.py
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
from twisted.internet import reactor | |
from twisted.web import http | |
from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient | |
class InterceptingProxyClient(ProxyClient): | |
def handleResponsePart(self, buffer): | |
if 'x-requested-with' in self.headers.keys(): | |
print(buffer) | |
ProxyClient.handleResponsePart(self, buffer) | |
class InterceptingProxyClientFactory(ProxyClientFactory): | |
protocol = InterceptingProxyClient | |
class InterceptingProxyRequest(ProxyRequest): | |
protocols = {'http': InterceptingProxyClientFactory} | |
def process(self): | |
ProxyRequest.process(self) | |
class InterceptingProxy(Proxy): | |
requestFactory = InterceptingProxyRequest | |
factory = http.HTTPFactory() | |
factory.protocol = InterceptingProxy | |
reactor.listenTCP(8001, factory) | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment