I Built an AI Agent That Hacks for Me | OpenClaw + Kali Linux
Table of Contents
Introduction
In this tutorial, we will guide you through the process of building a fully autonomous AI hacking agent using OpenClaw on a Kali Linux cloud server. This AI agent can perform various tasks, including locating CCTV cameras and conducting automated scans for vulnerabilities. By following these steps, you will learn how to set up the necessary infrastructure, configure the AI, and ensure secure operations.
Step 1: Understanding OpenClaw
- OpenClaw is an AI agent designed to perform tasks commonly associated with penetration testing.
- It can utilize various tools directly, such as Nmap and Metasploit, to execute commands provided by the user.
- This agent operates on Kali Linux, a popular distribution for cybersecurity tasks.
Step 2: Setting Up the Cloud VPS
- Choose a cloud hosting provider (like Hostinger) to set up your Kali Linux VPS.
- Use the code ZSECURITY for a discount on your VPS plan.
- Follow the provider's instructions to create a new virtual server with Kali Linux installed.
Step 3: Creating Secure SSH Keys
- Open your terminal on your local machine.
- Generate SSH keys using the command:
ssh-keygen -t rsa -b 4096 - Save the keys in a secure location and do not share the private key.
Step 4: Connecting to Your Cloud Kali Machine
- Use SSH to connect to your VPS:
ssh username@your_vps_ip - Replace
usernamewith your actual username andyour_vps_ipwith the IP address of your VPS.
Step 5: Securing Your Server
- Update your system to ensure all packages are current:
sudo apt update && sudo apt upgrade - Set up a firewall using UFW (Uncomplicated Firewall):
sudo ufw allow ssh sudo ufw enable
Step 6: Installing OpenClaw
- Download and install OpenClaw from its official repository.
- Follow the installation instructions provided in the documentation.
Step 7: Configuring OpenClaw
- Open the configuration file for OpenClaw and set your preferences, such as API keys or tool paths.
- Ensure that the AI can access the necessary tools for executing tasks.
Step 8: Connecting the AI Brain
- Set up OpenRouter to facilitate communication with AI models like Claude 4.6 Opus or DeepSeek.
- Follow the specific setup instructions for integrating these models with OpenClaw.
Step 9: Linking to Telegram
- Create a Telegram bot using the BotFather on Telegram.
- Obtain your bot token and configure OpenClaw to use this token for messaging.
- Set up notifications to send hacking reports or alerts back to your phone.
Step 10: Security: Setting Up the Allowlist
- Configure an allowlist of IP addresses or domains that the AI can interact with.
- This step is crucial for maintaining security and ensuring the AI operates within safe parameters.
Step 11: Waking Up the Agent and First Prompt
- Start the OpenClaw agent using the terminal.
- Test the setup by sending a basic prompt to the AI, such as:
openclaw prompt "Find nearby CCTV cameras."
Step 12: Installing Essential Skills
- Install additional tools like a stealth browser and search capabilities to enhance the AI's functionality.
- Ensure these tools are configured correctly within OpenClaw.
Step 13: Setting the Expert Hacker System Prompt
- Craft a system prompt that defines the AI's role and capabilities within the hacking framework.
- Example of a prompt:
You are an expert hacker capable of identifying vulnerabilities and suggesting exploits.
Step 14: Running Demos
- Test the AI's capabilities:
- Demo 1: Use commands to locate CCTV cameras.
- Demo 2: Automate OSINT (Open Source Intelligence) and vulnerability scanning tasks.
Conclusion
In this tutorial, you have learned how to set up an AI agent using OpenClaw on a Kali Linux cloud server. Key steps include setting up a cloud VPS, connecting and securing your server, installing and configuring OpenClaw, and integrating with AI models and Telegram. Ensure you operate ethically and legally, only testing systems you own or have permission to assess. For further exploration, consider diving deeper into specific tools and techniques mentioned in this guide.