This repository was archived by the owner on Oct 21, 2025. It is now read-only.
Commit bb4f368
Learning lessons from previous attempts (#11)
* Fix KeyError in attack generation and remove interactive prompts
- Add robust turn plan extraction with _get_turn_plan() helper method
- Fix KeyError when accessing plan["turn_plans"] with missing or empty data
- Remove "Continue to next attempt?" prompts for automatic execution
- Make infinite mode truly infinite with no user prompts
- Maintain keyboard interrupt handling for user control
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Implement learning system for attack generation
- Add --learn-from CLI parameter (default: 1, 0=none, N=last N sessions)
- Add SessionManager.get_recent_sessions() and extract_successful_patterns()
- Integrate learning context into InteractiveRedTeamV2 and ExploitAgent
- Enhance attack planning with successful patterns from past sessions
- Include successful prompt examples in turn generation
- Update mode 3 to leverage actual learning data instead of hardcoded goals
- Show learning statistics and patterns being used for transparency
The system now learns from previous successful attacks, incorporating:
- Successful strategies and their frequency
- Conversation patterns from successful attempts
- Similar prompt examples for each turn type
- Success rates and pattern insights
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix session filename timestamp inconsistency
Use session start_time instead of current time when saving sessions
to ensure consistent filenames throughout the session lifecycle.
Previously:
- Session creation: uses start_time
- Session saving: uses current time (inconsistent)
Now:
- Session creation: uses start_time
- Session saving: uses start_time (consistent)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent 20abff2 commit bb4f368
File tree
3 files changed
+187
-31
lines changed- src
- cli
- utils
3 files changed
+187
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 84 | | |
83 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
84 | 106 | | |
85 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
86 | 114 | | |
87 | 115 | | |
88 | 116 | | |
89 | 117 | | |
90 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
91 | 128 | | |
92 | 129 | | |
93 | 130 | | |
94 | 131 | | |
95 | 132 | | |
96 | 133 | | |
97 | 134 | | |
98 | | - | |
| 135 | + | |
99 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
100 | 140 | | |
101 | 141 | | |
102 | 142 | | |
| |||
126 | 166 | | |
127 | 167 | | |
128 | 168 | | |
129 | | - | |
130 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
131 | 174 | | |
132 | 175 | | |
133 | 176 | | |
| |||
137 | 180 | | |
138 | 181 | | |
139 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
140 | 191 | | |
141 | 192 | | |
142 | 193 | | |
| |||
174 | 225 | | |
175 | 226 | | |
176 | 227 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 228 | + | |
| 229 | + | |
184 | 230 | | |
185 | 231 | | |
186 | 232 | | |
| |||
340 | 386 | | |
341 | 387 | | |
342 | 388 | | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 389 | + | |
| 390 | + | |
350 | 391 | | |
351 | 392 | | |
352 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
52 | 68 | | |
53 | 69 | | |
54 | 70 | | |
55 | 71 | | |
56 | | - | |
| 72 | + | |
57 | 73 | | |
58 | 74 | | |
59 | 75 | | |
| |||
67 | 83 | | |
68 | 84 | | |
69 | 85 | | |
70 | | - | |
| 86 | + | |
71 | 87 | | |
72 | 88 | | |
73 | 89 | | |
| |||
101 | 117 | | |
102 | 118 | | |
103 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
104 | 133 | | |
105 | 134 | | |
106 | 135 | | |
| |||
124 | 153 | | |
125 | 154 | | |
126 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
127 | 169 | | |
128 | 170 | | |
129 | 171 | | |
| |||
133 | 175 | | |
134 | 176 | | |
135 | 177 | | |
136 | | - | |
137 | | - | |
| 178 | + | |
| 179 | + | |
138 | 180 | | |
139 | 181 | | |
140 | 182 | | |
141 | 183 | | |
142 | 184 | | |
143 | 185 | | |
144 | | - | |
| 186 | + | |
145 | 187 | | |
146 | 188 | | |
147 | | - | |
| 189 | + | |
148 | 190 | | |
149 | 191 | | |
150 | 192 | | |
| |||
182 | 224 | | |
183 | 225 | | |
184 | 226 | | |
| 227 | + | |
185 | 228 | | |
186 | 229 | | |
187 | 230 | | |
| |||
190 | 233 | | |
191 | 234 | | |
192 | 235 | | |
193 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
194 | 239 | | |
195 | 240 | | |
196 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
79 | 149 | | |
80 | 150 | | |
81 | 151 | | |
| |||
0 commit comments