你好!我有这个代码:
from twisted.web import proxy, http
from twisted.internet import reactor
class akaProxy(proxy.Proxy):
"""
Local proxy = bridge between browser and web application
"""
def dataReceived(self, data):
print "Received data..."
headers = data.split("\n")
request = headers[0].split(" ")
method = request[0].lower()
action = request[1]
print action
print "ended content manipulation"
return proxy.Proxy.dataReceived(self, data)
class ProxyFactory(http.HTTPFactory):
protocol = akaProxy
def intercept(port):
print "Intercept"
try:
factory = ProxyFactory()
reactor.listenTCP(port, factory)
reactor.run()
except Exception as excp:
print str(excp)
intercept(1337)
我使用上面的代码来拦截浏览器和网站之间的所有内容。在上面使用时,我将浏览器设置配置为:IP:127.0.0.1 和端口:1337。我将此脚本放在远程服务器中,以将我的远程服务器作为代理服务器。但是当我将浏览器代理 IP 设置更改为我的服务器时,它不起作用。我做错了什么?我还需要配置什么?