#!/usr/bin/env ruby # # $Id: dhcp 174 2010-08-21 22:26:52Z jhart $ # # Send useless DHCP packets require 'rubygems' require 'racket' include Racket unless (ARGV.size == 2) puts "Usage: #{$0} " exit end n = Racket::Racket.new n.iface = "eth0" n.layers[3] = L3::IPv4.new n.layers[3].src_ip = ARGV[0] n.layers[3].dst_ip = ARGV[1] n.layers[3].version = 4 n.layers[3].hlen = 0x5 # n.layers[3].ttl = 44 n.layers[3].protocol = 0x11 n.layers[4] = L4::UDP.new n.layers[4].src_port = 68 n.layers[4].dst_port = 67 n.layers[5] = L5::BOOTP.new n.layers[5].yip = "192.168.0.4" n.layers[5].file = "foobar?" n.layers[4].payload = n.layers[5] n.layers[4].fix!(n.layers[3].src_ip, n.layers[3].dst_ip) n.layers[4].payload = "" f = n.sendpacket puts "Sent! #{f}" # vim: set ts=2 et sw=2: