This project contains various handy representations of domain analysis utilities such as whois and dig.
- Whois & Dig telegram bot;
- Whois & Dig REST API;
- Dockerfiles and docker-compose file for run bot or API in docker containers.
- Python: 3.7+
- Operating system: Linux or macOS
- Installed whois and dig (
dnsutils
) programs - Docker (19.03.0+) with docker compose for easy run API
For bot:
For API:
Instruction
Clone the repo and change directory to it:
git clone https://github.com/melax08/whois-and-dig.git && cd whois-and-dig
Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
Install python dependencies from the file requirements.txt
:
python3 -m pip install --upgrade pip && pip install -r requirements.txt
Copy file .env.example
to .env
and fill it in:
cp .env.example .env
nano .env
Start the bot:
python3 src/wd_telegram_bot.py
Instruction
Clone the repo and change directory to it:
git clone https://github.com/melax08/whois-and-dig.git && cd whois-and-dig
Copy file .env.example
to .env
and fill it in:
cp .env.example .env
nano .env
Build the docker image by Dockerfile.bot
:
docker build -t wd_tg_bot -f Dockerfile.bot .
Create and run docker container:
docker run -it --restart always -d -v ${PWD}/logs:/app/logs --name wd_tg_bot wd_tg_bot
Example of tg bot conversation:
Instruction
- Clone the repo and change directory to api_docker dir in it:
git clone https://github.com/melax08/whois-and-dig.git && cd whois-and-dig
- Copy file
.env.example
to.env
and fill it in:
cp .env.example .env
nano .env
- Go to
api_docker
dir and run docker-compose:
cd api_docker
docker compose up -d
With default nginx config, API runs on http://127.0.0.1.
If you want the api to work on a dedicated ip address, or on a domain, change the directive server_name
in api_docker/nginx/default.conf
file.
In a running application, you can find the swagger documentation
along the path: http://127.0.0.1/docs
Get dig settings like default type or allowed records:
curl -X GET http://127.0.0.1/api/v1/dig/settings
Get dig information about A-records on domain google.com on DNS-servers 1.1.1.1 and 8.8.8.8
curl -X POST http://127.0.0.1/api/v1/dig \
-H "Content-Type: application/json" \
-d '{"domain": "google.com", "record": "A", "dns": ["1.1.1.1", "8.8.8.8"]}'
Get whois information about domain google.com:
curl -X POST http://127.0.0.1/api/v1/whois \
-H "Content-Type: application/json" \
-d '{"domain": "google.com"}'