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 new module: Pcap OT/IOT analyzer #19481

Closed
wants to merge 1 commit into from

Conversation

jubachm
Copy link

@jubachm jubachm commented Sep 19, 2024

Tell us what this change does. If you're fixing a bug, please mention
the github issue number.

Please ensure you are submitting from a unique branch in your repository to master in Rapid7's.

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • use exploit/windows/smb/ms08_067_netapi
  • ...
  • Verify the thing does what it should
  • Verify the thing does not do what it should not
  • Document the thing and how it works (Example)

If you are opening a PR for a new module that exploits a specific piece of hardware or requires a complex or hard-to-find testing environment, we recommend that you send us a demo of your module executing correctly. Seeing your module in action will help us review your PR faster!

Specific Hardware Examples:

  • Switches
  • Routers
  • IP Cameras
  • IoT devices

Complex Software Examples:

  • Expensive proprietary software
  • Software with an extensive installation process
  • Software that requires exploit testing across multiple significantly different versions
  • Software without an English language UI

We will also accept demonstrations of successful module execution even if your module doesn't meet the above conditions. It's not a necessity, but it may help us land your module faster!

Demonstration of successful module execution can take the form of a packet capture (pcap) or a screen recording. You can send pcaps and recordings to [email protected]. Please include a CVE number in the subject header (if applicable), and a link to your PR in the email body.
If you wish to sanitize your pcap, please see the wiki.

Comment on lines +37 to +50
unless File.exist?(datastore['FILE_PCAP']) && File.extname(datastore['FILE_PCAP']) == '.pcap'
print_error("Invalid or non-existent PCAP file: #{datastore['FILE_PCAP']}")
return
end

unless File.exist?(datastore['FILE_PORT']) && File.extname(datastore['FILE_PORT']) == '.txt'
print_error("Invalid or non-existent port file: #{datastore['FILE_PORT']}")
return
end

if File.exist?(datastore['FILE_OUT'])
print_error("Output file already exists: #{datastore['FILE_OUT']}")
return
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of print_error for each of these you should use fail_with(Failure::BadConfig, ...

pkt = PacketFu::Packet.parse(packet)
next unless pkt.is_ip?

timestamp = Time.at(packet.timestamp.to_f).strftime('%y/%m/%d - %H:%M:%S')
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we switch this to the ISO8601 format please? it's YYYY-MM-DDTHH:MM:SS IIRC.

Suggested change
timestamp = Time.at(packet.timestamp.to_f).strftime('%y/%m/%d - %H:%M:%S')
timestamp = Time.at(packet.timestamp.to_f).strftime()

@jmartin-tech
Copy link
Contributor

PCAP is already a supported import format that in theory, can populate the database (although I have not tested it recently). This module seems better suited as a standalone tool as it does not really take advantage of anything provided by msf rather it preforms an ETL of a PCAP into a specific CSV format using PacketFu which can be used as a standalone gem.

A useful enhancement for msf might be to be have this CSV format be added to the db_export supported formats for a host data only export. Currently only xml for the full dataset and pwdump for extracted passwords formats are supported.

@jheysel-r7
Copy link
Contributor

A useful enhancement for msf might be to be have this CSV format be added to the db_export supported formats for a host data only export. Currently only xml for the full dataset and pwdump for extracted passwords formats are supported.

Thanks for the input Jeffrey! I'd agree that might be a more useful enhancement for the framework.

@jubachm would you be interested in attempting to make those suggested changes? We'd be happy to help.

@smcintyre-r7 smcintyre-r7 added the attic Older submissions that we still want to work on again label Mar 12, 2025
Copy link

Thanks for your contribution to Metasploit Framework! We've looked at this pull request, and we agree that it seems like a good addition to Metasploit, but it looks like it is not quite ready to land. We've labeled it attic and closed it for now.

What does this generally mean? It could be one or more of several things:

  • It doesn't look like there has been any activity on this pull request in a while
  • We may not have the proper access or equipment to test this pull request, or the contributor doesn't have time to work on it right now.
  • Sometimes the implementation isn't quite right and a different approach is necessary.

We would love to land this pull request when it's ready. If you have a chance to address all comments, we would be happy to reopen and discuss how to merge this!

@github-actions github-actions bot closed this Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attic Older submissions that we still want to work on again
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants