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 method for returning the version information for each scan engine #212

Merged
merged 4 commits into from
Apr 6, 2016

Conversation

Red5d
Copy link
Contributor

@Red5d Red5d commented Mar 31, 2016

No description provided.


versions << engdata
end

Choose a reason for hiding this comment

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

Trailing whitespace detected.

@gschneider-r7
Copy link
Contributor

Hi @Red5d, thank you for the contribution! This looks handy so we'll take a look at it today.

In the mean time it would be nice to see a description, or at least an example of what using this looks like, for the benefit of others that aren't familiar with the output being parsed here. Not a blocker to getting this merged, though!

@Red5d
Copy link
Contributor Author

Red5d commented Apr 2, 2016

@gschneider-r7 Sure, do you want the example in the comments above the code?

eng.split(/\n/).each do |kv|
key, value = kv.split(/:\s*/)
key = key.sub('Local Engine ', '').sub('Remote Engine ', '')
if key != 'VERSION INFORMATION'
Copy link
Contributor

Choose a reason for hiding this comment

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

i think for this i'd rather see the following:
next if key == 'VERSION INFORMATION'
or we could just gsub out 'VERSION INFORMATION' from the string.
Since we know it should always be in the string, and we know we don't want it, it might be easier to just gsub it out, and avoid the if statement all together.

But either way thank you for this @Red5d , this is pretty awesome that you took the time to submit the PR!

def engine_versions
info = console_command('version engines')
versions = []
engines = info.sub("VERSION INFORMATION\n", "").split(/\n\n/)

Choose a reason for hiding this comment

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

Prefer single-quoted strings when you don't need string interpolation or special symbols.

@Red5d
Copy link
Contributor Author

Red5d commented Apr 5, 2016

@sgreen-r7 , I've changed the if statement to a .sub

@sgreen-r7
Copy link
Contributor

radical! thank you @Red5d we'll probably go ahead and merge this in, and release it tomorrow - 4/6

@gschneider-r7 gschneider-r7 merged commit 9308ca1 into rapid7:master Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants