Fuzz all endpoints. Yields: FuzzResult for each test
(self, api: ParsedAPI)
| 164 | target=target, |
| 165 | success=True, |
| 166 | findings=all_findings, |
| 167 | data={ |
| 168 | "api_title": api.title, |
| 169 | "requests_sent": request_count, |
| 170 | "findings_count": len(all_findings), |
| 171 | }, |
| 172 | ) |
| 173 | |
| 174 | async def _fuzz_endpoints( |
| 175 | self, api: ParsedAPI, base_url: str |
| 176 | ) -> AsyncIterator[FuzzResult]: |
| 177 | """Fuzz all endpoints. |
| 178 | |
| 179 | Args: |
| 180 | api: Parsed API specification |
| 181 | base_url: Validated base URL to send requests to |
| 182 | |
| 183 | Yields: |
| 184 | FuzzResult for each test |
| 185 | """ |
| 186 | headers = self._get_headers() |
| 187 | |
| 188 | async with httpx.AsyncClient(timeout=self.timeout) as client: |
| 189 | for endpoint in api.endpoints: |
| 190 | # Get baseline response |
| 191 | baseline = await self._get_baseline(client, base_url, endpoint, headers) |
| 192 | |
| 193 | # Fuzz each parameter |
| 194 | for param in endpoint.parameters: |
| 195 | payloads = self._get_payloads_for_type(param.param_type) |
| 196 | |
| 197 | for payload in payloads: |
| 198 | result = await self._fuzz_parameter( |
| 199 | client, base_url, endpoint, param, payload, headers, baseline |
| 200 | ) |
no test coverage detected