{"id":17722810,"url":"https://github.com/bramp/dsector","last_synced_at":"2025-10-04T01:31:59.550Z","repository":{"id":57525379,"uuid":"67327558","full_name":"bramp/dsector","owner":"bramp","description":"API for parsing binary files using a predefined grammar","archived":false,"fork":false,"pushed_at":"2016-11-17T06:39:50.000Z","size":1101,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-21T10:12:29.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bramp.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":"2016-09-04T05:32:33.000Z","updated_at":"2024-12-27T04:58:38.000Z","dependencies_parsed_at":"2022-08-28T20:21:44.429Z","dependency_job_id":null,"html_url":"https://github.com/bramp/dsector","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/bramp%2Fdsector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fdsector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fdsector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fdsector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramp","download_url":"https://codeload.github.com/bramp/dsector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235208997,"owners_count":18953003,"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":[],"created_at":"2024-10-25T15:39:25.954Z","updated_at":"2025-10-04T01:31:54.168Z","avatar_url":"https://github.com/bramp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dsector [![Build Status](https://img.shields.io/travis/bramp/dsector.svg)](https://travis-ci.org/bramp/dsector) [![Coverage](https://img.shields.io/coveralls/bramp/dsector.svg)](https://coveralls.io/github/bramp/dsector) [![Report card](https://goreportcard.com/badge/github.com/bramp/dsector)](https://goreportcard.com/report/github.com/bramp/dsector) [![GoDoc](https://godoc.org/github.com/bramp/dsector?status.svg)](https://godoc.org/github.com/bramp/dsector)\nby Andrew Brampton [bramp.net](https://bramp.net) (c) 2016\n\n\u003c!-- [![GoDoc](https://godoc.org/github.com/bramp/dsector?status.svg)](https://godoc.org/github.com/bramp/dsector) --\u003e\n\nDsector is a Go package that provides a API for parsing binary files using a predefined grammar. Think the wireshark dissector but for files instead of packets. This useful for debugging or inspecting files.\n\nFor example, using the [PNG grammar](https://github.com/bramp/Grammars/blob/master/png.grammar) on a [sample PNG file](samples/png/basi0g01.png) produces:\n```bash\n$ go run inspect/main.go grammars/png.grammar samples/png/basi0g01.png \n\nPNG Images: (1 children)\n  [0] PNG File: (3 children)\n    [0] Header: (1 children)\n      [0] Eye catcher: 89504e470d0a1a0a (Eye catcher)\n    [1] IHDR: (4 children)\n      [0] Length: 13\n      [1] Type: 0x49484452 (IHDR)\n      [2] Data: (7 children)\n        [0] Width: 32\n        [1] Height: 32\n        [2] Bit depth: 1\n        [3] Color type: 0 (Type0)\n        [4] Compression method: 0 (deflate/inflate)\n        [5] Filter method: 0 (Adaptive)\n        [6] Interlace method: 1 (Adam7 interlace)\n      [3] CRC: 2c0677cf (4 bytes)\n    [2] Chunks: (3 children)\n      [0] gAMA: (4 children)\n        [0] Length: 4\n        [1] Type: 0x67414d41\n        [2] Data: (1 children)\n          [0] Gamma: 100000\n        [3] CRC: 31e8965f (4 bytes)\n      [1] IDAT: (4 children)\n        [0] Length: 144\n        [1] Type: 0x49444154\n        [2] Data: (1 children)\n          [0] Image Data: 789c2d8d310e... (144 bytes)\n        [3] CRC: 661822f2 (4 bytes)\n      [2] IEND: (4 children)\n        [0] Length: 0\n        [1] Type: 0x49454e44\n        [2] Data: (0 children)\n        [3] CRC: ae426082 (4 bytes)\n```\n\nDsector is able to parse the same XML grammar files provided by [Synalyze It!](https://www.synalysis.net/) a commerical Hex Editor for the Mac. If you need a better, more complete tool, then please consider [Synalyze It!](https://www.synalysis.net/) or [Hexinator](https://hexinator.com/).\n\nTODO\n----\n\n* Better document the API.\n* Move the code into multiple packages. Ideally the parsing/xml/structs would all be in seperate packages.\n* More complete tests\n* More sample files for each Grammar\n* Run a fuzzing library to check we don't crash!\n* Many more things\n\n\nLicence (Simplified BSD License)\n--------------------------------\n```\nCopyright (c) 2016, Andrew Brampton\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramp%2Fdsector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramp%2Fdsector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramp%2Fdsector/lists"}