Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/spoof/replay/pcap_replay.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Capture78def initialize9super(10'Name' => 'Pcap Replay Utility',11'Description' => %q{12Replay a pcap capture file13},14'Author' => 'amaloteaux',15'License' => MSF_LICENSE16)1718register_options([19OptPath.new('FILENAME', [true, "The local pcap file to process"]),20OptString.new('FILE_FILTER', [false, "The filter string to apply on the file"]),21OptInt.new('LOOP', [true, "The number of times to loop through the file",1]),22OptInt.new('DELAY', [true, "the delay in millisecond between each loop",0]),23OptInt.new('PKT_DELAY', [true, "the delay in millisecond between each packet",0]),24])2526deregister_options('SNAPLEN','FILTER','PCAPFILE','RHOST','TIMEOUT','SECRET','GATEWAY_PROBE_HOST','GATEWAY_PROBE_PORT')27end2829def run30check_pcaprub_loaded # Check first31pkt_delay = datastore['PKT_DELAY']32delay = datastore['DELAY']33loop = datastore['LOOP']34infinity = true if loop <= 035file_filter = datastore['FILE_FILTER']36filename = datastore['FILENAME']37verbose = datastore['VERBOSE']38count = 039unless File.exist? filename and File.file? filename40print_error("Pcap File does not exist")41return42end43open_pcap44print_status("Sending file...") unless verbose45while (loop > 0 or infinity) do46vprint_status("Sending file (loop: #{count = count + 1})")47inject_pcap(filename, file_filter, pkt_delay )48loop -= 1 unless infinity49Kernel.select(nil, nil, nil, (delay * 1.0)/1000) if loop > 0 or infinity50end51close_pcap52end53end545556