{"slug": "how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-bot", "title": "🤖 How I Integrated Kali Linux and DeepSeek (Local AI) to Build a Self-Defending Security Bot for MyZubster", "summary": "A developer integrated Kali Linux penetration testing tools with a local DeepSeek AI model to build an autonomous security bot for MyZubster, a decentralized marketplace. The bot scans the gateway hourly using nmap, nikto, and sqlmap, analyzes results with DeepSeek R1:1.5B running on Ollama, and automatically blocks suspicious IPs, suspends users, or cancels orders. The system runs entirely locally to ensure privacy and zero ongoing costs.", "body_md": "🤖 How I Integrated Kali Linux and DeepSeek (Local AI) to Build a Self-Defending Security Bot for MyZubster\n\nA step-by-step guide on why and how I combined penetration testing tools with local AI to protect a decentralized marketplace.\n\n🧠 Introduction\n\nMyZubster is a decentralized marketplace where users tokenize real‑world assets and trade them using Monero (XMR) payments. But any platform handling tokens, transactions, and sensitive user data must be secure.\n\nInstead of relying on passive security measures or expensive third‑party APIs, I decided to build an autonomous security bot that:\n\n```\nScans the gateway every hour using Kali Linux tools (nmap, nikto, sqlmap).\n\nAnalyzes the results with a local AI model (DeepSeek R1:1.5B running on Ollama).\n\nActs automatically: blocks suspicious IPs, suspends users, cancels open orders.\n```\n\nEverything runs locally – zero data shared with third parties, zero ongoing costs.\n\n🔍 Why Kali Linux?\n\nKali Linux is the de‑facto standard for security auditing and penetration testing. It bundles over 600 pre‑installed tools for network scanning, web application testing, and forensics.\n\nIn MyZubster, I use:\n\n```\nnmap – to scan open ports on the gateway.\n\nnikto – to check for common web vulnerabilities.\n\nsqlmap – to detect SQL injection risks.\n```\n\nAll tools are integrated into a single Python script that runs automatically.\n\nBenefits of Kali Linux in MyZubster\n\n```\n✅ Reliable – battle‑tested tools trusted by security professionals.\n\n✅ Up‑to‑date – actively maintained by the Kali community.\n\n✅ Modular – I can easily add or remove tools.\n\n✅ Containerizable – I run Kali inside a Docker container, isolated from the main system.\n```\n\n🧠 Why DeepSeek (Local)?\n\nFor log analysis, I didn't want to use external APIs (e.g., OpenAI) for two main reasons:\n\n```\nPrivacy – logs may contain sensitive information about users and transactions.\n\nCost – continuous analysis would incur significant recurring fees.\n```\n\nI chose DeepSeek R1:1.5B running locally via Ollama:\n\n```\n✅ Zero cost – no API keys, no credit usage.\n\n✅ Total privacy – data never leaves the server.\n\n✅ Fast response – the model is lightweight and CPU‑optimised.\n\n✅ Customisable – I can tailor prompts to produce structured reports.\n```\n\n🏗️ System Architecture\n\ntext\n\n┌─────────────────────────────────────────────────────────────────┐\n\n│ MyZubster Server │\n\n├─────────────────────────────────────────────────────────────────┤\n\n│ │\n\n│ ┌──────────────────────────────────────────────────────────┐ │\n\n│ │ Gateway (Node.js + Express) │ │\n\n│ │ - REST API │ │\n\n│ │ - JWT Authentication │ │\n\n│ │ - MongoDB models │ │\n\n│ │ - PaymentMonitor (Monero) │ │\n\n│ └──────────────────────────────────────────────────────────┘ │\n\n│ ▲ │\n\n│ │ │\n\n│ ┌──────────────────────────────────────────────────────────┐ │\n\n│ │ Security Bot (Python) │ │\n\n│ │ - Runs nmap / nikto / sqlmap │ │\n\n│ │ - Calls DeepSeek via internal API │ │\n\n│ │ - Executes actions: block IP, suspend user, cancel order│ │\n\n│ │ - Logs everything to /var/log/security_bot.log │ │\n\n│ └──────────────────────────────────────────────────────────┘ │\n\n│ ▲ │\n\n│ │ │\n\n│ ┌──────────────────────────────────────────────────────────┐ │\n\n│ │ DeepSeek (Ollama) │ │\n\n│ │ - Model: deepseek-r1:1.5b │ │\n\n│ │ - Local API on [http://localhost:11434](http://localhost:11434) │ │\n\n│ │ - Analyses logs and returns structured reports │ │\n\n│ └──────────────────────────────────────────────────────────┘ │\n\n└─────────────────────────────────────────────────────────────────┘\n\n🛠️ Implementation Steps\n\n1️⃣ Install Kali Tools\n\nbash\n\napt update\n\napt install nmap nikto sqlmap -y\n\n2️⃣ Install Ollama and Pull DeepSeek\n\nbash\n\ncurl -fsSL [https://ollama.com/install.sh](https://ollama.com/install.sh) | sh\n\nollama pull deepseek-r1:1.5b\n\n3️⃣ Python Security Bot (security_bot.py)\n\nThe bot logs into MyZubster, runs nmap, sends the output to DeepSeek, and takes action.\n\npython\n\nimport subprocess\n\nimport requests\n\nimport json\n\nMYZUBSTER_API = \"[http://localhost:3000/api](http://localhost:3000/api)\"\n\ndef login():\n\nresp = requests.post(f\"{MYZUBSTER_API}/auth/login\",\n\njson={\"email\":\"[test@example.com](mailto:test@example.com)\",\"password\":\"Test123!\"})\n\nreturn resp.json().get('token')\n\ndef ask_deepseek(prompt):\n\nresp = requests.post(\n\nf\"{MYZUBSTER_API}/ai/ask\",\n\njson={\"prompt\": prompt},\n\nheaders={'Authorization': f'Bearer {TOKEN}'}\n\n)\n\nreturn resp.json().get('response')\n\ndef scan_gateway():\n\nresult = subprocess.run(['nmap', '-p', '3000,80,443', 'localhost'], capture_output=True, text=True)\n\nreturn result.stdout\n\ndef block_ip(ip):\n\nsubprocess.run(['ufw', 'deny', 'from', ip], check=False)\n\n4️⃣ Node.js Service for DeepSeek Integration (deepseekService.js)\n\njavascript\n\nconst axios = require('axios');\n\nconst OLLAMA_URL = '[http://localhost:11434/api/chat](http://localhost:11434/api/chat)';\n\nconst MODEL_NAME = 'deepseek-r1:1.5b';\n\nasync function askDeepSeek(prompt) {\n\nconst response = await axios.post(OLLAMA_URL, {\n\nmodel: MODEL_NAME,\n\nmessages: [{ role: 'user', content: prompt }],\n\nstream: false\n\n});\n\nreturn response.data.message.content;\n\n}\n\n5️⃣ Automate with Cron (Every Hour)\n\nbash\n\ncrontab -e\n\n0 * * * * /usr/bin/python3 /root/security_bot.py >> /var/log/security_bot.log 2>&1\n\n🧪 Example Output\n\ntext\n\n🔐 Login to MyZubster...\n\n🔍 Starting security scan...\n\n📊 Scan completed. Sending to DeepSeek for analysis...\n\n**MyZubster Security Report**\n\nOpen ports detected:\n\nPotential vulnerabilities:\n\nRecommendations:\n\n✅ Benefits of This Integration\n\nFeature Advantage\n\nAutomation Scans and analysis run without manual intervention\n\nPrivacy Data never leaves the server\n\nCost Zero API costs (DeepSeek is local)\n\nReactivity Immediate actions when a threat is detected\n\nCustomisability I can extend tools and AI prompts as needed\n\n🚀 Next Steps\n\n```\nAdd more Kali tools – nikto, sqlmap, gobuster.\n\nTelegram/Email webhooks – get notified when the bot detects a threat.\n\nSecurity dashboard – visualise reports in real time.\n\nPredictive analysis – use DeepSeek to forecast potential attacks.\n```\n\n📌 Conclusion\n\nKali Linux and DeepSeek are not competing tools – they complement each other perfectly:\n\n```\nKali provides the means to detect threats.\n\nDeepSeek provides the intelligence to interpret data and decide on actions.\n```\n\nTogether, they turn MyZubster into a self‑defending platform that proactively protects itself and its users.\n\n🔗 Resources\n\n```\nGitHub: DanielIoni-creator/MyZubsterGateway\n\nLive Demo: https://myzubster.com\n\nOllama: https://ollama.com\n\nKali Linux: https://www.kali.org\n```\n\nBuilt with ❤️ by the MyZubster team.\n\n🏷️ Tags", "url": "https://wpnews.pro/news/how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-bot", "canonical_source": "https://dev.to/danielioni/how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-security-bot-for-47lk", "published_at": "2026-07-22 11:20:56+00:00", "updated_at": "2026-07-22 11:29:48.006276+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "developer-tools"], "entities": ["Kali Linux", "DeepSeek", "Ollama", "MyZubster", "nmap", "nikto", "sqlmap", "Monero"], "alternates": {"html": "https://wpnews.pro/news/how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-bot", "markdown": "https://wpnews.pro/news/how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-bot.md", "text": "https://wpnews.pro/news/how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-bot.txt", "jsonld": "https://wpnews.pro/news/how-i-integrated-kali-linux-and-deepseek-local-ai-to-build-a-self-defending-bot.jsonld"}}