https://github.com/benderscript/rag_poison
https://github.com/benderscript/rag_poison
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/benderscript/rag_poison
- Owner: BenderScript
- License: apache-2.0
- Created: 2023-12-19T01:56:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-11T01:45:21.000Z (about 2 years ago)
- Last Synced: 2025-02-07T16:28:49.926Z (about 1 year ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GenAI RAG Poison URL Safety Check Program
## Overview
This Python program checks URLs for safety using a few techniques:
* the Google Safe Browsing API
* Abuse.ch database
For demo purposes it fetches the top 100 URLs from Wikipedia and evaluates each for threats like malware, social engineering, unwanted software, and potentially harmful applications.
## Features
- Integration with Google Safe Browsing API.
- Extraction of URLs from an HTML table.
- Assessment of URLs for various threat types.
- Reporting on potential threats or confirming safety.
## Prerequisites
- Python 3.11
## Installation
1. Clone the repository:
```bash
git clone https://github.com/BenderScript/rag_poison
```
2. Navigate to the cloned directory:
```bash
cd rag_poison
```
3. Install required packages using `pip3`:
```bash
pip3 install -r requirements.txt
```
## Configuration
1. Obtain a Google Safe Browsing API key and place it in a `.env` file as `GOOGLE_SAFE_BROWSING_API_KEY`.
## Usage
Run the program with Python 3:
```bash
python3 main.py
```
## Function Descriptions
- `check_url_with_google_safe_browsing(url, api_key)`: Checks a URL against Google's Safe Browsing API and returns matches.
- `run()`: Main function for URL extraction, API key loading, and URL safety checking.
## Error Handling
- Manages non-200 responses from the API.
- Catches exceptions from request failures.
## Contributing
Feel free to contribute! Open an issue or submit a pull request on GitHub.
## License
This project is licensed under the Apache License.
---