[Click] How to spoof MAC?

静 李 lastlijing at yahoo.com.cn
Sat Nov 11 05:37:57 EST 2006


How to spoof MAC?

I made a element::MACIPSpoofer(my_mac,my_ip),and want
to change the incomeming packets src MAC ,src ip. But
it seems that it only change the src ip! 

Here is main part of the macipspoofer.cc code :
Packet *
MACIPSpoofer::simple_action(Packet *p)
{
  if (WritablePacket *q = p->uniqueify()) {
    click_ether *ethh = reinterpret_cast<click_ether
*>(q->data());  
	memcpy(ethh->ether_shost,_ethh.ether_shost,6);

    click_ip *ip =(click_ip *)(q->data()+
 				    sizeof(click_ether));

 	  ip->ip_src = _ip_src;

    return q;
  } else
    return 0;
}

and part of configuration :
 ......
ls_prio :: PrioSched -> 
 spoofer::MACIPSpoofer(11:22:33:44:55:66, 10.10.7.7)->
 ToDevice(wlan0);


The result on my local PC1 seems that the src_MAC has
been changed to 
11:22:33:44:55:66 , and it also can be seen by the
Ethereal.
But on the other PC2 which get these spoofed_packed
,it seems that the packes src_MAC are still my PC's
real MAC.And by the PC2's Ethereal I also see my PC's
real MAC. 
why this happens ? Why I can only change the src_ip
field (on PC2, src_ip has been changed ),but not
src_MAC field ?  Is there something wrong with my c++
code  or  configuration ? 

Thank in advance ! 



		
___________________________________________________________ 
抢注雅虎免费邮箱-3.5G容量,20M附件! 
http://cn.mail.yahoo.com


More information about the click mailing list