Skip to content

Small optimizations#44

Merged
jeFF0Falltrades merged 12 commits into
jeFF0Falltrades:masterfrom
CAPESandbox:small_optimizations
May 23, 2026
Merged

Small optimizations#44
jeFF0Falltrades merged 12 commits into
jeFF0Falltrades:masterfrom
CAPESandbox:small_optimizations

Conversation

@doomedraven
Copy link
Copy Markdown
Contributor

No description provided.

@doomedraven
Copy link
Copy Markdown
Contributor Author

any idea why tests are skipped?

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the configuration parsing and decryption logic, introducing optimizations for metadata lookups and support for multiple AES metadata candidates. Key changes include the extraction of decryption and remapping logic into dedicated methods, the use of bisect for faster method lookups in dotnetpe_payload.py, and a more robust string decryption process that tracks successful keys. Review feedback focuses on further optimizing method lookups by token, restoring type hints, and ensuring correct string formatting when appending list values during configuration remapping.

Comment thread src/rat_king_parser/config_parser/rat_config_parser.py Outdated
Comment thread src/rat_king_parser/config_parser/utils/dotnetpe_payload.py
Comment thread src/rat_king_parser/config_parser/utils/dotnetpe_payload.py Outdated
doomedraven and others added 5 commits May 18, 2026 07:47
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…yptor_aes_with_iv.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Added checks for metadata presence and improved error handling when accessing tables in dotnetpe.
@doomedraven
Copy link
Copy Markdown
Contributor Author

from my tests on my side is nearly 50% faster now. please review when you can

@jeFF0Falltrades
Copy link
Copy Markdown
Owner

any idea why tests are skipped?

It's because this is coming from a forked repo - GitHub Actions does not expose repository secrets (like the samples ZIP password) to fork PRs, so the malware sample decryption step would fail anyway.

That said, it will run once we pull it into the main repo and I can run it on my end locally!

@jeFF0Falltrades
Copy link
Copy Markdown
Owner

Love it! There are some small modifications I saw in review that I'd like to implement, but because this is on your fork, I can't write them onto this one, so I'm going to merge this, open up a new PR, and then feel free to pull in those changes at your leisure.

Thank you as ever for the optimizations <3

@jeFF0Falltrades jeFF0Falltrades merged commit ba9fc9b into jeFF0Falltrades:master May 23, 2026
1 check passed
jeFF0Falltrades added a commit that referenced this pull request May 23, 2026
PR #44 introduced a `successfully_decrypted_count == 0` guard at the end
of `decrypt_encrypted_strings` that raises if no string was successfully
decrypted. For template/builder samples (e.g. unconfigured AsyncRAT
builds where every config value is a placeholder like `%Anti%`), every
value fails the b64/length filter and is passed through unchanged
without any decryption being attempted. The guard then raised, causing
`_attempt_decryption` to discard the AES decryptor and fall through to
the plaintext decryptor, which has no salt -- so `report["salt"]` was
reported as "None" instead of the actual extracted salt.

Track attempted decryptions separately and only raise when at least one
string was actually attempted but every attempt failed. Template samples
have zero attempts and now fall through cleanly with the AES decryptor
intact, restoring the master behavior of reporting the salt.

Verified against all 14 known sample expected outputs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jeFF0Falltrades
Copy link
Copy Markdown
Owner

@doomedraven There was a small regression I fixed in #45 - Feel free to pull that in to your fork, and let me know if you have any questions!

@doomedraven doomedraven deleted the small_optimizations branch May 24, 2026 10:41
@doomedraven
Copy link
Copy Markdown
Contributor Author

thank you

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

Successfully merging this pull request may close these issues.

2 participants