Sha256: 2b6cd60b97b8597e6aad9b57419c89cfbbf501e2ee303c0224a5d9355e733f26
Contents?: true
Size: 663 Bytes
Versions: 28
Compression:
Stored size: 663 Bytes
Contents
require 'socket' module Phut # raw socket class RawSocket ETH_P_ALL = 0x0300 SIOCGIFINDEX = 0x8933 def initialize(interface) @socket = Socket.new(Socket::PF_PACKET, Socket::SOCK_RAW, ETH_P_ALL).tap do |sock| ifreq = [interface].pack('a32') sock.ioctl SIOCGIFINDEX, ifreq sock.bind([Socket::AF_PACKET].pack('s').tap do |sll| sll << ([ETH_P_ALL].pack 's') sll << ifreq[16..20] sll << ("\x00" * 12) end) end end def method_missing(method, *args) @socket.__send__ method, *args end end end
Version data entries
28 entries across 28 versions & 1 rubygems