- Vulnerability Scanning:
- Performs port scanning to identify open ports.
- Checks for missing security headers (e.g., X-XSS-Protection, Content-Security-Policy).
- Conducts a simple SQL injection test.
- Reporting: Returns scan results in JSON format, including:
- Open ports
- Missing security headers
- SQL injection vulnerabilities (if any)
- Flexibility: Accepts both raw JSON and form data in requests.
- Multiple HTTP Methods: Supports GET, POST, PUT, PATCH, DELETE, and HEAD requests.
- Error Handling: Provides informative error messages for invalid requests or unexpected errors.
- CSRF Exemption: The API endpoint is exempt from CSRF protection for easier testing and integration.
- Python 3.7 or higher
- pip (Python package installer)
- Postman (for API testing)
-
Clone the repository:
git clone https://github.com/arjunraj79/VAPT-API-for-Automated-Vulnerability-Scanning.git
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
source venv/bin/activate
-
Install the dependencies:
pip install -r requirements.txt
the API
-
Start the Django development server:
python manage.py runserver
-
The API will be accessible at
http://127.0.0.1:8000/api/scan/
.
You can use Postman or any other API testing tool to make requests to the API endpoint.
Example using Postman (GET request)
- Open Postman and create a new request.
- Select GET as the HTTP method.
- Enter the URL:
http://127.0.0.1:8000/api/scan/
. - Go to the "Params" tab.
- Add a key-value pair with
url
as the key and the target URL as the value (e.g.,url: https://www.example.com
). - Click the "Send" button.
Example using cURL (POST request with JSON)
curl -X POST -H "Content-Type: application/json" -d '{"url": "[https://www.example.com](https://www.example.com)"}' http://127.0.0.1:8000/api/scan/
Use code with caution.
Endpoint: /api/scan/
Methods: GET, POST, PUT, PATCH, DELETE, HEAD
Request Body (for POST, PUT, PATCH):
url (string): The URL of the target website to scan. Response Body:
JSON
{
"open_ports": [80, 443],
"missing_security_headers": ["X-XSS-Protection", "Content-Security-Policy", "Strict-Transport-Security", "X-Frame-Options"],
"sql_injection_vulnerability": false
}
Contributions are welcome! Feel free to open issues or submit pull requests.