Last active
June 13, 2024 22:47
-
-
Save kntyskw/5231182 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'packetfu' | |
dev = ARGV[0] | |
mac=`ip link show #{dev} | awk '/ether/ {print $2}'` | |
ARGV.shift | |
dests = ARGV | |
cap = PacketFu::Capture.new( | |
:timeout => 4000, | |
:iface => dev, :start => true, | |
:filter => "ether src #{mac} and ether[0] & 1 = 1") | |
loop do | |
cap.stream.each do |pkt| | |
frame = PacketFu::IPPacket.parse(pkt) | |
i = 0 | |
dests.each do |dest| | |
frame.eth_daddr = dest | |
frame.ip_header.ip_id = frame.ip_header.ip_id + i | |
frame.ip_header.ip_sum = frame.ip_header.ip_calc_sum() | |
frame.to_w(dev) | |
i = i + 1 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment