Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.

const_string_encryption: Don't create/modify static constructor when there's no code to add#96

Merged
ClaudiuGeorgiu merged 1 commit intoClaudiuGeorgiu:masterfrom
techee:string_fix
May 17, 2021
Merged

const_string_encryption: Don't create/modify static constructor when there's no code to add#96
ClaudiuGeorgiu merged 1 commit intoClaudiuGeorgiu:masterfrom
techee:string_fix

Conversation

@techee
Copy link
Copy Markdown
Contributor

@techee techee commented May 16, 2021

Right now, even when there's no static string in a class, obfuscapk adds a static
constructor (which is empty because there's no decryption code to add) and every
single class in a project is modified because of this.

This patch skips adding the static constructor when there's no code to add
so only classes with static strings are modified.

I'm not sure how to run the unit tests so I don't know if they pass or not.

…there's no code to add

Right now, even when there's no static string in a class, obfuscapk adds a static
constructor (which is empty because there's no decryption code to add) and every
single class in a project is modified because of this.

This patch skips adding the static constructor when there's no code to add
so only classes with static strings are modified.
lines[static_constructor_line + 1] = "\t.locals 1\n"
lines[static_constructor_line + 2] = "\n{0}".format(
static_string_encryption_code
if static_string_encryption_code != "":
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if is actually the only change, the rest is just indentation.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2021

Codecov Report

Merging #96 (11fba43) into master (4072b6d) will decrease coverage by 0.15%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
- Coverage   77.73%   77.57%   -0.16%     
==========================================
  Files          49       49              
  Lines        2452     2453       +1     
  Branches      485      486       +1     
==========================================
- Hits         1906     1903       -3     
- Misses        417      422       +5     
+ Partials      129      128       -1     
Impacted Files Coverage Δ
...const_string_encryption/const_string_encryption.py 85.29% <25.00%> (-3.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4072b6d...11fba43. Read the comment docs.

@ClaudiuGeorgiu ClaudiuGeorgiu merged commit 8637197 into ClaudiuGeorgiu:master May 17, 2021
@ClaudiuGeorgiu
Copy link
Copy Markdown
Owner

Thanks @techee!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants