REFERENCE DOCUMENTATION | REST API v3.2 | CYBERSECURITY PROJECT
Core analysis endpoint. Accepts a password string and returns a complete security evaluation: strength score, entropy, brute-force time estimate, rockyou/HIBP compromise status, per-criterion audit, improvement suggestions, and SHA-256 hash. Called on every keystroke by the web UI (debounced 500 ms).
| Field | Type | Description | Condition |
|---|---|---|---|
| scor | integer | Strength score 0–100 | always |
| nivel | string | WEAK · AVERAGE · GOOD · STRONG · FORTRESS · COMPROMISED | always |
| culoare | string | Hex color matching nivel for UI rendering | always |
| criterii | object | Map of criterion label → boolean (pass/fail) | always |
| sugestii | string[] | Human-readable improvement recommendations | always |
| penalizari | string[] | Applied penalties with point deductions | always |
| entropie.biti | float | Shannon entropy in bits — log2(alphabet^length) | always |
| entropie.alfabet | integer | Effective alphabet size used for entropy calc | always |
| entropie.componente | string[] | Character classes detected (e.g. "26 litere mici") | always |
| entropie.nivel | string | NIST SP 800-63B entropy category | always |
| timp_spargere | string | Brute-force estimate at RTX 4090 speed (164B hash/s) | always |
| hash_sha256 | string | SHA-256 hex digest of the password | always |
| in_rockyou | boolean | Found in rockyou.txt / internal common-password list | always |
| lungime | integer | Password length in characters | always |
| tipuri_caractere | integer | Number of distinct character classes used (0–4) | not COMPROMISED |
| hibp_compromisa | boolean | Found in HaveIBeenPwned breach database | HIBP hit only |
| hibp_aparitii | integer | Number of times seen across HIBP breaches | HIBP hit only |
| Code | When | Response body |
|---|---|---|
| 400 | Missing "password" field or length > 1 000 | {"eroare": "..."} |
| 429 | More than 10 requests per minute from same IP | {"eroare": "Rate limit depasit: ..."} |
| 500 | Unexpected server error | Flask default error page |
Batch analysis endpoint. Accepts a JSON array of up to 10 passwords
and returns a full /api/check-equivalent result for each, indexed by
position. Each password is XSS-sanitized (HTML-escaped) before
analysis. Useful for auditing password lists without issuing multiple individual
requests.
| Field | Type | Description | Condition |
|---|---|---|---|
| total | integer | Number of passwords analyzed | always |
| results | array | Ordered list of analysis objects (same fields as /api/check) | always |
| results[n].index | integer | 0-based position of the password in the input array | always |
| results[n].scor | integer | Strength score 0–100 | always |
| results[n].nivel | string | WEAK · AVERAGE · GOOD · STRONG · FORTRESS · COMPROMISED | always |
| results[n].* | mixed | All other fields identical to /api/check response | always |
| Code | When | Response body |
|---|---|---|
| 400 | Missing "passwords" field | {"eroare": "Câmpul 'passwords' lipsește din request."} |
| 400 | "passwords" is not an array | {"eroare": "Câmpul 'passwords' trebuie să fie o listă."} |
| 400 | More than 10 passwords in the array | {"eroare": "Prea multe parole (N). Maxim 10 parole per request."} |
| 400 | An item is not a string | {"eroare": "Parola la indexul N nu este un string."} |
| 400 | An item exceeds 500 characters | {"eroare": "Parola la indexul N depășește 500 de caractere (max 500)."} |
| 429 | More than 3 requests per minute from same IP | {"eroare": "Rate limit depasit: ..."} |
| 500 | Unexpected server error | Flask default error page |
Generates a full PDF report for a given password, saves it server-side under rapoarte/, and returns a one-time download URL. The password is HTML-escaped before analysis and never stored in clear text — only the masked form and SHA-256 hash appear in the PDF.
| Code | When | Response body |
|---|---|---|
| 400 | Missing "password" field, not a string, or length > 500 | {"eroare": "..."} |
| 415 | Content-Type is not application/json | {"eroare": "Content-Type trebuie application/json."} |
| 429 | More than 3 requests per minute from same IP | {"eroare": "Rate limit depasit: ..."} |
| 500 | PDF generation failure | Flask default error page |
Serves a previously generated PDF report as a file attachment. The filename is validated server-side against the strict pattern passsec_report_YYYYMMDD_HHMMSSnnnn.pdf — arbitrary path traversal or filenames are rejected with 400.
| Code | When | Response body |
|---|---|---|
| 400 | Filename does not match the expected pattern | {"eroare": "Nume de fișier invalid."} |
| 404 | File not found on disk (expired or never generated) | Flask default 404 |
Health-check endpoint. Returns server version, whether the rockyou.txt dictionary is loaded, and whether PDF report generation is available. No authentication or rate limit applied.
| Code | When | Response body |
|---|---|---|
| 500 | Server error during status check | Flask default error page |
Returns this HTML documentation page. No parameters, no authentication, no rate limit. The page is self-contained and served inline by Flask.