dockeriq 0.1.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.
- dockeriq-0.1.0/PKG-INFO +27 -0
- dockeriq-0.1.0/README.md +12 -0
- dockeriq-0.1.0/dockeriq/__init__.py +0 -0
- dockeriq-0.1.0/dockeriq/cli.py +128 -0
- dockeriq-0.1.0/dockeriq.egg-info/PKG-INFO +27 -0
- dockeriq-0.1.0/dockeriq.egg-info/SOURCES.txt +9 -0
- dockeriq-0.1.0/dockeriq.egg-info/dependency_links.txt +1 -0
- dockeriq-0.1.0/dockeriq.egg-info/entry_points.txt +2 -0
- dockeriq-0.1.0/dockeriq.egg-info/top_level.txt +1 -0
- dockeriq-0.1.0/setup.cfg +4 -0
- dockeriq-0.1.0/setup.py +18 -0
dockeriq-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dockeriq
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Secure Docker images with automated vulnerability scanning
|
|
5
|
+
Home-page: https://github.com/yourteam/dockeriq-cli
|
|
6
|
+
Author: Your Team
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: home-page
|
|
13
|
+
Dynamic: requires-python
|
|
14
|
+
Dynamic: summary
|
|
15
|
+
|
|
16
|
+
# DockerIQ CLI
|
|
17
|
+
|
|
18
|
+
Scan Docker images for security vulnerabilities directly from your terminal.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
- Docker
|
|
22
|
+
- Trivy (install from: https://github.com/aquasecurity/trivy)
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
```bash
|
|
26
|
+
pip install dockeriq
|
|
27
|
+
|
dockeriq-0.1.0/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import sys
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
# ألوان الترمينال
|
|
7
|
+
class Colors:
|
|
8
|
+
RED = '\033[91m'
|
|
9
|
+
ORANGE = '\033[93m' # مش موجود في ANSI قديم، فهنستخدم Yellow
|
|
10
|
+
YELLOW = '\033[93m'
|
|
11
|
+
GREEN = '\033[92m'
|
|
12
|
+
CYAN = '\033[96m'
|
|
13
|
+
BOLD = '\033[1m'
|
|
14
|
+
END = '\033[0m'
|
|
15
|
+
|
|
16
|
+
def print_colored(text, color):
|
|
17
|
+
print(f"{color}{text}{Colors.END}")
|
|
18
|
+
|
|
19
|
+
def calculate_score(vulns):
|
|
20
|
+
score = 100
|
|
21
|
+
for v in vulns:
|
|
22
|
+
sev = v.get("severity", "").upper()
|
|
23
|
+
if sev == "CRITICAL":
|
|
24
|
+
score -= 10
|
|
25
|
+
elif sev == "HIGH":
|
|
26
|
+
score -= 5
|
|
27
|
+
elif sev == "MEDIUM":
|
|
28
|
+
score -= 2
|
|
29
|
+
elif sev == "LOW":
|
|
30
|
+
score -= 1
|
|
31
|
+
return max(0, min(100, score))
|
|
32
|
+
|
|
33
|
+
def scan_image(image_name):
|
|
34
|
+
print_colored(f"\n[+] DockerIQ: Scanning image '{image_name}'...", Colors.CYAN)
|
|
35
|
+
|
|
36
|
+
# تأكد إن Trivy مثبت
|
|
37
|
+
result = subprocess.run(["which", "trivy"], capture_output=True, text=True)
|
|
38
|
+
if result.returncode != 0:
|
|
39
|
+
print_colored("❌ DockerIQ Error: Required scanner not found.", Colors.RED)
|
|
40
|
+
print("👉 Install it: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin")
|
|
41
|
+
sys.exit(1)
|
|
42
|
+
|
|
43
|
+
# شغّل Trivy بصمت، واحصل على JSON
|
|
44
|
+
try:
|
|
45
|
+
result = subprocess.run([
|
|
46
|
+
"trivy", "image",
|
|
47
|
+
"--quiet",
|
|
48
|
+
"--skip-db-update",
|
|
49
|
+
"--format", "json",
|
|
50
|
+
image_name
|
|
51
|
+
], capture_output=True, text=True, check=True)
|
|
52
|
+
except subprocess.CalledProcessError as e:
|
|
53
|
+
if e.returncode == 1:
|
|
54
|
+
# Trivy بيطلع exit code 1 لو لقى ثغرات — ده طبيعي
|
|
55
|
+
result = e
|
|
56
|
+
else:
|
|
57
|
+
print_colored(f"❌ Scan failed: {e}", Colors.RED)
|
|
58
|
+
sys.exit(1)
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
data = json.loads(result.stdout)
|
|
62
|
+
except json.JSONDecodeError:
|
|
63
|
+
print_colored("❌ Invalid scan output.", Colors.RED)
|
|
64
|
+
sys.exit(1)
|
|
65
|
+
|
|
66
|
+
# استخرج الثغرات
|
|
67
|
+
vulns = []
|
|
68
|
+
for res in data.get("Results", []):
|
|
69
|
+
for v in res.get("Vulnerabilities", []):
|
|
70
|
+
vulns.append({
|
|
71
|
+
"pkg": v.get("PkgName", "unknown"),
|
|
72
|
+
"id": v.get("VulnerabilityID", "N/A"),
|
|
73
|
+
"severity": v.get("Severity", "UNKNOWN").upper(),
|
|
74
|
+
"title": v.get("Title", "No title available")
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
# احسب الدرجات
|
|
78
|
+
critical = [v for v in vulns if v["severity"] == "CRITICAL"]
|
|
79
|
+
high = [v for v in vulns if v["severity"] == "HIGH"]
|
|
80
|
+
medium = [v for v in vulns if v["severity"] == "MEDIUM"]
|
|
81
|
+
low = [v for v in vulns if v["severity"] == "LOW"]
|
|
82
|
+
|
|
83
|
+
total = len(vulns)
|
|
84
|
+
score = calculate_score(vulns)
|
|
85
|
+
|
|
86
|
+
# عرض النتيجة
|
|
87
|
+
if total == 0:
|
|
88
|
+
print_colored("\n✅ DockerIQ: No vulnerabilities found!", Colors.GREEN)
|
|
89
|
+
print_colored(f"🛡️ Security Score: {score}/100", Colors.BOLD)
|
|
90
|
+
else:
|
|
91
|
+
print_colored(f"\n🚨 DockerIQ: Found {total} vulnerabilities", Colors.RED)
|
|
92
|
+
print_colored(f"🛡️ Security Score: {score}/100", Colors.BOLD)
|
|
93
|
+
|
|
94
|
+
# عرض الأعداد
|
|
95
|
+
print(f"\n📊 Summary:")
|
|
96
|
+
if critical:
|
|
97
|
+
print_colored(f" 🔴 Critical: {len(critical)}", Colors.RED)
|
|
98
|
+
if high:
|
|
99
|
+
print_colored(f" 🟠 High: {len(high)}", Colors.ORANGE)
|
|
100
|
+
if medium:
|
|
101
|
+
print_colored(f" 🟡 Medium: {len(medium)}", Colors.YELLOW)
|
|
102
|
+
if low:
|
|
103
|
+
print_colored(f" 🟢 Low: {len(low)}", Colors.GREEN)
|
|
104
|
+
|
|
105
|
+
# عرض الثغرات
|
|
106
|
+
print(f"\n🔍 Details:")
|
|
107
|
+
for v in vulns:
|
|
108
|
+
sev = v["severity"]
|
|
109
|
+
icon = "🔴" if sev == "CRITICAL" else "🟠" if sev == "HIGH" else "🟡" if sev == "MEDIUM" else "🟢"
|
|
110
|
+
color = Colors.RED if sev == "CRITICAL" else Colors.ORANGE if sev == "HIGH" else Colors.YELLOW if sev == "MEDIUM" else Colors.GREEN
|
|
111
|
+
pkg = v["pkg"]
|
|
112
|
+
vid = v["id"]
|
|
113
|
+
title = v["title"][:80] + "..." if len(v["title"]) > 80 else v["title"]
|
|
114
|
+
print_colored(f" {icon} [{sev}] {vid} in `{pkg}`", color)
|
|
115
|
+
print(f" → {title}\n")
|
|
116
|
+
|
|
117
|
+
def main():
|
|
118
|
+
if len(sys.argv) != 3 or sys.argv[1] != "scan":
|
|
119
|
+
print("Usage: dockeriq scan <image-name>")
|
|
120
|
+
print("Example: dockeriq scan nginx:latest")
|
|
121
|
+
sys.exit(1)
|
|
122
|
+
|
|
123
|
+
image = sys.argv[2]
|
|
124
|
+
scan_image(image)
|
|
125
|
+
|
|
126
|
+
if __name__ == "__main__":
|
|
127
|
+
main()
|
|
128
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dockeriq
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Secure Docker images with automated vulnerability scanning
|
|
5
|
+
Home-page: https://github.com/yourteam/dockeriq-cli
|
|
6
|
+
Author: Your Team
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: home-page
|
|
13
|
+
Dynamic: requires-python
|
|
14
|
+
Dynamic: summary
|
|
15
|
+
|
|
16
|
+
# DockerIQ CLI
|
|
17
|
+
|
|
18
|
+
Scan Docker images for security vulnerabilities directly from your terminal.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
- Docker
|
|
22
|
+
- Trivy (install from: https://github.com/aquasecurity/trivy)
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
```bash
|
|
26
|
+
pip install dockeriq
|
|
27
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dockeriq
|
dockeriq-0.1.0/setup.cfg
ADDED
dockeriq-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="dockeriq",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
entry_points={
|
|
8
|
+
"console_scripts": [
|
|
9
|
+
"dockeriq=dockeriq.cli:main",
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
python_requires=">=3.7",
|
|
13
|
+
author="Your Team",
|
|
14
|
+
description="Secure Docker images with automated vulnerability scanning",
|
|
15
|
+
long_description=open("README.md").read(),
|
|
16
|
+
long_description_content_type="text/markdown",
|
|
17
|
+
url="https://github.com/yourteam/dockeriq-cli",
|
|
18
|
+
)
|