DEV Community

Daniel Ioni
Daniel Ioni

Posted on

๐Ÿ›ก๏ธ Why We Integrated Kali Linux into MyZubster โ€“ A Complete Security Guide

 ๐Ÿ›ก๏ธ Why We Integrated Kali Linux into MyZubster โ€“ A Complete Security Guide

In this guide, I'll explain why and how we integrated Kali Linux into the MyZubster ecosystem, turning a simple marketplace into a selfโ€‘defending, AIโ€‘powered platform for tokenized assets and private payments.
๐Ÿค” Why Kali Linux?

MyZubster deals with:

Realโ€‘world assets (real estate, art, equity)

Private cryptocurrency payments (Monero)

Sensitive user data (reputation, holdings, orders)
Enter fullscreen mode Exit fullscreen mode

Security isn't optional โ€“ it's mandatory. Kali Linux provides the most comprehensive suite of security tools, and we needed a way to automate security scanning and react to threats in real time.
Why not just a regular security scanner?

Kali is purposeโ€‘built for penetration testing and security auditing.

It includes tools like nmap, nikto, sqlmap, hydra, gobuster, and more โ€“ all in one environment.

It's openโ€‘source, wellโ€‘documented, and widely used by security professionals.

We can run it inside a container alongside the gateway, or as a separate service.
Enter fullscreen mode Exit fullscreen mode

๐Ÿง  The Vision: AI + Kali + MyZubster

We wanted a system that:

Scans the gateway for vulnerabilities (open ports, misconfigurations, weak endpoints).

Analyzes the results using AI (OpenAI or local LLM).

Acts on threats:

    Blocks malicious IPs

    Suspends suspicious users

    Cancels open orders linked to compromised accounts

Reports everything to an admin dashboard (or logs).
Enter fullscreen mode Exit fullscreen mode

This turns MyZubster from a passive application into an active, selfโ€‘defending platform.
๐Ÿ—๏ธ Architecture
text

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MyZubster Ecosystem โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ MyZubster Gateway (Node.js) โ”‚ โ”‚
โ”‚ โ”‚ - API endpoints (users, tokens, orders, payments) โ”‚ โ”‚
โ”‚ โ”‚ - Monero PaymentMonitor โ”‚ โ”‚
โ”‚ โ”‚ - JWT authentication โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ–ฒ โ”‚
โ”‚ โ”‚ API calls (with token) โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ AI Security Bot (Python) โ”‚ โ”‚
โ”‚ โ”‚ - Runs Kali tools (nmap, nikto, sqlmap, etc.) โ”‚ โ”‚
โ”‚ โ”‚ - Calls MyZubster API to act on findings โ”‚ โ”‚
โ”‚ โ”‚ - Sends alerts to admin (Telegram/Email) โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ–ฒ โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ AI Model (OpenAI / Local LLM) โ”‚ โ”‚
โ”‚ โ”‚ - Analyzes logs and scan results โ”‚ โ”‚
โ”‚ โ”‚ - Generates reports and recommendations โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง How We Set Up Kali Linux
Step 1: Running Kali Inside a Container

We use a Kali Linux Docker container that runs alongside the gateway. This isolates the security tools from the main application.
bash

docker run -it --name kali-bot kalilinux/kali-rolling /bin/bash

Inside the container, we installed:

nmap โ€“ port scanning

python3 โ€“ for the automation script

requests โ€“ for API calls

net-tools โ€“ for network diagnostics
Enter fullscreen mode Exit fullscreen mode

bash

apt update
apt install nmap python3 python3-pip net-tools -y
python3 -m pip install requests

Step 2: The Security Bot Script

We wrote a Python script that:

Logs in to MyZubster API and obtains a JWT token.

Runs nmap on the gateway's ports (3000, 80, 443).

Sends the scan results to an AI model (OpenAI or local) for analysis.

Takes action based on the AI response:

    Blocks suspicious IPs using ufw (if running on host).

    Suspends users with low reputation or suspicious behavior.

    Cancels open orders from flagged accounts.

Logs everything for auditing.
Enter fullscreen mode Exit fullscreen mode

Here's the simplified script:
python

!/usr/bin/env python3

import subprocess
import requests
import json

MYZUBSTER_API = "http://localhost:3000/api"
TOKEN = ""

def login():
resp = requests.post(f"{MYZUBSTER_API}/auth/login",
json={"email":"test@example.com","password":"Test123!"})
return resp.json().get('token')

def scan_gateway():
result = subprocess.run(['nmap', '-p', '3000,80,443', 'localhost'], capture_output=True, text=True)
return result.stdout

def analyze_with_ai(logs):
# Use OpenAI API or local fallback
if "open" in logs.lower():
return {"status": "critical", "message": "Open port detected"}
return {"status": "ok"}

def block_ip(ip):
subprocess.run(['ufw', 'deny', 'from', ip], check=False)

def main():
TOKEN = login()
if not TOKEN:
print("Login failed")
return
headers = {'Authorization': f'Bearer {TOKEN}'}

scan_result = scan_gateway()
ai_report = analyze_with_ai(scan_result)

if ai_report.get('status') == 'critical':
    block_ip('192.168.1.100')  # Example IP
Enter fullscreen mode Exit fullscreen mode

Step 3: Automating with Cron

We run the bot every hour to keep the system secure:
bash

crontab -e

Add:

0 * * * * /usr/bin/python3 /root/security_bot.py >> /var/log/security_bot.log 2>&1

๐Ÿง  AI Integration (OpenAI / Local LLM)

The AI part is flexible:

OpenAI API: For advanced analysis with GPTโ€‘4 (requires API key).

Local LLM: Using Ollama or Llama for privacyโ€‘first analysis (runs entirely on your own hardware).
Enter fullscreen mode Exit fullscreen mode

We use the AI to:

Interpret scan results โ€“ is an open port a real threat or a false positive?

Prioritize actions โ€“ block only highโ€‘risk IPs, suspend only truly suspicious users.

Generate reports โ€“ summaries for the admin dashboard.
Enter fullscreen mode Exit fullscreen mode

๐Ÿ›ก๏ธ Security Benefits
Threat How Kali Bot Responds
Open ports on the gateway Scans and alerts, blocks external IPs
Bruteโ€‘force login attempts Suspends the attacking user, blocks IP
Suspicious user activity Cancels orders, lowers reputation score
Vulnerable endpoints Suggests patches or configuration changes
Misconfigured Monero RPC Alerts admin to check firewall settings
๐Ÿš€ How We Overcame Challenges
Challenge 1: Containerโ€‘toโ€‘Host Network

The Kali container couldn't reach the gateway on localhost. We solved it by:

Using host.docker.internal (on Docker Desktop)

Or running the bot directly on the host

Or configuring the gateway to listen on 0.0.0.0 (all interfaces)
Enter fullscreen mode Exit fullscreen mode

Challenge 2: Python's Externallyโ€‘Managed Environment in Kali

Kali blocks pip installations by default. We used apt instead:
bash

apt install python3-requests -y

Challenge 3: JWT Token Expiry

The bot now refreshes the token automatically before each scan by calling the login endpoint.
๐Ÿ“Œ Realโ€‘World Use Cases

Auditing the marketplace โ€“ daily scans ensure no unexpected services are running.

Protecting user data โ€“ suspicious IPs are blocked before they can scrape or attack.

Regulatory compliance โ€“ logs show proactive security measures.

Peace of mind โ€“ the system defends itself even when we're not watching.
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”ฎ What's Next

Integrate more Kali tools โ€“ nikto for web vulnerabilities, sqlmap for SQL injection, gobuster for hidden directories.

Webhook alerts โ€“ send Telegram/email notifications when a critical threat is detected.

Dashboard โ€“ visualize scan results and AI reports in a userโ€‘friendly interface.

Autoโ€‘remediation โ€“ the bot can also apply security patches or restart services.
Enter fullscreen mode Exit fullscreen mode

๐Ÿ™Œ Contribute

This security layer is openโ€‘source and ready for your contributions:

GitHub: DanielIoni-creator/MyZubsterGateway

Live Demo: https://myzubster.com

Tor Onion: 2otfic43en3fp3kz7ddowd3xlps5km6obu7qsgp2jhq7qlfv7tdkzqad.onion
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ฌ Final Thoughts

Integrating Kali Linux into MyZubster wasn't just about adding tools โ€“ it was about building a culture of security. The bot runs silently in the background, scanning, analyzing, and protecting the platform 24/7. It's a reminder that in the world of decentralized finance and private payments, security is never a oneโ€‘time task โ€“ it's a continuous process.

The future is private, programmable, and protected. ๐Ÿš€

Built with โค๏ธ by the MyZubster team.

Top comments (0)