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

enum_psk: Cleanup #17283

Merged
merged 1 commit into from
Nov 22, 2022
Merged

enum_psk: Cleanup #17283

merged 1 commit into from
Nov 22, 2022

Conversation

bcoles
Copy link
Contributor

@bcoles bcoles commented Nov 20, 2022

Prior to this PR, the module used unintuitive method names, unnecessarily passed and returned complex objects to/from methods, passed variables to methods for no reason other than to return the variables later, and wrapped the entire run method in a is_root? and tbl.rows.empty? conditionals. This has been cleaned up.

Also:

  • Adds documentation
  • Adds notes
  • Resolves Rubocop violations
  • Replaces /bin/ls -1 #{dir} with dir method from Post library
  • Removes a useless TODO

There is a lot of room for improvement in this module. Ideally the module would be expanded to also capture other NetworkManager configuration information (including credentials, such as 802.1x creds). This is out of scope for this PR.


I used a dumb test file to test this:

# cat /etc/NetworkManager/system-connections/test 
asdf
psk=1234567890
asdf=asdf

@bcoles bcoles added module code quality Improving code quality labels Nov 20, 2022
@adfoster-r7
Copy link
Contributor

Worked for me with a dummy file from https://lauri.xn--vsandi-pxa.com/cfgmgmt/network-manager-system-connections.html - it even picked up the .swp file as an edge case, which wasn't intentional on my part

msf6 post(linux/gather/enum_psk) > run session=-1

[*] Reading file /etc/NetworkManager/system-connections//Wired connection 1
[*] Reading file /etc/NetworkManager/system-connections//.Wired connection 1.swp

802-11-wireless-security
========================

 AccessPoint-Name    PSK
 ----------------    ---
 Wired connection 1  salakala

Database creds stored correctly:

msf6 post(linux/gather/enum_psk) > creds
Credentials
===========

host  origin           service  public              private   realm  private_type  JtR Format
----  ------           -------  ------              -------   -----  ------------  ----------
      192.168.123.128           Wired connection 1  salakala         Password  

@adfoster-r7 adfoster-r7 merged commit 6446c14 into rapid7:master Nov 22, 2022
@adfoster-r7 adfoster-r7 added the rn-enhancement release notes enhancement label Nov 22, 2022
@adfoster-r7
Copy link
Contributor

Release Notes

Improves the linux/gather/enum_psk module, and adds documentation

@bcoles bcoles deleted the enum_psk branch November 22, 2022 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improving code quality module rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants