Skip to content

Instantly share code, notes, and snippets.

@picatz
Created November 5, 2016 21:09
Show Gist options
  • Save picatz/3e848c367f05350c7cfb169320c25ca9 to your computer and use it in GitHub Desktop.
Save picatz/3e848c367f05350c7cfb169320c25ca9 to your computer and use it in GitHub Desktop.
Example use case to use packetfu to get basic iface information.
require 'packetfu'
# iface becomes the default routeable interface
iface = PacketFu::Utils.default_int
# config will determine the ifconfig data for iface
config = PacketFu::Utils.ifconfig(iface)
# print out some of the relevant information
puts " iface: " + config[:iface]
puts "mac address: " + config[:eth_saddr]
puts " local ip: " + config[:ip_saddr]
# => example output ...
# iface: en0
# mac address: t0:0s:1l:ly:4y:0u
# local ip: 10.0.0.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment