Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Draft implementation: new subcommand for computing obfuscation map#850

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
fbbdev wants to merge1 commit intoburrowers:master
base:master
Choose a base branch
Loading
fromfbbdev:master

Conversation

@fbbdev
Copy link

@fbbdevfbbdev commentedMay 13, 2024
edited
Loading

This PR provides a draft implementation for the proposal described at#849.

Thetransformer.transformGoFile method contains some code that computes the obfuscated identifier for a giventypes.Object.

This patch does essentially two things:

  1. it refactors thetransformer.transformGoFile method, lifting the code segment mentioned above into an independently callable method namedtransformer.obfuscateObjectName;
  2. it adds a new subcommandgarble map that uses the newly added methodtransformer.obfuscateObjectName to compute the output described atsupport Wails with its use of reflection on types #849.

The refactoring step is necessary to ensure thegarble map command stays in sync with the algorithm used bytransformGoFile.

I have not added a test yet because I am not familiar with the scripting language and it is also not entirely clear to me what the best approach would be for testing the new command.

The implementation of the new command resembles vaguely that of thereverse subcommand:

  • it lists all packages provided on the command line, including transitive dependencies;
  • for each listed andobfuscated package:
    • it configures a transformer instance, parses and typechecks package files, loads the package cache entry and computes field-to-struct mappings;
    • it visits the full syntax tree looking for identifiers, skipping statements because local identifiers are not relevant here;
    • for each identifier it encounters:
      • it uses type info to resolve the identifier to itstypes.Object;
      • it discards invalid identifiers, objects from other packages and duplicates;
      • it callstransformer.obfuscatedObjectName on the current object;
      • it usesgolang.org/x/tools/go/types/objectpath to compute a path for the current object;
      • if the current object is obfuscated and has a path, it is recorded onto the result map.
  • finally, it converts the result map to JSON.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@fbbdev

[8]ページ先頭

©2009-2025 Movatter.jp