class Scriptroute::IP
a small library of routines for constructing packets as strings to hand off to the interpreter.
Constants
- IPPROTO_TCP
- IPPROTO_UDP
Public Class Methods
creator(str)
click to toggle source
# File lib/scriptroute/packets.rb, line 11 def IP.creator(str) ip_vhl = str.unpack("c")[0] ip_v = ((ip_vhl & 0xf0) >> 4) if(ip_v == 4) then IPv4.creator(str) elsif(ip_v == 6) then IPv6.creator(str) else raise "unknown IP version #%d in %s" % [ ip_v, str.unpack("C*").map { |c| "%x" % c }.join(' ') ] end end
Public Instance Methods
to_bytes()
click to toggle source
# File lib/scriptroute/packets.rb, line 8 def to_bytes marshal end