Skip to content

Conversation

@xukunzh
Copy link
Owner

@xukunzh xukunzh commented Jun 23, 2025

Done:

  1. Integrate FridaExtractor into capa
  2. Add arguments

Copy link
Collaborator

@mike-hunhoff mike-hunhoff left a comment

Choose a reason for hiding this comment

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

Nice work, I've left a couple of comments for your review

"process_id": Process.id,
"thread_id": Process.getCurrentThreadId(),
"call_id": call_id,
"call_id": call_id - 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why minus 1?

Copy link
Owner Author

@xukunzh xukunzh Jun 25, 2025

Choose a reason for hiding this comment

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

call_id++ happens in recordApiCall(), so when debugLog() is called after it, we need to subtract 1 to get the actual call_id.
debugLog() only used to debug, I just noticed this mistake.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm this could introduce a very subtle bug where the ++ and - 1 become out of sync, resulting in the incorrect call_id value getting logged. Can we pass the appropriate call_id value to this function? Or pass and use information from the API call record?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh, you're right. I'll go with passing the call_id value, it is cleaner.

Copy link
Owner Author

@xukunzh xukunzh Jun 25, 2025

Choose a reason for hiding this comment

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

Ah oh~ I found a simpler solution. I can just put debugLog() before recordApiCall() in each hook, and no need to minus 1 now.

recordApiCall() is the actual production code, I think it's better to keep it unchanged.

var apiCallRecord = {
"process_id": Process.id,
"thread_id": Process.getCurrentThreadId(),
"call_id": call_id++,
Copy link
Collaborator

Choose a reason for hiding this comment

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

similar to @mike-hunhoff comment below, I'm not very comfortable with the self-increment here. It is very error-prone when program get bigger.

But since this script is going to be auto-generated. We can leave it for now until you get your FridaScript generation script.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Got it now! So the point is to centralize the ID increment management instead of letting any individual method control it.

@xukunzh xukunzh merged commit 25bd5c0 into master Jun 27, 2025
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.

4 participants