Skip to content

Xpl0itR/protodec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protodec

A tool to derive Protobuf schemas from protoc output formats.

Usage

Usage: [command] [arguments...] [options...] [-h|--help] [--version]

Derive Protobuf schemas by reflecting target CIL assembly and its dependencies to parse classes generated by protoc with the "csharp_out" option.

Arguments:
  [0] <string>    Either the path to the target assembly or a directory of assemblies, all of which be loaded for reflection.
  [1] <string>    An existing directory to output into individual files, otherwise output to a single file.

Options:
  --target-assembly-name <string?>                              Override/Specify the name of the assembly to parse. [Default: null]
  --parse-service-servers                                       Parses gRPC service definitions from server classes.
  --parse-service-clients                                       Parses gRPC service definitions from client classes.
  --skip-enums                                                  Skip parsing enums and replace references to them with int32.
  --include-properties-without-non-user-code-attribute          Includes properties that aren't decorated with `DebuggerNonUserCode` when parsing.
  --include-service-methods-without-generated-code-attribute    Includes methods that aren't decorated with `GeneratedCode("grpc_csharp_plugin")` when parsing gRPC services.
  --require-generated-code-attribute-for-properties             Requires properties to be decorated with `GeneratedCode("protoc")` to be parsed.
  --log-level <LogLevel>                                        Logging severity level. [Default: Information]

Commands:
  il2cpp    Derive Protobuf schemas by reflecting target IL2CPP compiled assembly to parse classes generated by protoc with the "csharp_out" option.

See per-command help message for more info.

Limitations

  • Integers are assumed to be (u)int32/64 as CIL doesn't differentiate between them and sint32/64 and (s)fixed32/64.
  • Package names are not preserved in protobuf compilation so naturally we cannot recover them during decompilation, which may result in naming conflicts.
  • When decompiling from Il2CppDumper DummyDLLs or from an IL2CPP assembly older than metadata version 29, due to the development branch of LibCpp2Il not yet recovering method bodies
    • The Name parameter of OriginalNameAttribute is not parsed. In this case, the CIL enum field names are used after conforming them to protobuf conventions.
    • The Tool parameter of GeneratedCodeAttribute is not compared against when parsing gRPC service methods, which may cause false positives in the event that another tool has generated methods in the service class.

Building

Essentially just replicate the CI instructions.

License

This project is subject to the terms of the Mozilla Public License, v. 2.0.