Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 884d3de922
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (19 sloc) 0.724 kb
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__))))
require 'packetfu'
require 'unimidi'
require 'log_parser/log'
cap = PacketFu::Capture.new(:iface => "en0", :start => true, :filter => "ip") # Line 1, set up the capture object.
output = UniMIDI::Output.use(:first)
while true
cap.stream.each do |p|
packet = PacketFu::Packet.parse(p) # Line 3, loop the capture forever, parsing packets.
if packet.is_tcp?
note = packet.tcp_dst / 517
puts "#{Time.now}: %s:%s -> %s:%s [%s]" %
[packet.ip_saddr,packet.tcp_src, packet.ip_daddr, packet.tcp_dst, note]
output.puts(0x90, note, 127) # note on message
sleep 0.1 # wait
output.puts(0x80, note , 127) # note off message
end
end
end
Jump to Line
Something went wrong with that request. Please try again.