Last active
December 2, 2017 19:15
-
-
Save picatz/c0853cfb476d44a6a82d387b6bbfe2d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require "packetz" | |
# start a packet capture handler | |
cap = Packetz.capture(interface: Packetz.interfaces.default, snaplen: 65535, promisc: false, timeout_ms: 1) | |
# start capturing | |
cap.start! | |
# stop the capture with ctl+C | |
Signal::INT.trap do | |
puts "\nStopping!\n" | |
cap.stop! | |
exit | |
end | |
# with each packet | |
cap.each do |packet| | |
packet.each do |byte| | |
print "\033[38;5;#{byte.to_s}m█\033[0;00m" | |
end | |
# don't get sick | |
sleep 0.2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment