Exemplo n.º 1
0
 def test_pairs(self):
     from uuid import uuid4
     crypto.setup_table('12233', 'des-cfb')
     e = crypto.new_crypto()
     d = crypto.new_crypto()
     for i in range(100):
         data = uuid4().bytes
         e_data = e.encrypt(str(data))
         self.assertEqual(d.decrypt(e_data ), data)
Exemplo n.º 2
0
 def test_method_is_table(self):
     crypto.setup_table('12233')
     e = crypto.new_crypto()
     for i in range(2000):
         d = e.encrypt(self.data)
         self.assertEqual(e.decrypt(d), self.data)
Exemplo n.º 3
0
 def test_des_cfb(self):
     crypto.setup_table('12233', 'des-cfb')
     e = crypto.new_crypto()
     for i in range(2000):
         d = e.encrypt(self.data)
         self.assertEqual(e.decrypt(d), self.data)
Exemplo n.º 4
0
        self.upstream.set_close_callback(self.on_close)
        self.upstream.connect(dest, self.on_connect)


    @tornado.web.asynchronous
    def post(self):
        return self.get()

    @tornado.web.asynchronous
    def connect(self):
        logger.debug('Start CONNECT to %s', self.request.uri)
        host, port = self.request.uri.split(':')
        connection = LocalConnectionHttps(self.request.connection.stream, (host, int(port)), fukei.upstream.local.LocalUpstream)


if __name__ == '__main__':
    config_path = os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__))), 'config', 'config.json')
    config = Config.current(config_path)
    crypto.setup_table(config.password, config.method)

    from fukei.utils import log_config
    log_config('FukeiLocal', config.debug)

    app = tornado.web.Application([
        (r'.*', ProxyHandler),
    ], debug=config.debug)

    app.listen(config.local_port)
    # print ("Starting HTTP proxy on port %d" % config.local_port)
    tornado.ioloop.IOLoop.instance().start()