{"id":20827620,"url":"https://github.com/bonifield/headerbreakdown","last_synced_at":"2025-12-24T12:56:14.475Z","repository":{"id":57436971,"uuid":"350798052","full_name":"bonifield/HeaderBreakdown","owner":"bonifield","description":"converts a collection of HTTP headers into a dictionary structure for automated analysis; creates parsed and analyzed objects; accepts strings, lists, or dictionaries of header values","archived":false,"fork":false,"pushed_at":"2022-08-15T18:35:45.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-18T16:16:29.302Z","etag":null,"topics":["automation","headers","http","json","python","python3","web"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bonifield.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-23T17:23:05.000Z","updated_at":"2022-08-15T18:37:01.000Z","dependencies_parsed_at":"2022-09-09T23:24:53.402Z","dependency_job_id":null,"html_url":"https://github.com/bonifield/HeaderBreakdown","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonifield%2FHeaderBreakdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonifield%2FHeaderBreakdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonifield%2FHeaderBreakdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonifield%2FHeaderBreakdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bonifield","download_url":"https://codeload.github.com/bonifield/HeaderBreakdown/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243175183,"owners_count":20248422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","headers","http","json","python","python3","web"],"created_at":"2024-11-17T23:12:33.718Z","updated_at":"2025-12-24T12:56:14.421Z","avatar_url":"https://github.com/bonifield.png","language":"Python","readme":"# HeaderBreakdown\nconverts a collection of HTTP headers into a dictionary structure for automated analysis; creates parsed and analyzed objects; accepts strings, lists, or dictionaries of header values\n\n### Installation\n```\npip install headerbreakdown\nor\npip3 install headerbreakdown\nor\npython3 -m pip install headerbreakdown\n```\n\n### Example Output\n```\n{\n    \"_direction\": \"response\",\n    \"_httpversion\": \"HTTP/1.1\",\n    \"_responsecode\": \"302\",\n    \"_responsephrase\": \"Found\",\n    \"location\": {\n        \"key\": \"Location\",\n        \"value\": [\n            \"https://www.google.com/?gws_rd=ssl\"\n        ]\n    },\n    \"cachecontrol\": {\n        \"key\": \"Cache-Control\",\n        \"value\": [\n            \"private\"\n        ]\n    },\n    \"contenttype\": {\n        \"key\": \"Content-Type\",\n        \"value\": [\n            \"text/html; charset=UTF-8\"\n        ],\n        \"subvalues\": [\n            \"charset=UTF-8\",\n            \"text/html\"\n        ],\n        \"microvalues\": [\n            {\n                \"microkey\": \"charset\",\n                \"microvalue\": \"UTF-8\"\n            }\n        ]\n    },\n    \"date\": {\n    ...\n```\n\n### Example Usage\n```\nfrom headerbreakdown import HeaderBreakdown as hb\nimport json\n# header with multiple Host and User-Agent values\nsomeheader = \"GET /?gws_rd=ssl HTTP/1.1\\r\\nHost: www.google.com\\r\\nHost: www.bing.com\\r\\nHost: www.yahoo.com\\r\\nConnection: keep-alive\\r\\nAccept-Encoding: gzip, deflate\\r\\nAccept: */*\\r\\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0\\r\\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/99.0\\r\\nCookie: 1P_JAR=2021-03-13-04\"\n# create the object\nh = hb(someheader)\n# print only the parsed version of the header\nprint(h.parsed)\n# print the analyzed version with subvalues, minivalues, and microkeys and microvalues\nprint(h.analyzed)\n# print as json\nprint(json.dumps(h.analyzed, indent=4))\n# etc\n```\n\n### Available Attributes\n\n| attribute | type | description |\n| -- | -- | -- |\n| **parsed** | dict | main structure of parsed header information |\n| **analyzed** | dict | main structure of parsed and analyzed header information with subvalues, minivalues, and microkeys and microvalues |\n| \\_direction | string | request or response |\n| \\_method | list | request verb;  length of one, unless an illegal header is present |\n| \\_host | list | request host;  length of one, unless an illegal header is present |\n| \\_path | list | request path;  length of one, unless an illegal header is present |\n| \\_httpversion | string | HTTP version being used |\n| \\_responsecode | string | response code number only, as a string |\n| \\_responsephrase | string | response phrase only |\n| \\_keys | list | normalized keys in the analyzed object (same as obj.keys() but omits the sub/mini/micro items) |\n- Note that `method` and `path` are also presented as normalized keys alongside other request header keys (`host` will also be present)\n\n### Releases and Updates\n- 2022-08-11\n\t- minor edits and comments for readability\n\t- made `hb_unittest.py` and commented out `unit_tests()` in headerbreakdown.py\n- 2022-08-10\n\t- converted method and path to lists to accomodate illegal headers such as multiple methods and paths\n\t- fixed attributes to only set if not already present\n\t\t- prevents \"requestrequest\" or \"responseresponse\" for `_direction` if illegal headers are set\n- 2022-03-25\n\t- complete overhaul\n\t- accepts strings, lists, and dictionaries as input\n\t- simplified output dict structure\n\t- standardized keys\n\t- removed json outputs\n\t- TO DO - convert metadata string attributes to lists (smuggling)\n- 2021-04-06\n\t- added nested_direction_json/output, ex. {\"headers\":{\"request\":{...}}}\n\t- so direction gets captured and headers do not get overwritten if processing a capture with both sides of the communication\n\t- the nested_direction_* attributes will be type None when processing a single, direction-ambiguous header (ex. \"Set-Cookie: k1=v1;k2=v2\")\n- 2021-04-01\n\t- minor fix for HTTP/ detection\n- 2021-03-23\n\t- minor edits, added summary and nested_output/nested_json attributes, ex. {\"headers\":{...}}\n- 2021-03-13\n\t- first release\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonifield%2Fheaderbreakdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbonifield%2Fheaderbreakdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonifield%2Fheaderbreakdown/lists"}