我知道调用sendarp就可以完成任务,我写的代码,结果大家都知道了,当然不成功拉,所以就上来问问
.486
.model flat, stdcall
option casemap:none
include windows.inc
include kernel32.inc
include wsock32.inc
include iphlpapi.inc ;for SendARP
include user32.inc
includelib wsock32.lib
includelib kernel32.lib
includelib iphlpapi.lib
includelib user32.lib
.data
wsaData WSADATA<>
new_addr sockaddr_in<>
szIP db "192.168.3.135",0
szMac db '%02X:%02X:%02X:%02X:%02X:%02X',0
szOut db 156 dup(0)
.data?
pulMAC ULONG ?
ulLen ULONG ?
hSocket SOCKET ?
.code
start:
invoke WSAStartup,202h,addr wsaData;初始化WSAStartup
mov hSocket,eax
invoke inet_addr,addr szIP;转换IP为十六进制模式
mov eax,new_addr.sin_addr.S_un.S_addr
lea ebx,ulLen
mov ebx,6 ;赋值到ulLen
push ebx
pop ulLen;addr ulLen=ebx=6
invoke SendARP,eax,NULL,addr pulMAC,addr ulLen;发送arp数据包
.if eax != NO_ERROR
invoke wsprintf,addr szOut,addr szMac,pulMAC[1],pulMAC[2],pulMAC[3],pulMAC[4],pulMAC[5],pulMAC[6]
invoke MessageBox,NULL,addr szOut,NULL,MB_OK
.endif
invoke ExitProcess,NULL
end start
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课