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

Open
wants to merge 1 commit into
base: master
Choose a base branch
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()

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

Successfully merging this pull request may close these issues.

2 participants