pluto-ai 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. pluto_ai-1.0.0/MANIFEST.in +4 -0
  2. pluto_ai-1.0.0/PKG-INFO +241 -0
  3. pluto_ai-1.0.0/README.md +207 -0
  4. pluto_ai-1.0.0/assets/logo.png +0 -0
  5. pluto_ai-1.0.0/pluto/__init__.py +18 -0
  6. pluto_ai-1.0.0/pluto/__pycache__/__init__.cpython-313.pyc +0 -0
  7. pluto_ai-1.0.0/pluto/__pycache__/cli.cpython-313.pyc +0 -0
  8. pluto_ai-1.0.0/pluto/analyzers/__init__.py +11 -0
  9. pluto_ai-1.0.0/pluto/analyzers/__pycache__/__init__.cpython-313.pyc +0 -0
  10. pluto_ai-1.0.0/pluto/analyzers/__pycache__/code_analyzer.cpython-313.pyc +0 -0
  11. pluto_ai-1.0.0/pluto/analyzers/__pycache__/git_analyzer.cpython-313.pyc +0 -0
  12. pluto_ai-1.0.0/pluto/analyzers/code_analyzer.py +34 -0
  13. pluto_ai-1.0.0/pluto/analyzers/git_analyzer.py +15 -0
  14. pluto_ai-1.0.0/pluto/cli.py +131 -0
  15. pluto_ai-1.0.0/pluto/providers/__init__.py +12 -0
  16. pluto_ai-1.0.0/pluto/providers/__pycache__/__init__.cpython-313.pyc +0 -0
  17. pluto_ai-1.0.0/pluto/providers/__pycache__/claude_provider.cpython-313.pyc +0 -0
  18. pluto_ai-1.0.0/pluto/providers/__pycache__/ollama_provider.cpython-313.pyc +0 -0
  19. pluto_ai-1.0.0/pluto/providers/__pycache__/openai_provider.cpython-313.pyc +0 -0
  20. pluto_ai-1.0.0/pluto/providers/claude_provider.py +110 -0
  21. pluto_ai-1.0.0/pluto/providers/ollama_provider.py +90 -0
  22. pluto_ai-1.0.0/pluto/providers/openai_provider.py +95 -0
  23. pluto_ai-1.0.0/pluto/reporters/__init__.py +18 -0
  24. pluto_ai-1.0.0/pluto/reporters/__pycache__/__init__.cpython-313.pyc +0 -0
  25. pluto_ai-1.0.0/pluto/reporters/__pycache__/json_reporter.cpython-313.pyc +0 -0
  26. pluto_ai-1.0.0/pluto/reporters/__pycache__/markdown_reporter.cpython-313.pyc +0 -0
  27. pluto_ai-1.0.0/pluto/reporters/__pycache__/pdf_reporter.cpython-313.pyc +0 -0
  28. pluto_ai-1.0.0/pluto/reporters/__pycache__/terminal_reporter.cpython-313.pyc +0 -0
  29. pluto_ai-1.0.0/pluto/reporters/json_reporter.py +21 -0
  30. pluto_ai-1.0.0/pluto/reporters/markdown_reporter.py +34 -0
  31. pluto_ai-1.0.0/pluto/reporters/pdf_reporter.py +140 -0
  32. pluto_ai-1.0.0/pluto/reporters/terminal_reporter.py +47 -0
  33. pluto_ai-1.0.0/pluto/utils/__init__.py +5 -0
  34. pluto_ai-1.0.0/pluto_ai.egg-info/PKG-INFO +241 -0
  35. pluto_ai-1.0.0/pluto_ai.egg-info/SOURCES.txt +42 -0
  36. pluto_ai-1.0.0/pluto_ai.egg-info/dependency_links.txt +1 -0
  37. pluto_ai-1.0.0/pluto_ai.egg-info/entry_points.txt +2 -0
  38. pluto_ai-1.0.0/pluto_ai.egg-info/requires.txt +6 -0
  39. pluto_ai-1.0.0/pluto_ai.egg-info/top_level.txt +1 -0
  40. pluto_ai-1.0.0/pyproject.toml +44 -0
  41. pluto_ai-1.0.0/requirements.txt +6 -0
  42. pluto_ai-1.0.0/setup.cfg +4 -0
  43. pluto_ai-1.0.0/setup.py +52 -0
  44. pluto_ai-1.0.0/test.py +10 -0
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include requirements.txt
4
+ recursive-include pluto/assets *
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: pluto-ai
3
+ Version: 1.0.0
4
+ Summary: AI-powered code security vulnerability scanner
5
+ Home-page: https://github.com/0xsaikat/pluto
6
+ Author: 0xSaikat
7
+ Author-email: 0xSaikat <contact@hackbit.org>
8
+ License: MIT
9
+ Project-URL: Homepage, https://hackbit.org
10
+ Project-URL: Repository, https://github.com/0xsaikat/pluto
11
+ Project-URL: Issues, https://github.com/0xsaikat/pluto/issues
12
+ Keywords: security,vulnerability,scanner,code-analysis,ai,static-analysis
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Security
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Requires-Python: >=3.7
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: click>=8.0.0
26
+ Requires-Dist: anthropic>=0.18.0
27
+ Requires-Dist: openai>=1.0.0
28
+ Requires-Dist: requests>=2.28.0
29
+ Requires-Dist: GitPython>=3.1.0
30
+ Requires-Dist: reportlab>=4.0.0
31
+ Dynamic: author
32
+ Dynamic: home-page
33
+ Dynamic: requires-python
34
+
35
+ # 🛡️ Pluto - AI-Powered Code Security Analyzer
36
+
37
+ <div align="center">
38
+
39
+ ```
40
+ ╭─────[By 0xSaikat]───────────────────────────────────╮
41
+ │ │
42
+ │ ____ __ __ │
43
+ │ / __ \/ /_ __/ /_____ │
44
+ │ / /_/ / / / / / __/ __ \ │
45
+ │ / ____/ / /_/ / /_/ /_/ / │
46
+ │ /_/ /_/\__,_/\__/\____/ V-1.0 │
47
+ │ │
48
+ │ AI-Powered Code Security Analyzer │
49
+ │ │
50
+ ╰─────────────────────────────────[hackbit.org]───────╯
51
+ ```
52
+
53
+ [![PyPI version](https://badge.fury.io/py/pluto-security-scanner.svg)](https://badge.fury.io/py/pluto-security-scanner)
54
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
55
+ [![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
56
+
57
+ **Pluto** is a powerful CLI tool that uses AI to detect security vulnerabilities in your code.
58
+
59
+ [Features](#-features) • [Installation](#-installation) • [Usage](#-usage) • [Examples](#-examples) • [Contributing](#-contributing)
60
+
61
+ </div>
62
+
63
+ ---
64
+
65
+ ## 🚀 Features
66
+
67
+ - 🤖 **Multiple AI Providers**: Claude, OpenAI, Ollama (local)
68
+ - 📁 **Flexible Input**: Analyze files, directories, or GitHub repositories
69
+ - 📊 **Multiple Report Formats**: Terminal, PDF, JSON, Markdown
70
+ - 🔒 **Privacy-First**: Local analysis with Ollama support
71
+ - 🎯 **Severity Filtering**: Focus on CRITICAL, HIGH, MEDIUM, or LOW issues
72
+ - 🌐 **Multi-Language Support**: Python, JavaScript, Java, C/C++, Go, Rust, PHP, Ruby, and more
73
+
74
+ ## 🔍 Security Checks
75
+
76
+ Pluto detects:
77
+ - SQL Injection
78
+ - XSS (Cross-Site Scripting)
79
+ - Authentication/Authorization flaws
80
+ - Hardcoded secrets & credentials
81
+ - Insecure cryptography
82
+ - Path traversal
83
+ - Command injection
84
+ - CSRF vulnerabilities
85
+ - Insecure dependencies
86
+ - And many more...
87
+
88
+ ## 📦 Installation
89
+
90
+ ### From PyPI (Recommended)
91
+ ```bash
92
+ pip install pluto-ai
93
+ ```
94
+
95
+ ### From Source
96
+ ```bash
97
+ git clone https://github.com/0xsaikat/pluto.git
98
+ cd pluto
99
+ pip install -e .
100
+ ```
101
+
102
+ ## ⚙️ Setup
103
+
104
+ ### For Claude (Recommended)
105
+ ```bash
106
+ export ANTHROPIC_API_KEY='your-api-key-here'
107
+ ```
108
+ Get your API key from: https://console.anthropic.com/
109
+
110
+ ### For OpenAI
111
+ ```bash
112
+ export OPENAI_API_KEY='your-api-key-here'
113
+ ```
114
+
115
+ ### For Ollama (Local, Free)
116
+ ```bash
117
+ # Install Ollama from https://ollama.ai
118
+ ollama pull phi
119
+ ollama serve
120
+ ```
121
+
122
+ ## 💻 Usage
123
+
124
+ ### Basic Commands
125
+
126
+ ```bash
127
+ # Analyze a single file
128
+ pluto scan -code app.py
129
+
130
+ # Analyze entire directory
131
+ pluto scan -dir ./src --report pdf --output security_report
132
+
133
+ # Analyze GitHub repository
134
+ pluto scan -git https://github.com/user/repo --provider claude
135
+
136
+ # Use local AI (Ollama)
137
+ pluto scan -code app.py --provider ollama --model phi
138
+
139
+ # Filter by severity
140
+ pluto scan -dir ./src --min-severity HIGH
141
+ ```
142
+
143
+ ### Command Options
144
+
145
+ ```
146
+ Options:
147
+ -code, --code-file PATH Analyze a single code file
148
+ -dir, --directory PATH Analyze entire directory
149
+ -git, --git-repo TEXT Analyze GitHub repository
150
+ --provider [claude|openai|ollama] AI provider (default: claude)
151
+ --model TEXT Model name
152
+ --report [terminal|pdf|json|markdown] Report format (default: terminal)
153
+ --output TEXT Output file name
154
+ --min-severity [LOW|MEDIUM|HIGH|CRITICAL] Minimum severity level
155
+ --help Show this message and exit
156
+ ```
157
+
158
+ ## 📚 Examples
159
+
160
+ ### Quick Security Scan
161
+ ```bash
162
+ pluto scan -code myapp.py
163
+ ```
164
+
165
+ ### Full Project Audit
166
+ ```bash
167
+ pluto scan -dir ./backend --provider claude --report pdf --output project_audit
168
+ ```
169
+
170
+ ### GitHub Repository Analysis
171
+ ```bash
172
+ pluto scan -git https://github.com/user/vulnerable-app --report json
173
+ ```
174
+
175
+ ### Local Private Scan
176
+ ```bash
177
+ pluto scan -code sensitive_code.py --provider ollama --model phi
178
+ ```
179
+
180
+ ### CI/CD Integration
181
+ ```bash
182
+ pluto scan -dir ./src --report json --output results.json --min-severity HIGH
183
+ ```
184
+
185
+ ## 📊 Report Formats
186
+
187
+ - **Terminal**: Colorful, real-time output with severity highlighting
188
+ - **PDF**: Professional report with logo, charts, and detailed findings
189
+ - **JSON**: Machine-readable format for automation and CI/CD
190
+ - **Markdown**: Documentation-friendly format
191
+
192
+ ## 🎨 Supported Languages
193
+
194
+ Python • JavaScript • TypeScript • Java • C/C++ • Go • Rust • PHP • Ruby • Swift • Kotlin
195
+
196
+ ## 🔧 Configuration
197
+
198
+ Create a `.plutorc` file in your project root:
199
+
200
+ ```yaml
201
+ provider: claude
202
+ model: claude-sonnet-4-20250514
203
+ min_severity: MEDIUM
204
+ report_format: pdf
205
+ output_dir: ./security-reports
206
+ ```
207
+
208
+ ## 🤝 Contributing
209
+
210
+ Contributions are welcome! Please feel free to submit a Pull Request.
211
+
212
+ 1. Fork the repository
213
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
214
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
215
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
216
+ 5. Open a Pull Request
217
+
218
+ ## 📝 License
219
+
220
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
221
+
222
+ ## 👨‍💻 Author
223
+
224
+ **0xSaikat**
225
+ - Website: [hackbit.org](https://hackbit.org)
226
+ - GitHub: [@0xsaikat](https://github.com/0xsaikat)
227
+
228
+ ## 🙏 Acknowledgments
229
+
230
+ - Powered by Claude (Anthropic), OpenAI, and Ollama
231
+ - Built with ❤️ for the security community
232
+
233
+ ## ⚠️ Disclaimer
234
+
235
+ Pluto is a security analysis tool intended for educational and legitimate security testing purposes only. Always ensure you have permission before scanning code or repositories you don't own.
236
+
237
+ ---
238
+
239
+ <div align="center">
240
+ Made with 🛡️ by 0xSaikat | <a href="https://hackbit.org">hackbit.org</a>
241
+ </div>
@@ -0,0 +1,207 @@
1
+ # 🛡️ Pluto - AI-Powered Code Security Analyzer
2
+
3
+ <div align="center">
4
+
5
+ ```
6
+ ╭─────[By 0xSaikat]───────────────────────────────────╮
7
+ │ │
8
+ │ ____ __ __ │
9
+ │ / __ \/ /_ __/ /_____ │
10
+ │ / /_/ / / / / / __/ __ \ │
11
+ │ / ____/ / /_/ / /_/ /_/ / │
12
+ │ /_/ /_/\__,_/\__/\____/ V-1.0 │
13
+ │ │
14
+ │ AI-Powered Code Security Analyzer │
15
+ │ │
16
+ ╰─────────────────────────────────[hackbit.org]───────╯
17
+ ```
18
+
19
+ [![PyPI version](https://badge.fury.io/py/pluto-security-scanner.svg)](https://badge.fury.io/py/pluto-security-scanner)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
+ [![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
22
+
23
+ **Pluto** is a powerful CLI tool that uses AI to detect security vulnerabilities in your code.
24
+
25
+ [Features](#-features) • [Installation](#-installation) • [Usage](#-usage) • [Examples](#-examples) • [Contributing](#-contributing)
26
+
27
+ </div>
28
+
29
+ ---
30
+
31
+ ## 🚀 Features
32
+
33
+ - 🤖 **Multiple AI Providers**: Claude, OpenAI, Ollama (local)
34
+ - 📁 **Flexible Input**: Analyze files, directories, or GitHub repositories
35
+ - 📊 **Multiple Report Formats**: Terminal, PDF, JSON, Markdown
36
+ - 🔒 **Privacy-First**: Local analysis with Ollama support
37
+ - 🎯 **Severity Filtering**: Focus on CRITICAL, HIGH, MEDIUM, or LOW issues
38
+ - 🌐 **Multi-Language Support**: Python, JavaScript, Java, C/C++, Go, Rust, PHP, Ruby, and more
39
+
40
+ ## 🔍 Security Checks
41
+
42
+ Pluto detects:
43
+ - SQL Injection
44
+ - XSS (Cross-Site Scripting)
45
+ - Authentication/Authorization flaws
46
+ - Hardcoded secrets & credentials
47
+ - Insecure cryptography
48
+ - Path traversal
49
+ - Command injection
50
+ - CSRF vulnerabilities
51
+ - Insecure dependencies
52
+ - And many more...
53
+
54
+ ## 📦 Installation
55
+
56
+ ### From PyPI (Recommended)
57
+ ```bash
58
+ pip install pluto-ai
59
+ ```
60
+
61
+ ### From Source
62
+ ```bash
63
+ git clone https://github.com/0xsaikat/pluto.git
64
+ cd pluto
65
+ pip install -e .
66
+ ```
67
+
68
+ ## ⚙️ Setup
69
+
70
+ ### For Claude (Recommended)
71
+ ```bash
72
+ export ANTHROPIC_API_KEY='your-api-key-here'
73
+ ```
74
+ Get your API key from: https://console.anthropic.com/
75
+
76
+ ### For OpenAI
77
+ ```bash
78
+ export OPENAI_API_KEY='your-api-key-here'
79
+ ```
80
+
81
+ ### For Ollama (Local, Free)
82
+ ```bash
83
+ # Install Ollama from https://ollama.ai
84
+ ollama pull phi
85
+ ollama serve
86
+ ```
87
+
88
+ ## 💻 Usage
89
+
90
+ ### Basic Commands
91
+
92
+ ```bash
93
+ # Analyze a single file
94
+ pluto scan -code app.py
95
+
96
+ # Analyze entire directory
97
+ pluto scan -dir ./src --report pdf --output security_report
98
+
99
+ # Analyze GitHub repository
100
+ pluto scan -git https://github.com/user/repo --provider claude
101
+
102
+ # Use local AI (Ollama)
103
+ pluto scan -code app.py --provider ollama --model phi
104
+
105
+ # Filter by severity
106
+ pluto scan -dir ./src --min-severity HIGH
107
+ ```
108
+
109
+ ### Command Options
110
+
111
+ ```
112
+ Options:
113
+ -code, --code-file PATH Analyze a single code file
114
+ -dir, --directory PATH Analyze entire directory
115
+ -git, --git-repo TEXT Analyze GitHub repository
116
+ --provider [claude|openai|ollama] AI provider (default: claude)
117
+ --model TEXT Model name
118
+ --report [terminal|pdf|json|markdown] Report format (default: terminal)
119
+ --output TEXT Output file name
120
+ --min-severity [LOW|MEDIUM|HIGH|CRITICAL] Minimum severity level
121
+ --help Show this message and exit
122
+ ```
123
+
124
+ ## 📚 Examples
125
+
126
+ ### Quick Security Scan
127
+ ```bash
128
+ pluto scan -code myapp.py
129
+ ```
130
+
131
+ ### Full Project Audit
132
+ ```bash
133
+ pluto scan -dir ./backend --provider claude --report pdf --output project_audit
134
+ ```
135
+
136
+ ### GitHub Repository Analysis
137
+ ```bash
138
+ pluto scan -git https://github.com/user/vulnerable-app --report json
139
+ ```
140
+
141
+ ### Local Private Scan
142
+ ```bash
143
+ pluto scan -code sensitive_code.py --provider ollama --model phi
144
+ ```
145
+
146
+ ### CI/CD Integration
147
+ ```bash
148
+ pluto scan -dir ./src --report json --output results.json --min-severity HIGH
149
+ ```
150
+
151
+ ## 📊 Report Formats
152
+
153
+ - **Terminal**: Colorful, real-time output with severity highlighting
154
+ - **PDF**: Professional report with logo, charts, and detailed findings
155
+ - **JSON**: Machine-readable format for automation and CI/CD
156
+ - **Markdown**: Documentation-friendly format
157
+
158
+ ## 🎨 Supported Languages
159
+
160
+ Python • JavaScript • TypeScript • Java • C/C++ • Go • Rust • PHP • Ruby • Swift • Kotlin
161
+
162
+ ## 🔧 Configuration
163
+
164
+ Create a `.plutorc` file in your project root:
165
+
166
+ ```yaml
167
+ provider: claude
168
+ model: claude-sonnet-4-20250514
169
+ min_severity: MEDIUM
170
+ report_format: pdf
171
+ output_dir: ./security-reports
172
+ ```
173
+
174
+ ## 🤝 Contributing
175
+
176
+ Contributions are welcome! Please feel free to submit a Pull Request.
177
+
178
+ 1. Fork the repository
179
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
180
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
181
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
182
+ 5. Open a Pull Request
183
+
184
+ ## 📝 License
185
+
186
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
187
+
188
+ ## 👨‍💻 Author
189
+
190
+ **0xSaikat**
191
+ - Website: [hackbit.org](https://hackbit.org)
192
+ - GitHub: [@0xsaikat](https://github.com/0xsaikat)
193
+
194
+ ## 🙏 Acknowledgments
195
+
196
+ - Powered by Claude (Anthropic), OpenAI, and Ollama
197
+ - Built with ❤️ for the security community
198
+
199
+ ## ⚠️ Disclaimer
200
+
201
+ Pluto is a security analysis tool intended for educational and legitimate security testing purposes only. Always ensure you have permission before scanning code or repositories you don't own.
202
+
203
+ ---
204
+
205
+ <div align="center">
206
+ Made with 🛡️ by 0xSaikat | <a href="https://hackbit.org">hackbit.org</a>
207
+ </div>
Binary file
@@ -0,0 +1,18 @@
1
+ """
2
+ Pluto - AI-Powered Code Security Analyzer
3
+
4
+ A powerful CLI tool that uses AI to detect security vulnerabilities in your code.
5
+
6
+ Author: 0xSaikat
7
+ Website: https://hackbit.org
8
+ License: MIT
9
+ """
10
+
11
+ __version__ = "1.0.0"
12
+ __author__ = "0xSaikat"
13
+ __email__ = "contact@hackbit.org"
14
+ __license__ = "MIT"
15
+
16
+ from pluto.cli import cli
17
+
18
+ __all__ = ['cli']
@@ -0,0 +1,11 @@
1
+ """
2
+ Code analysis modules for Pluto.
3
+
4
+ This package contains analyzers for different types of code inputs
5
+ including single files, directories, and git repositories.
6
+ """
7
+
8
+ from pluto.analyzers.code_analyzer import CodeAnalyzer
9
+ from pluto.analyzers.git_analyzer import GitAnalyzer
10
+
11
+ __all__ = ['CodeAnalyzer', 'GitAnalyzer']
@@ -0,0 +1,34 @@
1
+ from typing import List, Dict, Optional
2
+ import json
3
+
4
+ class CodeAnalyzer:
5
+ def __init__(self, provider: str = 'claude', model: str = 'claude-sonnet-4-20250514'):
6
+ self.provider = provider
7
+ self.model = model
8
+
9
+ if provider == 'claude':
10
+ from pluto.providers.claude_provider import ClaudeProvider
11
+ self.ai_provider = ClaudeProvider(model)
12
+ elif provider == 'openai':
13
+ from pluto.providers.openai_provider import OpenAIProvider
14
+ self.ai_provider = OpenAIProvider(model)
15
+ elif provider == 'ollama':
16
+ from pluto.providers.ollama_provider import OllamaProvider
17
+ self.ai_provider = OllamaProvider(model)
18
+ else:
19
+ raise ValueError(f"Unknown provider: {provider}")
20
+
21
+ def analyze_file(self, file_path: str) -> List[Dict]:
22
+ """Analyze a single file for vulnerabilities"""
23
+ try:
24
+ with open(file_path, 'r', encoding='utf-8', errors='ignore') as f:
25
+ code = f.read()
26
+
27
+ if not code.strip():
28
+ return []
29
+
30
+ vulnerabilities = self.ai_provider.analyze_code(code, file_path)
31
+ return vulnerabilities
32
+ except Exception as e:
33
+ print(f"Error analyzing {file_path}: {str(e)}")
34
+ return []
@@ -0,0 +1,15 @@
1
+ import os
2
+ import tempfile
3
+ import shutil
4
+ from git import Repo
5
+
6
+ class GitAnalyzer:
7
+ def clone_repo(self, repo_url: str) -> str:
8
+ """Clone a git repository to a temporary directory"""
9
+ temp_dir = tempfile.mkdtemp(prefix='pluto_')
10
+ try:
11
+ Repo.clone_from(repo_url, temp_dir, depth=1)
12
+ return temp_dir
13
+ except Exception as e:
14
+ shutil.rmtree(temp_dir, ignore_errors=True)
15
+ raise Exception(f"Failed to clone repository: {str(e)}")
@@ -0,0 +1,131 @@
1
+ import click
2
+ import json
3
+ import os
4
+ from pathlib import Path
5
+ from typing import Optional, List
6
+ import sys
7
+
8
+ def print_banner():
9
+ """Print the Pluto banner with styled text."""
10
+ banner = (
11
+ "\033[1;36m"
12
+ "\n"
13
+ "╭─────[By 0xSaikat]───────────────────────────────────╮\n"
14
+ "│ │\n"
15
+ "│ ____ __ __ │\n"
16
+ "│ / __ \\/ /_ __/ /_____ │\n"
17
+ "│ / /_/ / / / / / __/ __ \\ │\n"
18
+ "│ / ____/ / /_/ / /_/ /_/ / │\n"
19
+ "│ /_/ /_/\\__,_/\\__/\\____/ V-1.0 │\n"
20
+ "│ │\n"
21
+ "│ AI-Powered Code Security Analyzer │\n"
22
+ "│ │\n"
23
+ "╰─────────────────────────────────[hackbit.org]───────╯\n"
24
+ "\033[0m"
25
+ )
26
+ print(banner)
27
+
28
+ @click.group(invoke_without_command=True)
29
+ @click.pass_context
30
+ @click.version_option(version='1.0.0')
31
+ def cli(ctx):
32
+ """Pluto - AI-Powered Code Security Analyzer"""
33
+ if ctx.invoked_subcommand is None:
34
+ print_banner()
35
+ click.echo("\nUse 'pluto scan --help' to see available options\n")
36
+
37
+ @cli.command()
38
+ @click.option('-code', '--code-file', type=click.Path(exists=True), help='Analyze a single code file')
39
+ @click.option('-dir', '--directory', type=click.Path(exists=True), help='Analyze entire directory')
40
+ @click.option('-git', '--git-repo', type=str, help='Analyze GitHub repository')
41
+ @click.option('--provider', type=click.Choice(['claude', 'openai', 'ollama']), default='claude', help='AI provider')
42
+ @click.option('--model', type=str, default='claude-sonnet-4-20250514', help='Model name')
43
+ @click.option('--report', type=click.Choice(['terminal', 'pdf', 'json', 'html', 'markdown']), default='terminal', help='Report format')
44
+ @click.option('--output', type=str, default='pluto_report', help='Output file name (without extension)')
45
+ @click.option('--min-severity', type=click.Choice(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']), default='LOW', help='Minimum severity level')
46
+ def scan(code_file, directory, git_repo, provider, model, report, output, min_severity):
47
+ """Scan code for security vulnerabilities"""
48
+ print_banner()
49
+ from pluto.analyzers.code_analyzer import CodeAnalyzer
50
+ from pluto.reporters.terminal_reporter import TerminalReporter
51
+ from pluto.reporters.pdf_reporter import PDFReporter
52
+ from pluto.reporters.json_reporter import JSONReporter
53
+ from pluto.reporters.markdown_reporter import MarkdownReporter
54
+
55
+ analyzer = CodeAnalyzer(provider=provider, model=model)
56
+
57
+
58
+ files_to_analyze = []
59
+
60
+ if code_file:
61
+ files_to_analyze.append(code_file)
62
+ elif directory:
63
+ files_to_analyze = get_code_files(directory)
64
+ elif git_repo:
65
+ click.echo("Cloning repository...")
66
+ from pluto.analyzers.git_analyzer import GitAnalyzer
67
+ git_analyzer = GitAnalyzer()
68
+ repo_path = git_analyzer.clone_repo(git_repo)
69
+ files_to_analyze = get_code_files(repo_path)
70
+ else:
71
+ click.echo("Error: Please specify -code, -dir, or -git")
72
+ return
73
+
74
+ if not files_to_analyze:
75
+ click.echo("No code files found to analyze")
76
+ return
77
+
78
+ click.echo(f"Analyzing {len(files_to_analyze)} file(s)...")
79
+
80
+
81
+ all_results = []
82
+ for file_path in files_to_analyze:
83
+ click.echo(f"Scanning: {file_path}")
84
+ results = analyzer.analyze_file(file_path)
85
+ if results:
86
+ all_results.extend(results)
87
+
88
+
89
+ severity_order = {'LOW': 0, 'MEDIUM': 1, 'HIGH': 2, 'CRITICAL': 3}
90
+ min_level = severity_order[min_severity]
91
+ filtered_results = [r for r in all_results if severity_order.get(r.get('severity', 'LOW'), 0) >= min_level]
92
+
93
+ if report == 'terminal' or report == 'terminal':
94
+ reporter = TerminalReporter()
95
+ reporter.generate(filtered_results)
96
+
97
+ if report == 'pdf':
98
+ reporter = PDFReporter()
99
+ reporter.generate(filtered_results, f"{output}.pdf")
100
+ click.echo(f"\nPDF report saved to: {output}.pdf")
101
+
102
+ if report == 'json':
103
+ reporter = JSONReporter()
104
+ reporter.generate(filtered_results, f"{output}.json")
105
+ click.echo(f"\nJSON report saved to: {output}.json")
106
+
107
+ if report == 'markdown':
108
+ reporter = MarkdownReporter()
109
+ reporter.generate(filtered_results, f"{output}.md")
110
+ click.echo(f"\nMarkdown report saved to: {output}.md")
111
+
112
+ def get_code_files(path):
113
+ """Get all code files from a directory"""
114
+ code_extensions = {'.py', '.js', '.jsx', '.ts', '.tsx', '.java', '.cpp', '.c', '.go', '.rs', '.php', '.rb', '.swift', '.kt'}
115
+ files = []
116
+ path_obj = Path(path)
117
+
118
+ if path_obj.is_file():
119
+ return [str(path_obj)]
120
+
121
+ for file in path_obj.rglob('*'):
122
+ if file.is_file() and file.suffix in code_extensions:
123
+
124
+ if any(skip in file.parts for skip in ['node_modules', 'venv', '.git', '__pycache__', 'dist', 'build']):
125
+ continue
126
+ files.append(str(file))
127
+
128
+ return files
129
+
130
+ if __name__ == '__main__':
131
+ cli()
@@ -0,0 +1,12 @@
1
+ """
2
+ AI provider integrations for Pluto.
3
+
4
+ This package contains integrations with various AI providers
5
+ including Claude (Anthropic), OpenAI, and Ollama (local).
6
+ """
7
+
8
+ from pluto.providers.claude_provider import ClaudeProvider
9
+ from pluto.providers.openai_provider import OpenAIProvider
10
+ from pluto.providers.ollama_provider import OllamaProvider
11
+
12
+ __all__ = ['ClaudeProvider', 'OpenAIProvider', 'OllamaProvider']