Skip to content

Add HTTP Status Code column to CSV output - #729

Open
ocervell wants to merge 1 commit into
RedSiege:masterfrom
freelabz:feat/csv-status-code
Open

Add HTTP Status Code column to CSV output#729
ocervell wants to merge 1 commit into
RedSiege:masterfrom
freelabz:feat/csv-status-code

Conversation

@ocervell

Copy link
Copy Markdown

What

Adds the HTTP response status code to EyeWitness's machine-readable output.

  • security_headers.collect_http_headers already makes the request but discarded response.status on success. It now captures it (and e.code on HTTPError) into the collected headers as Response Code.
  • reporting.py gains a Status Code column in Requests.csv (after Request Status), populated from that value.

Why

Requests.csv only exposed Request Status — the browser outcome (Successful / Timeout / BadStatus / …), not the actual HTTP code. Tools that consume the CSV had no way to distinguish a 200 from a 301/404/500 that still rendered. This surfaces the real code (relates to #141, whose "Response Code in headers" behavior had since been refactored out).

Behavior

  • Successful responses now record the real code (e.g. 200, 301).
  • HTTPError responses record the error code (e.g. 404, 500).
  • Connection-level failures (timeout / refused / DNS / SSL) leave the column blank, as no HTTP response was received.
  • The value is also injected into the headers section (Response Code), so it shows in the HTML report too.

Testing

Ran --web against a local nginx target:

Protocol,Port,Domain,URL,Resolved,Request Status,Status Code,Title,...
http,8082,127.0.0.1,http://127.0.0.1:8082,Unknown,Successful,200,"Welcome to nginx!",...

security_headers.collect_http_headers already performs the request but discarded
the response status on success. Capture it (and the error code on HTTPError) into
the collected headers as "Response Code", and add a "Status Code" column to
Requests.csv so the real HTTP code is available in machine-readable output — not
just "Successful" / an error state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant