Replies: 1 comment
-
|
Another interesting class of shell scripts to identify: CMake-generated .sh installers, and potentially automate extraction of files in them without running the script |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Could be used for building an info extractor that tries to figure out what a bash script is. Mainly, it tries to answer this question:
What open-source software projects are developed primarily in Bash, and what specific characteristics or identifying features like naming conventions, function names, and comments could we look for to determine whether an arbitrary Bash script we come across comes from one of those open-source Bash projects?
NVM
-look for its filepath: ~/.nvm/nvm.sh
-open/read the file and look for function names like nvm_command_info() & nvm()
-check for header comment stating Node Version Manager
-other heuristics
Pyenv
-libexec/pyenv is the main script that calls the subcommand scripts.
-Look for variables like PYENV_ROOT, PYENV_DIR, PYENV_HOOK_PATH
-function names like abs_dirname() & abort()
scripts: https://github.com/rbenv/rbenv/tree/master/libexec
-Look for env variables & strings like RBENV_ROOT, RBENV_DIR, RBENV_HOOK_PATH, RBENV_ORIG_PATH, RBENV_DEBUG, rbenv---version
-scripts: https://github.com/rvm/rvm/tree/master/bin
chruby
Main script: https://github.com/postmodern/chruby/tree/master/share/chruby
-look for string CHRUBY_VERSION="*" and function names chruby_reset(), chruby_use(), chruby()
-env vars RUBY_ROOT, RUBY_ENGINE, RUBY_VERSION, RUBYOPT, GEM_ROOT
asdf
-Look for ASDF_DIR, ASDF_DATA_DIR, ASDF_FORCE_PREPEND, _asdf_should_prepend, and function name asdf(), file name asdf.sh
GVM (go version manager)
-Look for env variables & strings like GVM_ROOT, GVM_DEBUG, GVM_ROOT/scripts/gvm-check
-Look for env variables & strings like “# Copyright 2021 Marco Vermeulen”, SDKMAN_DIR, SDKMAN_PLATFORM, __sdkman_complete_candidate_version
-Function names sdk(), ___sdkman_help(), __sdkman_complete_command()
-Main scripts: https://github.com/nodenv/nodenv/tree/main/libexec
-Look for env variables & strings like NODENV_DEBUG, NODENV_ROOT, NODENV_DIR, NODENV_HOOK_PATH
-Main scripts: https://github.com/jenv/jenv/tree/master/libexec
-Look for env variables & strings like JENV_DEBUG, JENV_ROOT, JENV_DIR
-- Function names: _jenv(), abs_dirname(), resolvepath(), samedir()
Beta Was this translation helpful? Give feedback.
All reactions