Anutri03/url-phishing-detection-api
0
URL Phishing Detection API
A machine learning API that detects phishing URLs using LightGBM. This API can be integrated into websites to provide real-time URL security analysis.
Features
- Single URL Prediction: Analyze individual URLs for phishing attempts
- Batch Processing: Process multiple URLs at once (up to 100)
- Feature Extraction: Get detailed URL features for analysis
- High Accuracy: Trained on balanced dataset with LightGBM
API Endpoints
Health Check
GET /Returns API status and available endpoints.
Single URL Prediction
POST /predict
Content-Type: application/json
{
"url": "https://example.com"
}Response:
{
"url": "https://example.com",
"prediction": "safe",
"probability": 0.15,
"confidence": 0.85,
"status": "success"
}Batch URL Prediction
POST /predict_batch
Content-Type: application/json
{
"urls": [
"https://example.com",
"http://suspicious-site.com"
]
}Feature Extraction
POST /features
Content-Type: application/json
{
"url": "https://example.com"
}Integration Example
JavaScript/Node.js
const response = await fetch('https://your-space-name.hf.space/predict', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com'
})
});
const result = await response.json();
console.log(result.prediction); // "safe" or "phishing"Python
import requests
response = requests.post('https://your-space-name.hf.space/predict',
json={'url': 'https://example.com'})
result = response.json()
print(result['prediction']) # "safe" or "phishing"cURL
curl -X POST https://your-space-name.hf.space/predict \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'Model Details
- Algorithm: LightGBM (Gradient Boosting)
- Features: 15 lexical features extracted from URLs
- Training: Balanced dataset with early stopping
- Performance: Optimized for speed and accuracy
Security Features
- Input validation and sanitization
- Error handling for malformed URLs
- Rate limiting through Hugging Face infrastructure
- CORS enabled for web integration
Usage for dhaal.io
This API is designed to be integrated into your dhaal.io website. Simply make HTTP requests to the deployed endpoint to get real-time phishing detection for any URL.
API Base URL: https://your-space-name.hf.space
Replace your-space-name with your actual Hugging Face Space name after deployment.
