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

Add support for multi-line regexs to ronin grep and ronin extract #190

Open
postmodern opened this issue Jan 23, 2024 · 2 comments
Open
Labels
command Ronin Command command-option A command option enhancement Enhancement to existing code

Comments

@postmodern
Copy link
Member

postmodern commented Jan 23, 2024

Support for matching multi-line regexps to the ronin grep and ronin extract commands. Currently multi-line regexps such as the --ssh-private-key option do not work properly.

@postmodern postmodern added enhancement Enhancement to existing code command Ronin Command command-option A command option labels Jan 23, 2024
@postmodern
Copy link
Member Author

Options such as --ssh-private-key, defined in Ronin::CLI::PatternOptions (lib/ronin/cli/pattern_options.rb), should implicitly enable the multi-line mode. Then the process_input methods of the Grep and Extract commands should switch to reading the entire file, instead of processing each line.

@postmodern
Copy link
Member Author

We could also automatically check if the regexp is multi-line and enable multi-line mode:

lib/ronin/cli/pattern_options.rb:

def multiline?
  (@pattern.options & Regexp::MULTILINE) > 0
end

lib/ronin/cli/commands/grep.rb:

def process_input(input)
  if multiline?
    ...
  else
    ...
  end
end

@postmodern postmodern changed the title Add an option to ronin grep and ronin extract for multi-line regexps Add support for multi-line regexs to ronin grep and ronin extract Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command Ronin Command command-option A command option enhancement Enhancement to existing code
Projects
None yet
Development

No branches or pull requests

1 participant