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

some Ruby 2.4-ism's in the tree #8405

Closed
busterb opened this issue May 17, 2017 · 2 comments · Fixed by #8406
Closed

some Ruby 2.4-ism's in the tree #8405

busterb opened this issue May 17, 2017 · 2 comments · Fixed by #8406

Comments

@busterb
Copy link
Member

busterb commented May 17, 2017

Using Ruby 2.4 can be a little tricky - while that's the version we have in-tree and the one we package with omnibus, not everyone has upgraded yet, so a few things are broken in 2.3:

[05/17/2017 13:16:47] [e(0)] core: Unable to load module /root/metasploit-framework/modules/exploits/linux/smtp/haraka.py NoMethodError undefined method `match?' for #String:0x0055db7406e9d8

It looks like we're using String.match? in a few places that could be fairly easily converted to use String.match (I'm guilty of a couple, will fix tomorrow if someone doesn't beat me to it.)

lib/msf/core/exploit/powershell.rb:    return script_in unless script_in.match?(/FromBase64String/)
lib/msf/core/modules/external/bridge.rb:    module_name.match? /\.py$/
modules/exploits/linux/http/huawei_hg532n_cmdinject.rb:    if res.body.match? invalid_port_export_marker
modules/exploits/linux/http/huawei_hg532n_cmdinject.rb:          if result.match? regex
modules/exploits/linux/misc/quest_pmmasterd_bof.rb:    if res.match? "Pong4$"
@busterb
Copy link
Member Author

busterb commented May 18, 2017

I wonder if including https://github.com/marcandre/backports and calling it a day might be simpler and allow adopting newer idioms more quickly.

@busterb
Copy link
Member Author

busterb commented May 18, 2017

I added the backports Library above ^ which appears to fix the issue for Ruby 2.3. Any objections to this approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants