docksec 0.0.1__py3-none-any.whl

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.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: docksec
3
+ Version: 0.0.1
4
+ Summary: AI-Powered Docker Security Analyzer
5
+ Home-page: https://github.com/advaitpatel/DockSec
6
+ Author: Advait Patel
7
+ Project-URL: Bug Tracker, https://github.com/advaitpatel/DockSec/issues
8
+ Project-URL: Documentation, https://github.com/advaitpatel/DockSec/blob/main/README.md
9
+ Project-URL: Source Code, https://github.com/advaitpatel/DockSec
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.12
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: langchain
17
+ Requires-Dist: langchain-openai
18
+ Requires-Dist: python-dotenv
19
+ Requires-Dist: pandas
20
+ Requires-Dist: tqdm
21
+ Requires-Dist: colorama
22
+ Requires-Dist: rich
23
+ Requires-Dist: fpdf
24
+ Requires-Dist: setuptools
25
+ Dynamic: author
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: description-content-type
29
+ Dynamic: home-page
30
+ Dynamic: license-file
31
+ Dynamic: project-url
32
+ Dynamic: requires-dist
33
+ Dynamic: requires-python
34
+ Dynamic: summary
35
+
36
+ # DockSec - AI-Powered Docker Security Analyzer
37
+
38
+ ## Overview
39
+ DockSec is an open-source AI-powered tool designed to analyze Dockerfiles for security vulnerabilities, misconfigurations, and inefficiencies. It provides automated recommendations to enhance container security, reduce the attack surface, and improve compliance with industry best practices.
40
+
41
+ ## Features
42
+ - AI/ML-Powered Analysis: Uses AI models to detect vulnerabilities and suggest security improvements.
43
+ - Security Vulnerability Detection: Scans Dockerfiles for known security issues, CVEs, and misconfigurations.
44
+ - Best Practice Recommendations: Provides actionable insights to enhance security, minimize image size, and improve efficiency.
45
+ - Integration with Development Tools:
46
+ - VS Code extension for inline security suggestions.
47
+ - CI/CD pipeline support (GitHub Actions, GitLab CI, Jenkins).
48
+ - Compliance Checks: Aligns with CIS Benchmarks, Docker Security Best Practices, and OWASP guidelines.
49
+
50
+
51
+ ## Installation
52
+
53
+ Create a virtual environment
54
+ ```bash
55
+ python -m venv env
56
+ ```
57
+ Activate the environment
58
+ ```bash
59
+ env\Scripts\activate # for mac use "source env\bin\activate"
60
+ ```
61
+
62
+ Install the tool using pip:
63
+
64
+ ```bash
65
+ pip install -e .
66
+ ```
67
+
68
+ This will install the `docksec` using setup.py from local files.
69
+
70
+ To install Docksec using pypi you can simply run
71
+
72
+ ```bash
73
+ pip install docksec # it will load the docksec tool from pypi
74
+ ```
75
+
76
+ To completely use the AI scanning of docksec you have to setup the OPENAI-API-KEY
77
+
78
+ 🔹 PowerShell (Windows):
79
+ `$env:OPENAI_API_KEY = "your-secret-key"`
80
+
81
+ 🔹 Command Prompt (CMD on Windows):
82
+ `set OPENAI_API_KEY=your-secret-key`
83
+
84
+ 🔹 Bash/Zsh (Linux/macOS):
85
+ `export OPENAI_API_KEY="your-secret-key"`
86
+
87
+ 🔹 Or create a `.env` file with:
88
+ `OPENAI_API_KEY=your-secret-key`
89
+
90
+ ## Requirements
91
+
92
+ The following dependencies will be automatically installed:
93
+ - langchain
94
+ - langchain-openai
95
+ - python-dotenv
96
+ - pandas
97
+ - tqdm
98
+ - colorama
99
+ - rich
100
+ - fpdf
101
+ - setuptools
102
+
103
+ ## Usage
104
+
105
+ ### CLI Tool
106
+
107
+ After installation, you can use DockSec with a simple command:
108
+
109
+ ```bash
110
+ docksec path\to\Dockerfile
111
+ ```
112
+
113
+ #### Options:
114
+ - `-i, --image`: Specify Docker image ID for scanning (optional)
115
+ - `-o, --output`: Specify output file for the report (default: security_report.txt)
116
+ - `--ai-only`: Run only AI-based recommendations
117
+ - `--scan-only`: Run only Dockerfile/image scanning
118
+
119
+ ### Examples:
120
+
121
+ ```bash
122
+ # Basic analysis
123
+ docksec path\to\Dockerfile
124
+
125
+ # Analyze both Dockerfile and a specific image
126
+ docksec path\to\Dockerfile -i myimage:latest
127
+
128
+ # Only run AI recommendations
129
+ docksec path\to\Dockerfile --ai-only
130
+
131
+ # Only scan for vulnerabilities with custom output file
132
+ docksec path\to\Dockerfile --scan-only -o custom_report.txt
133
+ ```
134
+
135
+ ### Legacy Usage
136
+
137
+ You can still use the original commands:
138
+
139
+ ```bash
140
+ # For AI-based recommendations
141
+ python .\main.py "path\to\your\dockerfile"
142
+
143
+ # For scanning both Dockerfile and images
144
+ python docker_scanner.py <dockerfile_path> <image_name> [severity]
145
+ # Example: python docker_scanner.py .\Dockerfile myapp:latest CRITICAL,HIGH
146
+ ```
147
+
148
+ #### External Tools Setup
149
+
150
+ To check the Dockerfile as well as images for vulnerabilities, you need to setup Trivy and hadolint:
151
+
152
+ ```bash
153
+ python .\setup_external_tools.py
154
+ ```
155
+
156
+ For manual installation, refer to [Trivy](https://trivy.dev/v0.18.3/installation/) and [hadolint](https://github.com/hadolint/hadolint?tab=readme-ov-file#install) documentation.
157
+
158
+ ## CI/CD Integration
159
+ TBD
160
+
161
+ ## Roadmap
162
+ TBD
163
+
164
+ ## Contributing
165
+ We welcome contributions! To get started:
166
+ 1. Fork the repository.
167
+ 2. Create a new branch for your feature or fix.
168
+ 3. Commit your changes and submit a pull request.
169
+
170
+ ## License
171
+ This project is licensed under the MIT License - see the LICENSE file for details.
172
+
173
+ ## Get Involved
174
+ - ⭐ Star this repository to show support!
175
+ - 📢 Share your feedback via GitHub Issues.
176
+ - 📝 Write about DockSec and contribute to our documentation.
177
+
178
+ ## Contact
179
+ For questions or collaborations, reach out via:
180
+ - GitHub Discussions: DockSec Community
181
+ - Twitter: @yourhandle
182
+ - LinkedIn: Your Profile
@@ -0,0 +1,7 @@
1
+ docksec.py,sha256=rQSf_BcXVwUS76MazUk4BMJK2uLv0Sv4IMD0vK9GvCk,1765
2
+ docksec-0.0.1.dist-info/licenses/LICENSE,sha256=11h_Oz6X6j1DxdOWme157skoj5e1P9yb71Xqc6lt5Gs,1068
3
+ docksec-0.0.1.dist-info/METADATA,sha256=B6BIzupkuIzRBRQVEvNT7UqdJgJBhbJih6B-BJ5ORZs,5088
4
+ docksec-0.0.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
5
+ docksec-0.0.1.dist-info/entry_points.txt,sha256=t8ASf9QV8iqE7-2Nn79QJk4YfA6zFlrlkHptCB2Znkc,41
6
+ docksec-0.0.1.dist-info/top_level.txt,sha256=aFyNrvoEHDR8xgYZ9-shzNHheGji-V7HTqF8Nlo9gLM,8
7
+ docksec-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ docksec = docksec:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Advait Patel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ docksec
docksec.py ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import sys
4
+ import os
5
+ import argparse
6
+ import subprocess
7
+
8
+ def main():
9
+ parser = argparse.ArgumentParser(description='Docker Security Analysis Tool')
10
+ parser.add_argument('dockerfile', help='Path to the Dockerfile to analyze')
11
+ parser.add_argument('-i', '--image', help='Docker image ID to scan (optional)')
12
+ parser.add_argument('-o', '--output', help='Output file for the report (default: security_report.txt)')
13
+ parser.add_argument('--ai-only', action='store_true', help='Run only AI-based recommendations')
14
+ parser.add_argument('--scan-only', action='store_true', help='Run only Dockerfile/image scanning')
15
+
16
+ args = parser.parse_args()
17
+
18
+ # Validate that the Dockerfile exists
19
+ if not os.path.isfile(args.dockerfile):
20
+ print(f"Error: Dockerfile not found at {args.dockerfile}")
21
+ sys.exit(1)
22
+
23
+ # Determine which tools to run
24
+ run_ai = not args.scan_only
25
+ run_scan = not args.ai_only
26
+
27
+ if not run_ai and not run_scan:
28
+ run_ai = run_scan = True # Run both by default
29
+
30
+ # Run the AI-based recommendation tool
31
+ if run_ai:
32
+ print("Running AI-based Dockerfile analysis...")
33
+ # Using list form to avoid shell parsing issues on Windows
34
+ subprocess.run([sys.executable, "main.py", args.dockerfile])
35
+
36
+ # Run the scanner tool
37
+ if run_scan:
38
+ print("Running Dockerfile and image scanner...")
39
+ output_file = args.output or "security_report.txt"
40
+ image_id = args.image or ""
41
+
42
+ cmd = [sys.executable, "docker_scanner.py", args.dockerfile]
43
+ if image_id:
44
+ cmd.append(image_id)
45
+
46
+ subprocess.run(cmd)
47
+
48
+ print("Analysis complete!")
49
+
50
+ if __name__ == "__main__":
51
+ main()