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

Autoinstall frida devkits #5

Merged
merged 10 commits into from
Mar 7, 2021
Merged

Conversation

s1341
Copy link
Contributor

@s1341 s1341 commented Mar 4, 2021

This PR implements automatic download and installation of the neccessary frida devkits.

At the moment, the download_and_uncompress_devkit is copied to both frida-gum-sys/build.rs and frida-sys/build.rs, so that they are independent.

Tested and working.

@s1341
Copy link
Contributor Author

s1341 commented Mar 4, 2021

Looks like the CI is failing, because it does the same thing... it downloads and installs the devkits. I recommend dropping that from the CI script.

@meme
Copy link
Collaborator

meme commented Mar 5, 2021

Thank you for the PR. I have a few issues with this change, though. Firstly, I am not a fan of downloading and installing arbitrary code without user consent during the build process. I would be OK, however, if we required the user to specify an environment variable during cargo build like FRIDA_ENABLE_DOWNLOAD which must be set. Then in the READMEs for the crates we can add this note, otherwise the user can install the devkit manually.

Secondly, the code duplication here is a bit unfortunate. Especially since we would now have compatible Frida version numbers in the READMEs and these build scripts which is tedious to update. If possible, see if you can pull the download_and_uncompress_devkit function out into a new crate called frida-build in the root (or something similar) and make it a build dependency of both crates. Then we can make a file in the root of the repository called FRIDA_VERSION which contains a string like 14.2.3 and is include_bytes!'d in the dependent crates. This way, when I make a release I just have to edit a single file.

Please let me know what you think and we can get this merged.

@s1341
Copy link
Contributor Author

s1341 commented Mar 5, 2021

Ok.

I hear what you are saying about the download. Can I recommend that instead of an environment variable we use a feature flag? This will make it easier to include this crate in other packages?

About the code duplication. I totally agree: it stinks. I just wanted to get something working. I will create the frida-build crate as you recommend.

@s1341
Copy link
Contributor Author

s1341 commented Mar 5, 2021

Implemented your suggestions. At the moment I've made the "autodownload" feature flag default. We can change that if you want.

Ready to merge from my perspective.

@s1341 s1341 force-pushed the autoinstall_frida_devkits branch from c4f60ab to f8cef76 Compare March 5, 2021 11:31
Copy link
Collaborator

@meme meme left a comment

Choose a reason for hiding this comment

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

Looks good, but please make autodownload be called auto-download and not the default behaviour. Then define the same feature in both frida and frida-gum so that downstream crates can enable it. (see the others for an example)

@@ -219,6 +219,7 @@
#define g_assertion_message_cmpstrv _frida_g_assertion_message_cmpstrv
#define g_assertion_message_error _frida_g_assertion_message_error
#define g_assertion_message_expr _frida_g_assertion_message_expr
#define g_assertion_set_handler _frida_g_assertion_set_handler
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please uncheck this file from this PR. I updated Frida recently and this appears to be the old one?

@s1341
Copy link
Contributor Author

s1341 commented Mar 6, 2021

I'll get to your request tomorrow.

I have some other questions I'd like to ask. Are you available on IRC/discord/twitter somewhere we could chat a bit?

@meme
Copy link
Collaborator

meme commented Mar 6, 2021

Sure, keegan on irc.gnome.org.

@s1341 s1341 force-pushed the autoinstall_frida_devkits branch from a911790 to a06d7a4 Compare March 7, 2021 08:54
@s1341
Copy link
Contributor Author

s1341 commented Mar 7, 2021

Implemented your suggested changes.

@meme
Copy link
Collaborator

meme commented Mar 7, 2021

Thanks!

@meme meme merged commit 4e96b4f into frida:master Mar 7, 2021
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

2 participants