inital commit
This commit is contained in:
commit
c13378170d
3 changed files with 33 additions and 0 deletions
21
Dockerfile
Normal file
21
Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
|||
FROM debian:bookworm
|
||||
EXPOSE 5000
|
||||
RUN \
|
||||
apt update && \
|
||||
apt -y install \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
whois
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
WORKDIR /code
|
||||
RUN chown daemon /code
|
||||
USER daemon
|
||||
ADD --chown=daemon whois.py .
|
||||
ADD --chown=daemon requirements.txt .
|
||||
|
||||
RUN python3 -m venv _env && \
|
||||
source _env/bin/activate && \
|
||||
pip install -r requirements.txt
|
||||
ENTRYPOINT [ "/code/_env/bin/flask", "--app", "whois.py", "run", "--host=0.0.0.0" ]
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Flask
|
11
whois.py
Normal file
11
whois.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/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")
|
||||
|
Loading…
Reference in a new issue