Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是不是少了一点? #8

Open
Dilettante258 opened this issue Sep 24, 2024 · 1 comment
Open

是不是少了一点? #8

Dilettante258 opened this issue Sep 24, 2024 · 1 comment

Comments

@Dilettante258
Copy link

string cookie = 25;
uint32 pn = 26;
uint32 is_twzhibo = 28;
int32 scr_w = 29;

缺了个

CommonReq common = 27;

我最近在重构项目将会从你的repo里面引用一些proto文件,感谢了。

@n0099
Copy link
Owner

n0099 commented Sep 24, 2024

看branchtbclient不要看main
https://github.com/n0099/tbclient.protobuf/blame/tbclient/proto/UserPost/DataReq.proto#L31-L32
https://github.com/n0099/tbclient.protobuf/blame/9eabdc71110125a93461adeae3505baa06b66a78/java/UserPost/DataReq.java#L61-L64
jadx将其重命名 https://github.com/skylot/jadx/blob/b5e3dcf70fb388c46e27c2acd3411e7bc52eb2d4/jadx-core/src/main/java/jadx/core/codegen/utils/CodeGenUtils.java#L114 https://github.com/skylot/jadx/blob/b5e3dcf70fb388c46e27c2acd3411e7bc52eb2d4/jadx-core/src/main/java/jadx/core/dex/visitors/rename/RenameVisitor.java#L235f64788common并插了行注释(根据 https://github.com/skylot/jadx/blob/b5e3dcf70fb388c46e27c2acd3411e7bc52eb2d4/jadx-core/src/main/java/jadx/core/codegen/utils/CodeGenUtils.java#L111 https://github.com/skylot/jadx/blob/b5e3dcf70fb388c46e27c2acd3411e7bc52eb2d4/jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java#L244-L249 可以用高于info--comments-level关)导致这个regex不匹配

preg_match_all('/\s*@ProtoField\((label = Message.Label.(?<label>.*?), |)tag = (?<id>\d+)(, type = Message\.Datatype\.(?<type>.*?)|)\)\s*public final (?<javaType>.*?) (?<name>.*?);/', $file, $fieldMatches, PREG_SET_ORDER);
image
更好的是换个 https://github.com/javaparser/javaparser 来处理ast而非拿regex锤子 https://en.wikipedia.org/wiki/Law_of_the_instrument 钉字符串钉子 https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 https://z.n0099.net/#narrow/near/87047
但即便大脑升级ast也无法把f64788common变回common除非又写regex来对其f\d+(\w+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants