Xpl0itR / protodec

A tool to decompile protoc compiled protobuf classes back into .proto definitions.
Mozilla Public License 2.0
46 stars 2 forks source link

Android DummyDLL, generated proto contains a lot of duplicate messages #3

Closed david8557 closed 2 months ago

david8557 commented 3 months ago

Hello, First of all, thank a lot for your great tool. But I have this error, I hope you can look at it when you are free. I use command protoc.exe DummyDll test.proto The output file contains a lot of duplicate message, for example: message CharDBInfo, message PictorialBookDBInfo, ... Here is download link for DummyDLL https://zippyshare.day/EPFjEE20uJ5M3j8/file

Xpl0itR commented 3 months ago

Hi there, thank you for reporting this issue, i have been able to reproduce it and have also noticed the obfuscation warnings. I will look into these two issues when time permits.

Xpl0itR commented 3 months ago

I've taken a look and i'm not sure if its some kinda obfuscation or incompetence, but there is a bunch of Proto.Design.pack#### namespaces each with the same protos. taking BattleDeckTable as an example: pack1 has it defined properly with it's Id fields, but then in pack2 its defined again, hence the duplicate message in the protodec output, but missing the Id fields, hence the obfuscation warning and empty body.

As an aside, i noticed this is an il2cpp app that doesnt have the protobuf reflection classes stripped. I would appreciate if you could tell me the name so that i can use it as a reference for future development

david8557 commented 3 months ago

Hi Xpl0itR, thank you for looking into this problem. Maybe we can add option to dump only proto from specific namespaces? I think that will help us deal with these cases.

Xpl0itR commented 2 months ago

@david8557 i dont think that would help. For example if there is MsgA & MsgB in Ns1 and MsgC & MsgA in Ns2, dumping only Ns1 will have MsgC missing, dumping only Ns2 will have MsgB missing, and dumping both Ns1 & Ns2 will have a duplicate of MsgA.

I think for your case, you will need to make your own modification that removes duplicates.

david8557 commented 2 months ago

Thank you! I will make my own modification here to deal with this problem.

Xpl0itR commented 2 months ago

If you are comfortable doing so, I would appreciate if you would post your solution once you are done so that if in the future another user comes across the same issue, they have something to work with.

david8557 commented 2 months ago

I modify code to dump only namespace I need, so it fix my problem

logger.LogInformation("Parsing Protobuf message types...");
foreach (ICilType message in loader.GetProtobufMessageTypes())
{
    if (filter_namespace != string.Empty)
    {
        if (!message.Namespace.Contains(filter_namespace))
            continue;
    }

    ctx.ParseMessage(message, options);
}