#!/usr/bin/env python from flask import Flask, Response import subprocess server = Flask(__name__) @server.route('/whois/') def whois(domain): whois_cmd = subprocess.run(['/usr/bin/whois', domain], capture_output=True) return Response(whois_cmd.stdout.decode('utf-8'), mimetype="text/plain")