**Note: The content in this article is only for educational purposes and understanding of cybersecurity concepts. It should enable people and organizations to have a better grip on threats and know how to protect themselves against them. Please use this information responsibly.**
In penetration testing, AI can help security professionals automate reconnaissance, generate attack payloads, and analyze vulnerabilities efficiently. Two powerful AI tools—Shell GPT (SGPT) and Ollama—offer distinct advantages in offensive security workflows.
SGPT allows pentesters to query cloud-based AI for rapid reconnaissance, vulnerability research, and exploit generation suggestions.
Ollama enables offline AI-powered analysis, allowing pentesters to process exploit code, perform malware obfuscation analysis, and enhance post-exploitation techniques without leaking data to the cloud.
This guide walks through the installation, configuration, and use of SGPT and Ollama in the Kali Linux operating system.
Integrate SGPT in Kali machine
A. Add Credit Balance
1. Visit the OpenAI platform (https://platform.openai.com) and sign up or log in to your existing account.

2. On the top right, click on profile icon, click Your profile option, and navigate to the Billing section.

3. Under the Billing section, go to Payment methods and click Add payment method to add a payment method.

4. Go to Overview and click on Add to credit balance.

5. Enter the minimum amount, i.e., $5, in the Amount to add field, and click Continue. Please refer https://openai.com/api/pricing/ for API pricing details.

6. Click on Confirm payment and complete the transaction to add the credit balance.

B. Create API Key
1. Under API keys, click the + Create new secret key button to a generate new key.

2. A Create new secret key window appears. Provide a name for the secret key (CEH here), leave all the settings as default, as shown in the screenshot, and click the Create secret key button.

3. Save your key pop-up appears. Click the Copy button to copy the key

C. Install shell-gpt
1. Switch to root using sudo su, and the default password: kali.

2. Update the system using apt update

3. Make sure python3 and pip3 is installed
apt install python3 python3-pip -y

4. Let’s install sgpt system-wide.
pip3 install shell-gpt –break-system-packages

This method installs SGPT across your whole system. It’s an easy and unconventional way to do it. A safer and cleaner way to install it is by creating a virtual environment.
5. Export the Openai API key using this command:
export OPENAI_API_KEY=”<API_KEY>”

Note: Make sure to write the API key in double inverted commas.
6. We have successfully integrated ShellGPT API. Now, let’s perform a task using sgpt.
sgpt –shell “use whois tool to perform recon on certifiedhacker.com”

Integrate DeepSeek in the Kali machine
1. Visit the Ollama site: https://ollama.com/ and click on Download.

2. You can download Ollama according to your operating system. Here, let’s download Ollama for Linux.

3. Copy and paste the below command into the terminal.
curl -fsSL https://ollama.com/install.sh | sh

4. Choose DeepSeek from site: https://ollama.com/search.

5. Here, in the drop-down menu, we can choose any DeepSeek distilled model based on our system configuration. Let’s choose the smallest one (1.5b).

6. Run this command in the terminal
ollama run deepseek-r1:1.5b

7. We have successfully downloaded DeepSeek 1.5b models. Let’s perform a task.
perform nmap on certifiedhacker.com

8. If the output or reasoning of DeepSeek(1.5b) is incorrect, simply choose a higher version of the DeepSeek model in step 5.
Conclusion
Integrating SGPT and Ollama into your pen testing toolkit provides a powerful AI-assisted approach to offensive security, red teaming, and exploit development. While SGPT excels in quick research and automated attack suggestions, Ollama ensures full operational security, enabling AI-assisted hacking and forensic analysis without external exposure.