Last active
November 15, 2017 20:03
-
-
Save picatz/86ff283d234c6824c6e02557097ff08f to your computer and use it in GitHub Desktop.
Get interface to listen on
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
@[Link("pcap")] | |
lib LibPcap | |
PCAP_ERRBUF_SIZE = UInt8.new(256) | |
fun pcap_lookupdev(errbuf : LibC::Char* ) : LibC::Char* | |
end | |
err = LibPcap::PCAP_ERRBUF_SIZE.dup | |
dev = LibPcap.pcap_lookupdev(pointerof(err)) | |
raise Exception.new("Couldn't find a default interface: #{String.new(err)}") if dev.null? | |
puts String.new(dev) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment