{"id":18928140,"url":"https://github.com/hearthsim/proto-extractor","last_synced_at":"2025-10-10T10:32:22.531Z","repository":{"id":29551093,"uuid":"33090256","full_name":"HearthSim/proto-extractor","owner":"HearthSim","description":"Program to extract protobufs compiled for C#","archived":false,"fork":false,"pushed_at":"2024-07-30T13:34:57.000Z","size":736,"stargazers_count":91,"open_issues_count":3,"forks_count":25,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-16T07:39:55.726Z","etag":null,"topics":["c-sharp","protobuf"],"latest_commit_sha":null,"homepage":"https://hearthsim.info","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HearthSim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-29T21:32:54.000Z","updated_at":"2025-03-11T15:41:05.000Z","dependencies_parsed_at":"2024-08-04T08:03:24.112Z","dependency_job_id":null,"html_url":"https://github.com/HearthSim/proto-extractor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HearthSim/proto-extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fproto-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fproto-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fproto-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fproto-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HearthSim","download_url":"https://codeload.github.com/HearthSim/proto-extractor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fproto-extractor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003549,"owners_count":26083595,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c-sharp","protobuf"],"created_at":"2024-11-08T11:23:08.634Z","updated_at":"2025-10-10T10:32:22.134Z","avatar_url":"https://github.com/HearthSim.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proto-extractor\n\nA C# program to extract [Protocol Buffer definitions](https://developers.google.com/protocol-buffers/)\ncompiled with [Google Protos](https://github.com/google/protobuf)\nor [SilentOrbit](https://silentorbit.com/protobuf/).\n\n\u003e The file `protobin_to_proto.py` is discussed [below](#binary-proto-extraction).\n\n# Compilation\n\nThere are 2 versions of the extractor project. Both projects have the same purpose, but target a different runtime framework each.\n\n- Extractor; Targets .Net Core. See [1](#extractor).\n- Mono-Extractor; Targets Mono. See [2](#mono-extractor).\n\n### Extractor\n\n\u003e Compile and run the `Extractor` project!\n\nYou can get the .Net Core compilation tools through 2 channels; \n\nDownload the (CLI) binaries by downloading directly from [the site](https://www.microsoft.com/net/core).\nWhen using the dotnet CLI to build the project, make sure to **restore dependant packages first!**.\n\nWARN; The build artifact is a .dll file that cannot be executed by itself. To run the program it's required to start the dotnet runtime first; `dotnet extractor.dll [ARGUMENTS]`.\n\n*OR*\n\nUpdate your Visual Studio **2019** installation to include the `.Net Core cross-platform development`, which can be found under section `Other toolsets`.\n\nUsing Visual Studio 2019 is recommended because it handles dependancies and builds the project correctly for YOU. \nThere is a community version which is [free to install and use](https://www.visualstudio.com/).\n\n\n### Mono-Extractor\n\n\u003e Compile and run the `Mono-Extractor` project!\n\nYou can download the Mono tools from [their site](http://www.mono-project.com/download/). Their `msbuild` executable should automatically restore dependant packages.  \nThe resulting binary is called 'mono-extractor.exe'.\n\n# Usage\n\nCompile the program.\nGive it the library files you want to decompile and if you want proto2 or proto3 syntax.\n\nThe program can do the following actions automatically:\n\n* move types between namespaces according to manual config;\n* resolve circular dependancies;\n* resolve name collisions;\n* package types underneath a common namespace;\n* generates proto2/proto3 syntax output.\n\nBasic usage example: \n```bash\nextractor --libPath \"%HS_LOCATION%/Hearthstone_Data/Managed\" \n--outPath \"./proto-out\" \n\"%HS_LOCATION%/Hearthstone_Data/Managed/Assembly-CSharp.dll\" \n\"%HS_LOCATION%/Hearthstone_Data/Managed/Assembly-CSharp-firstpass.dll\" \n```\n\nExtended usage example:\n\n\u003e This command is used to generate protobuffer files for [HS proto repository](https://github.com/HearthSim/hsproto)\n\n```bash\nextractor --proto3 --debug --resolve-circular-dependancies --automatic-packaging --resolve-name-collisions --outPath \"./proto-out\" --libPath \"%HS_LOCATION%/Hearthstone_Data/Managed\" \"%HS_LOCATION%/Hearthstone_Data/Managed/Assembly-CSharp.dll\" \n\"%HS_LOCATION%/Hearthstone_Data/Managed/Assembly-CSharp-firstpass.dll\" \n```\n\n\u003e The section `Options` explains all parameters. The executable will write parameter parsing errors on standard outstream.\n\n## Options\n\n### Proto3\n\nThe option `--proto3` will use the proto3 compiler to generate .proto files with protobuffer 3 syntax.\n\nWARN; Proto3 syntax is more readable but less accurate. Use Proto2 syntax for emulation purposes.\n\n\u003e Defaults to False.\n\n### Resolve circular dependancies\n\nThe option `--resolve-circular-dependancies` will run a processor object that detects and solves circular dependancies for you. Both circular dependancies between types and namespaces are detected.\n\n\u003e Defaults to False.\n\n### Resolve name collisions\n\nThe option `--resolve-name-collisions` will run a processor object that detects and solves all kinds of name collisions for you. See the processor code for more details.\n\n\u003e Defaults to False.\n\n### Automatic packaging\n\nThe option `--automatic-packaging` will try to group namespaces under the same namespace if their names show similarities. The used algorithm is longest substring matching, with anchorpoint at the beginning of the string. Half-words are cut to the nearest namespace component.\n\n\u003e Defaults to False.\n\n### Manual packaging\n\nThe option `--manual-package-file \"PATH-TO-INI-FILE\"` can be used manually move content of namespaces or specific types to other/new namespaces. See the file `hscode-proto-packaging.ini` in the root of the repo for examples. \n\nIt's important to keep the order of processing algorithms in mind! We shouldn't try to manually compensate the behaviour of the automatic dependancy resolver. This has to do with trying to keep a consistent layout of outputted protobuffer files regarding the absolute dependancy on the source material.\n\n\u003e Defaults to \"\" (empty string) -\u003e nothing will happen.\n\n## Order of processing algorithms\n\nThe execution order of processing algorithms is always as follows:\n\n1. Manual packaging of namespaces;\n2. Resolve circular dependancies;\n2. Automatic packaging of namespaces;\n3. Resolving name collisions.\n\n# Binary proto extraction\n\n\u003e Use the `protobin_to_proto.py` file!\n\nAt the root of the repository you'll find a python3 script that extracts protobuffer files from arbitrary binary files. \n\n\u003e**This only works on proto files which have been compiled with the Google Protobuffer compiler tool (protoc)!** \nUse the proto-extractor project (see above) for hearthstone related proto files.\n\n## Setup\n\nThe only requirement for this script is the [Google Protobuffer package](https://pypi.python.org/pypi/protobuf) which you can install through pip. A quick setup guide is given below.\n\n1. Install virtualenv; `pip3 install virtualenv`\n2. Create a virtual environment inside the CWD; `py -3 -m virtualenv ./.env`\n3. Activate the environment; `./env/Scripts/activate`\n4. Install protobuf package; `pip install protobuf`\n\n# Usage\n\n1. Activate the venv which was setup in the previous section.\n2. Run the proto extraction script; `python protobin_to_proto.py -o [out-dir] [inputfile [inputfiles ..]]`\n3. Extracted proto files can be found inside [out-dir], the script will output any found, valid filename.\n\n# License\n\nProto-extractor is licensed under the terms of the MIT license.\nThe full license text is available in the `LICENSE` file.\n\n# Community\n\nproto-extractor is a [HearthSim](http://hearthsim.info) project. All development\nhappens on our IRC channel `#hearthsim` on [Freenode](https://freenode.net).\n\nContributions are welcome. Make sure to read through the `CONTRIBUTING.md` first.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhearthsim%2Fproto-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhearthsim%2Fproto-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhearthsim%2Fproto-extractor/lists"}