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

initial commit of BinaryNinja import script #205

Closed
wants to merge 2 commits into from

Conversation

psifertex
Copy link
Contributor

Just the import script for now. One feature I did add that might be worth pulling into the IDA script is to attempt to first load a .js or .json version of the exectuable/dll automatically if it exists since that seems like a common naming convention for capa outputs.

Two remaining (larger!) tasks are to implement a replacement for the vivisect analysis since that would provide python3 support, and then of course an implementation of the full IDA plugin for BN.


def load_analysis(bv):
#not that I expect many files with multiple periods but why not
shortname = '.'.join(os.path.basename(bv.file.filename).split(".")[0:-1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that's a good suggestion, cleaner. Thanks.

log_info("ok")


PluginCommand.register("Load CAPA file", "Loads an analysis file from capa", load_analysis)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: capa not CAPA since its not an acronym or anything.


This script will verify that the report matches the workspace.
Check the log window for any errors, and/or the summary of changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

would you like to add your handle here for recognition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, thanks. Will amend.

Copy link
Collaborator

@williballenthin williballenthin left a comment

Choose a reason for hiding this comment

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

this is awesome!

@williballenthin
Copy link
Collaborator

this is ready to merge. @psifertex if you want to add your handle, please do! let me know when i should press "merge".

Derived from: https://github.com/fireeye/capa/blob/master/scripts/import-to-ida.py
"""
import json
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

style: order by line length, so use this:

import os
import json

@psifertex
Copy link
Contributor Author

I'm bad at GH PR modification so I"m just closing this and re-submitting with the requested changes. :-)

@psifertex psifertex closed this Jul 26, 2020
@Ana06
Copy link
Member

Ana06 commented Jul 27, 2020

@psifertex

I'm bad at GH PR modification so I"m just closing this and re-submitting with the requested changes. :-)

What is the problem exactly? Maybe we can help 😉

@psifertex
Copy link
Contributor Author

I was under the impression that merely pushing to my fork and would update the PR but that didn't appear to be the case? I started to create a PR and saw it was just going to make a fresh one in addition to the prior one. Maybe I should have ignored it and continued the process?

@Ana06
Copy link
Member

Ana06 commented Jul 28, 2020

@psifertex

I was under the impression that merely pushing to my fork and would update the PR but that didn't appear to be the case?

That should be exactly the case. In fact, this PR has exactly the same commits as the new one you open. I think it worked. You may need to reload the page to see the new changes. GitHub shows a refresh message/button but doesn't update the code without reloading the page.

If you add changes to an already pushed commit (for example using git commit --amend after having fixed black offenses), you need to use the git --force option (or --force-with-lease to ensure you don't destroy other people's commits if you are not the only one pushing to that branch).

@psifertex
Copy link
Contributor Author

Yup, I first tried the amend commit option but didn't see anything on the PR page when I checked it. Probably the case that I needed to do a forced reload of the page. Thanks, good to know I was on the right track. Next time I won't give up so easily. :-)

Also, thanks for catching the other bug that crept in on the first line. vim motion leftover that snuck in after testing.

@williballenthin williballenthin added this to the v1.1.0 milestone Aug 4, 2020
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.

None yet

3 participants