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

Linux post libs comments and specs #19682

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

h00die
Copy link
Contributor

@h00die h00die commented Nov 27, 2024

This PR does a few things for linux post libs:

  1. adds function comments
  2. adds specs
  3. creates a new packages module which can be used to check what version of a package is installed. Ubuntu needrestart LPE (CVE-2024-48990) #19676 (comment)
  4. rubocops the libraries

Copy link
Contributor

@cdelafuente-r7 cdelafuente-r7 left a comment

Choose a reason for hiding this comment

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

Thank you @h00die for adding documentation and specs. I just added a couple of comments.

lib/msf/core/post/linux/packages.rb Outdated Show resolved Hide resolved
return Rex::Version.new(package_version)
elsif ['redhat', 'fedora'].include?(info[:distro])
package_version = cmd_exec("rpm -q #{package}")
return nil if package_version.include?('is not installed')
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't tested it, but I'm wondering if rpm returns a message in English on a non-English installation.

This also applies to the system commands called in this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good thinking, I'm not sure

@h00die
Copy link
Contributor Author

h00die commented Nov 28, 2024

Appreciate, I'm going to get specs working for all the linux post libs before putting this up for official review. Good question about language though

lib/msf/core/post/linux/packages.rb Outdated Show resolved Hide resolved
lib/msf/core/post/linux/packages.rb Outdated Show resolved Hide resolved
@h00die
Copy link
Contributor Author

h00die commented Dec 2, 2024

While this is in draft, it's going to be a little bit of a headache, lots of stuff going on. prob not worth reviewing till its out of draft tbh

@h00die
Copy link
Contributor Author

h00die commented Dec 11, 2024

Ready for review, 5 tests are failing for more or less the same thing. @smcintyre-r7 was trying to help me with this, but I'll need more help getting session emulation working correctly.

Mocking the sleep commands is also prob a good idea to speed tests up in the busy_box module.

@h00die h00die marked this pull request as ready for review December 11, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants