Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of Modern Operating Systems (3rd Edition)
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)

Spoof an IPv4 ARP Response

It is quite early to poison the ARP cache of a computer by listening for the ARP request on another computer and sending back a fake response. Here is a simple utility that demonstrates how to do it using a raw socket. /* * Copyright (c) 2007 Finnbarr P. Murphy. All rights reserved. * * Demonstrates how to spoof an IPv4 ARP response * * Usage: spoofer device address * e.g. spoofer eth0 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <libgen.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <net/ethernet.h> #include <net/if.h> #define ARPOP_REPLY 2