Obtain the MAC address of the C # implementation introduced in attack networkCode, But the result is different from what you think.
[Dllimport ("iphlpapi. dll")]
Private Static extern int sendarp (int32 DEST, int32 host, ref intptr Mac, ref intptr length );
[Dllimport ("ws2_32.dll")]
Private Static extern int32 inet_addr (string IP );
Private void test _ click (Object sender, system. eventargs E)
{
Int32 ldest = inet_addr ("192.168.10.42"); // ip address of the destination
Int32 lhost = inet_addr ("192.168.10.42"); // local IP Address
Try
{
Byte [] macinfo = new byte [6];
Int32 length = 48;
Intptr MAC = new intptr (macinfo [0]);
Intptr Len = new intptr (6 );
int II = sendarp (ldest, lhost, ref Mac, ref Len);
response. write (Mac. tostring ();
}< br> catch (exception ERR)
{< br> response. write (err. message );
}< BR >}< br> the number of the obtained NIC address is 1078779904
however, the actual MAC address is 00e04c4031c0
the conversion between the decimal and hexadecimal numbers cannot be performed. matching
incomprehension of the intptr type is even more annoying
I don't know if I can get expert advice