github.com/luckypickle/go-ethereum-vet@v1.14.2/cmd/clef/docs/qubes/qubes-client.py (about) 1 """ 2 This implements a dispatcher which listens to localhost:8550, and proxies 3 requests via qrexec to the service qubes.EthSign on a target domain 4 """ 5 6 import http.server 7 import socketserver,subprocess 8 9 PORT=8550 10 TARGET_DOMAIN= 'debian-work' 11 12 class Dispatcher(http.server.BaseHTTPRequestHandler): 13 def do_POST(self): 14 post_data = self.rfile.read(int(self.headers['Content-Length'])) 15 p = subprocess.Popen(['/usr/bin/qrexec-client-vm',TARGET_DOMAIN,'qubes.Clefsign'],stdin=subprocess.PIPE, stdout=subprocess.PIPE) 16 output = p.communicate(post_data)[0] 17 self.wfile.write(output) 18 19 20 with socketserver.TCPServer(("",PORT), Dispatcher) as httpd: 21 print("Serving at port", PORT) 22 httpd.serve_forever() 23