This project is the first tool developed as part of my 30-day, 30-hack tool challenge. It leverages the power of AI to analyze open network ports and provide a detailed security assessment report. It utilizes the Gemini AI model to identify potential vulnerabilities and provide recommendations.
- AI-Powered Analysis: Uses the Gemini AI model to analyze open ports.
- Detailed Security Assessment: Provides a comprehensive report on security implications and vulnerabilities.
- Risk Level Assessment: Identifies the risk level (Low/Medium/High) for each open port.
- Specific Recommendations: Offers specific recommendations to secure each port.
- Markdown Output: Saves the analysis report to a Markdown file (
ai_output.md
).
-
Clone the repository:
git clone https://github.com/rasperon/portscanner.git cd portscanner
-
Install dependencies:
go mod download
-
Set up your Gemini API Key:
-
Obtain a Gemini API key from Google AI Studio.
-
Important: Do NOT hardcode your API key directly in the code! Instead, set it as an environment variable.
export GEMINI_API_KEY="YOUR_API_KEY"
-
-
Run the application:
go run main.go
-
Prepare your open ports data: Provide a list of open ports in the following format:
22/tcp open ssh 80/tcp open http 443/tcp open https
-
Run the
AnalyzePorts
function inapi/api.go
file with the open ports data and desired language.
You can configure the following parameters in the api/api.go
file:
- Model: Choose a Gemini model (e.g.,
gemini-pro
). - Temperature: Adjust the temperature for more or less creative responses.
- Max Output Tokens: Control the maximum length of the generated report.
This tool is intended for educational and ethical hacking purposes only. Use it responsibly and only on systems you have explicit permission to test. The author is not responsible for any misuse of this tool.
Contributions are welcome! Please submit pull requests with bug fixes, improvements, or new features.