spectrum-security 1.35.0__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,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: spectrum-security
3
+ Version: 1.35.0
4
+ Summary: Autonomous Cyber Reasoning System - Red Team & Blue Team AI agents
5
+ Author-email: William Jiang <jiangwilliam30@gmail.com>
6
+ License: MIT
7
+ Keywords: cybersecurity,red-team,blue-team,LLM,autonomous-agent
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Security
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: flask
18
+ Requires-Dist: gradio
19
+ Requires-Dist: rich
20
+ Requires-Dist: requests
21
+
22
+ # Spectrum – Red/Blue Team AI Framework
23
+
24
+ A dual‑mode autonomous security platform.
25
+ Run as **Red Team** to attack a target, or as **Blue Team** to monitor, detect intrusions and hot‑patch vulnerabilities.
26
+ Powered by Hugging Face (or AMD Cloud) models.
27
+
28
+ ---
29
+
30
+ ## Prerequisites
31
+
32
+ - Python 3.10 or newer
33
+ - pip
34
+ - A Hugging Face account ([hf.co](https://hf.co)) and an API token
35
+ - Git (optional – you can also download the ZIP)
36
+
37
+ ---
38
+
39
+ ## Clone the project
40
+
41
+ ~~~bash
42
+ git clone https://github.com/yourusername/spectrum.git
43
+ cd spectrum
44
+ ~~~
45
+
46
+ If you downloaded a ZIP, extract it and open a terminal inside the extracted folder.
47
+
48
+ ---
49
+
50
+ ## Install dependencies
51
+
52
+ Create and activate a virtual environment (recommended):
53
+
54
+ ~~~bash
55
+ python3 -m venv venv
56
+ source venv/bin/activate # macOS / Linux
57
+ venv\Scripts\activate # Windows
58
+ ~~~
59
+
60
+ Install the required packages:
61
+
62
+ ~~~bash
63
+ pip install -r requirements.txt
64
+ ~~~
65
+
66
+ On macOS with Homebrew Python you may need:
67
+
68
+ ~~~bash
69
+ pip install --break-system-packages -r requirements.txt
70
+ ~~~
71
+
72
+ ---
73
+
74
+ ## Configuration
75
+
76
+ ### API Provider & Token
77
+
78
+ On the first run, Spectrum asks which provider you want to use:
79
+
80
+ 1. **Hugging Face** – you will be prompted for your `HF_TOKEN`.
81
+ 2. **AMD Cloud** – you will be prompted for your `AMD_API_KEY`.
82
+
83
+ The token is saved in a `.env` file.
84
+ You can also create that file manually:
85
+
86
+ ~~~bash
87
+ echo "HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxx" > .env
88
+ ~~~
89
+
90
+ (Replace `hf_xxxxxxxxxxxxxxxxxxxx` with your actual token.)
91
+
92
+ ### Model selection (`config.json`)
93
+
94
+ The default models work out of the box.
95
+ You can change `final_model_id` (the main agent) and `sentinel_model_id` (the lightweight Blue Team watcher) inside `config.json`.
96
+
97
+ Example excerpt:
98
+
99
+ ~~~json
100
+ {
101
+ "final_model_id": "deepseek-ai/DeepSeek-V4-Flash",
102
+ "sentinel_model_id": "Qwen/Qwen2.5-3B-Instruct"
103
+ }
104
+ ~~~
105
+
106
+ ---
107
+
108
+ ## Run a vulnerable target (optional)
109
+
110
+ The project includes a deliberately vulnerable Flask application (`lab.py`).
111
+ Start it in a separate terminal to give the agents something to attack/defend:
112
+
113
+ ~~~bash
114
+ python3 lab.py
115
+ ~~~
116
+
117
+ It listens on `http://127.0.0.1:4999` (or the port printed in the terminal).
118
+
119
+ ---
120
+
121
+ ## Launch Spectrum
122
+
123
+ ~~~bash
124
+ python3 main.py
125
+ ~~~
126
+
127
+ You will see the Spectrum banner. Press **Enter** to continue.
128
+
129
+ ### Choose your mode
130
+
131
+ ~~~text
132
+ Select Operational Module:
133
+ 1. Red Team (Offensive)
134
+ 2. Blue Team (Defensive)
135
+ 3. Exit
136
+ ~~~
137
+
138
+ ---
139
+
140
+ ### Red Team Mode
141
+
142
+ 1. Enter a target / objective, for example:
143
+ `Find the hidden flag on http://127.0.0.1:4999`
144
+ 2. The agent will plan, execute terminal commands, write scripts, and attempt to breach the target.
145
+ 3. **Ctrl+C** to pause, then:
146
+ - `s` – steer the agent (give an instruction)
147
+ - `p` – pause and save the session
148
+ - `Enter` – resume
149
+
150
+ ---
151
+
152
+ ### Blue Team Mode
153
+
154
+ 1. Enter the URL to defend, for example:
155
+ `http://127.0.0.1:4999`
156
+ 2. The Blue Team will:
157
+ - Kill the existing server (if any) and restart it with logging enabled.
158
+ - Start a Sentinel (small AI model) that watches the log file every few seconds.
159
+ - When an attack is detected:
160
+ - Record the attacker IP (in `blocked_ips.txt`).
161
+ - Ask the main model to classify the attack.
162
+ - Automatically patch the vulnerable code (SQLi, command injection, SSTI, etc.).
163
+ - Restart the server with a fresh log.
164
+ 3. **Ctrl+C** to pause, same steering options as Red Team.
165
+
166
+ ---
167
+
168
+ ## File structure (key files)
169
+
170
+ ~~~
171
+ spectrum/
172
+ ├── main.py # Entry point, mode selector
173
+ ├── redteamer.py # Offensive agent logic
174
+ ├── blueteamer.py # Defensive agent (Sentinel + patcher)
175
+ ├── tools.py # Tool implementations (shell, HTTP, file I/O, patch engine)
176
+ ├── lab.py # Vulnerable SAAS lab (for testing)
177
+ ├── config.json # Model IDs and provider settings
178
+ ├── requirements.txt # Python dependencies
179
+ ├── tutorials/ # Optional playbooks loaded by agents
180
+ │ ├── BLUE_DEFENSE_PLAYBOOK.md
181
+ │ └── VULNERABLE_APP_SOURCE.txt
182
+ ├── blocked_ips.txt # IPs blocked during Blue Team sessions
183
+ ├── attacks.log # Record of detected attacks
184
+ ├── server.log # Flask output (created at runtime)
185
+ ├── session.md # Live session log (viewed by viewer.py)
186
+ └── thoughts.json # Agent reasoning trail
187
+ ~~~
188
+
189
+ ---
190
+
191
+ ## Troubleshooting
192
+
193
+ - **ModuleNotFoundError** → run `pip install -r requirements.txt` again.
194
+ - **API Quota Exhausted** → wait a few minutes or switch to another model in `config.json`.
195
+ - **Blue Team doesn't detect attacks** → ensure the target was started with logging (the Blue Team does this automatically for `lab.py`).
196
+ - **Terminal output looks broken** → run `main.py` in a standard terminal; Rich formatting works best there.
197
+
198
+ ---
199
+
200
+ ## Deployment (Hugging Face Spaces / Streamlit Cloud)
201
+
202
+ The repository includes `app.py` for Streamlit deployment and a `Dockerfile` for Docker Spaces.
203
+ Refer to the comments in those files for details.
204
+
205
+ ---
206
+
207
+ For questions or contributions, open an issue on the project's GitHub page.
@@ -0,0 +1,5 @@
1
+ spectrum_security-1.35.0.dist-info/METADATA,sha256=Id2pGFfq4u3_aZ_iv7nOR9ub1vOvllkZ0TYOvVE1Jxg,5835
2
+ spectrum_security-1.35.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
3
+ spectrum_security-1.35.0.dist-info/entry_points.txt,sha256=XKntcodJxSPGg-mvAt9UJOR862h7-9O5U0JK9A9NiHc,48
4
+ spectrum_security-1.35.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
+ spectrum_security-1.35.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ spectrum = spectrum.main:main