Пример #1
0
 def handle():
     """加密connect request url 并更改请求方法"""
     self.uri = VHOSTURL % (
             self.switch.get(self.request.method, None),
             encode_data(KEY, self.request.host), 
             encode_data(KEY, self.request.uri)
             )
     self.method = 'GET'
Пример #2
0
 def handle():
     """如果url在白名单 加密request header"""
     #加密url
     self.uri = VHOSTURL % (self.switch.get(self.request.method, None),
                            encode_data(KEY, self.request.host),
                            encode_data(KEY, self.request.uri))
     #更改Host
     self.host = VHOST
     #加密header中的敏感字段
     if self.headers.has_key('Host'):
         self.headers['Host'] = VHOST
     for h in HEADERS:
         if self.headers.has_key(h):
             self.headers[h] = encode_data(self.key,
                                           self.request.headers[h])
     handleProxy()
Пример #3
0
 def http_response_body(self, response):
     """加密response.body"""
     if response.body:
         try:
             return encode_data(self.key, response.body)
         except Exception as e:
             return response.body
Пример #4
0
 def http_response_body(self, response):
     """加密response.body"""
     if response.body:
         try:
             return encode_data(self.key, response.body)
         except Exception as e:
             return response.body
Пример #5
0
 def handle():
     """如果url在白名单 加密request header"""
     #加密url
     self.uri = VHOSTURL % (
             self.switch.get(self.request.method, None),
             encode_data(KEY, self.request.host), 
             encode_data(KEY, self.request.uri)
             )
     #更改Host
     self.host = VHOST
     #加密header中的敏感字段
     if self.headers.has_key('Host'):
         self.headers['Host'] = VHOST
     for h in HEADERS:
         if self.headers.has_key(h):
             self.headers[h] = encode_data(self.key, self.request.headers[h])
     handleProxy()
Пример #6
0
 def handle():
     """加密connect request url 并更改请求方法"""
     self.uri = VHOSTURL % (self.switch.get(self.request.method, None),
                            encode_data(KEY, self.request.host),
                            encode_data(KEY, self.request.uri))
     self.method = 'GET'