Build an AI Phishing Detector

A Beginner’s Guide to AI Security

By RecOsint | Dec 6, 2025

Humans Are Too Slow. You receive 100 emails a day. You can't check every link manually. – The Goal: Build a Machine Learning model that looks at a URL and instantly says: Safe or Phishing. – The Tool: We will use Python and a library called Scikit-Learn.

AI needs examples to learn. We need a dataset containing thousands of: – Legit URLs: (https://www.google.com/search?q=google.com, amazon.com) – Phishing URLs: (secure-login-bank.xyz) – Source: Download a free dataset from Kaggle or PhishTank.

1) Get the Data

The computer can't read text like us. We must convert the URL into numbers (Features). Key things the AI looks for: – Length: Is the URL suspiciously long? (>54 chars) – Special Chars: Does it have too many @ or - symbols? – "https": Is the token missing?

2) Extract "Features"

Phishing: paypal-secure-login-update.com (4 hyphens, 1 "login" keyword). – Legit: paypal.com (0 hyphens). The AI learns this pattern: More Hyphens + "Login" keyword = High Danger.

Visualizing the Trap

We feed these numbers into an algorithm like Random Forest. – The Code Logic: model.fit(features, labels) (Translation: "Hey Computer, look at these patterns and learn the difference.")

3) Train the Model

Now, give it a URL it has never seen before. – Input: netflix-payment-verify.net – AI Prediction: PHISHING (98% Confidence)Success: You just built a cyber defense tool.

4) Test It

This is just the beginning. Real-world tools also check: – Domain Age: (Created yesterday? Suspicious). – Hosting Country: (Hosted in a high-risk region?).

Next Level