您好!我有這樣的代碼:雙絞線代理服務器
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設置更改爲我的服務器時,它不起作用。我做錯了什麼?還有什麼我需要配置?
我抄,放在我的遠程服務器上的腳本並運行它,而與服務器的連接保持打開狀態。然後,我將瀏覽器的代理ip改爲訪問我的服務器以訪問http://www.ifconfig.me/ip,但我無法瀏覽器顯示「連接超時」,服務器上的任何打開的python腳本都不顯示任何信息。它保持原樣。 – torayeff 2012-08-30 18:16:43
除了將您的瀏覽器代理設置更改爲您的服務器的IP,並且還需要將代理端口設置爲8080. – Braudel 2012-08-30 23:27:12
您認爲我沒有:) – torayeff 2012-08-30 23:32:35