και επιτα πως το κανω compile! η εστω πως θα μπορουσα !!!!
το λειτουργεικο που εχω για τιν εργασια μου ειναι οπιαδιποτε ινσταλλ ton ubuntu
ακολουθει ο κωδικα
- Κώδικας: Επιλογή όλων
#include <iostream.h>
#include <libnet.h>////DEN TIN EXW!!!!!!!
int main() {
u_char enet_src[6] = {0x0d, 0x0e, 0x0a, 0x0d, 0x00, 0x00};
/* ethernet source address */
u_char enet_dst[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
/* ethernet destination address */
int packet_size, /* υυ υ υυυυ */
c;
u_char *packet; /* υυυ υυ buffer υ υυυυ*/
char err_buf[LIBNET_ERRBUF_SIZE]; /* buffer υ υυυυ υυυ*/
char *device; /* υυυ υ device υ υυυ */
struct libnet_link_int *network; /* υυυ υ link interface struct */
/*
* υυ 1: υυυυ υυυ.
*/
packet_size = LIBNET_ETH_H;
if (libnet_init_packet(packet_size, &packet) == -1) {
libnet_error(LIBNET_ERR_FATAL, "libnet_init_packet failed\n");
}
/*
* υυ 2: υφυυυυ υ υυυ.
*/
device = NULL;
if (device == NULL) {
struct sockaddr_in sin;
/*
* υυυυ υ device υ υυυ
*/
if (libnet_select_device(&sin, &device, err_buf) == -1) {
libnet_error(LIBNET_ERR_FATAL, "libnet_select_device failed: %s\n", err_buf);
}
cout<<"device:\t\t\t\t"<<device<<endl;
}
if ((network = libnet_open_link_interface(device, err_buf)) == NULL) {
libnet_error(LIBNET_ERR_FATAL, "libnet_open_link_interface: %s\n", err_buf);
}
/*
* υυ 3: υυυυυ υυυυ.
*/
libnet_build_ethernet(enet_dst,
enet_src,
ETHERTYPE_IP,
NULL,
0,
packet);
/*
* υυ 4: υυυυ υυυυ υ υυυ.
*/
c = libnet_write_link_layer(network, device, packet, packet_size);
if (c < packet_size)
{
libnet_error(LN_ERR_WARNING, "libnet_write_link_layer only wrote %d bytes\n", c);
}
else
{
cout<<"construction and injection completed, wrote all "<<c<<" bytes\n";
}
/*
* υυυ υ υυυυ interface.
*/
if (libnet_close_link_interface(network) == -1)
{
libnet_error(LN_ERR_WARNING, "libnet_close_ ink_interface couldn't close the interface");
}
/*
* υυυυυ υ υυυ.
*/
libnet_destroy_packet(&packet);
return (c == -1 ? EXIT_FAILURE : EXIT_SUCCESS);
}