whois_web/whois.py

12 lines
311 B
Python
Raw Normal View History

2023-12-08 11:18:42 +01:00
#!/usr/bin/env python
from flask import Flask, Response
import subprocess
server = Flask(__name__)
@server.route('/whois/<domain>')
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")