begin process at 2010 02 10 10:49:31
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

.Net

 > CAPTURE ET DESENCAPSULATION DE TRAMES SUR LE RÉSEAU

CAPTURE ET DESENCAPSULATION DE TRAMES SUR LE RÉSEAU


 Information sur la source

Note :
10 / 10 - par 1 personne
10,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :.Net Niveau :Débutant Date de création :06/06/2003 Date de mise à jour :06/06/2003 11:24:19 Vu :6 855

Auteur : kelsey

Ecrire un message privé
Commentaire sur cette source (16)
Ajouter un commentaire et/ou une note

 Description

Ce code en C permet de capturer et d'analyser des trames circulant sur le réseau.Il faut préalablemant charger le fichier WpdPack pour pouvoir l'executer.ce code est utile pour une analyse reseau ou pour le calcul de fréquence de sites ou autres...

Source

  • #pragma hdrstop
  • #include <vcl.h>
  • #include <dos.h>
  • #include <conio.h>
  • #include <stdio.h>
  • #include <stdlib.h>
  • #include <iostream.h>
  • #include <packet32.h>
  • #include <ntddndis1.h>
  • //Déclaration de variable globales
  • wchar_t Buffer_Liste_Interfaces[8192];
  • wchar_t *Liste_PT_Interfaces[10];
  • //------------------------------------------------------------------------------
  • void affiche_menu()
  • {
  • printf("Choissisez votre type de capture\n\n");
  • printf("1) Capture en mode synthetique\n");
  • printf("2) Capture en mode detaille\n");
  • printf("3) Capture en mode analyse\n");
  • printf("4) Obtenir l'adresse IP d'une interface\n");
  • printf("5) Quitter\n");
  • }
  • //------------------------------------------------------------------------------
  • int saisir_choix()
  • {
  • int L_choix;
  • do
  • {
  • printf("\nChoix : ");
  • scanf("%d",&L_choix);
  • }
  • while(L_choix<1||L_choix>5);
  • return(L_choix);
  • }
  • //------------------------------------------------------------------------------
  • void Affiche_Trame(BYTE *P_Buffer,int P_Taille)
  • {
  • int L_index;
  • printf("\n\nTrame prise\n\n");
  • printf("Taille de la trame : %d\n\n", P_Taille);
  • for(L_index=0; L_index<P_Taille; L_index++)
  • {
  • printf("%02X ",P_Buffer[L_index]);
  • printf(" ");
  • }
  • }
  • //------------------------------------------------------------------------------
  • void Affiche_Trame_synthetique(BYTE *P_Buffer,int P_Taille)
  • {
  • int L_code;
  • int L_index;
  • int L_ligne;
  • int L_octet;
  • int L_octet2;
  • int L_taille;
  • int L_indice;
  • int L_char;
  • int L_compteur;
  • int L_compteur2;
  • int L_space;
  • bool ok;
  • L_ligne=0;
  • L_octet=0;
  • L_octet2=0;
  • L_space=0;
  • printf("\n");
  • while(1)
  • {
  • printf("\n%08X ",L_ligne);
  • L_compteur=0;
  • do
  • {
  • if(L_octet<P_Taille)
  • {
  • printf("%02X ", P_Buffer[L_octet]);
  • L_octet++;
  • }
  • if(L_space>=P_Taille)
  • {
  • printf(" ");
  • }
  • L_compteur++;
  • L_space++ ;
  • }
  • while(L_compteur<16);
  • printf(" ");
  • L_compteur2=0;
  • do
  • {
  • if(isalnum(P_Buffer[L_octet2])!=0)
  • {
  • printf("%c",P_Buffer[L_octet2]);
  • }
  • else
  • {
  • printf(".");
  • }
  • L_octet2++;
  • if(L_octet2>=P_Taille)break;
  • L_compteur2++;
  • }
  • while(L_compteur2<16);
  • if(L_octet2>=P_Taille)break;
  • L_ligne=L_ligne+16;
  • }
  • printf("\n\nAdresse destination : ");
  • for(L_index=0; L_index<6; L_index++)
  • {
  • printf("%02X ", P_Buffer[L_index]);
  • }
  • printf("\nAdresse source : ");
  • for(L_index=6; L_index<12; L_index++)
  • {
  • printf("%02X ", P_Buffer[L_index]);
  • }
  • printf("\nCode protocolaire : ");
  • for(L_index=12; L_index<14; L_index++)
  • {
  • printf("%02X ", P_Buffer[L_index]);
  • }
  • L_code= P_Buffer[12]<<8;
  • L_code=L_code^P_Buffer[13];
  • if(L_code>1500)
  • {
  • printf("\nType de trame : ETHERNET II\n");
  • }
  • else
  • {
  • printf("\nType de trame : 802.3\n");
  • printf("\nTaille des donnees : ");
  • L_taille= P_Buffer[12]+ P_Buffer[13];
  • printf("%d octets",L_taille);
  • printf("\nDSAP : ");
  • if(P_Buffer[14]==0xE0)printf("IPX Protocol");
  • if(P_Buffer[14]==0xF0)printf("NetBeui Protocol");
  • else{printf("Unnamed Protocol");}
  • printf("\nSSAP : %02X",P_Buffer[15]);
  • printf("\nCommand : ");
  • if(P_Buffer[15]==0)printf("Trame I\n");
  • if(P_Buffer[15]==64)printf("Trame S\n");
  • else{printf("Unnamed Trame");}
  • }
  • }
  • //------------------------------------------------------------------------------
  • void obtenir_liste_interfaces()
  • {
  • DWORD L_Taille;
  • WORD L_Taille_Chaine;
  • WORD L_Index;
  • wchar_t* L_Position;
  • L_Taille=sizeof(Buffer_Liste_Interfaces);
  • PacketGetAdapterNames((char*)Buffer_Liste_Interfaces,&L_Taille);
  • L_Position=Buffer_Liste_Interfaces;
  • L_Index=0;
  • printf("\nListe des interfaces actuelles : \n\n");
  • do
  • {
  • Liste_PT_Interfaces[L_Index] = L_Position;
  • wprintf(L"%d]%s\n",L_Index, Liste_PT_Interfaces[L_Index]);
  • L_Taille_Chaine=wcslen(Liste_PT_Interfaces[L_Index]);
  • L_Position=L_Position+L_Taille_Chaine+1;
  • L_Index++;
  • }
  • while(*L_Position!=0);
  • }
  • //------------------------------------------------------------------------------
  • int choisir_interface()
  • {
  • int L_interface;
  • printf("\nChoisissez l'interface que vous voulez exploiter : ");
  • scanf("%d",&L_interface);
  • return(L_interface);
  • }
  • //------------------------------------------------------------------------------
  • LPADAPTER ouverture_interface(int P_numero)
  • {
  • LPADAPTER L_Interface;
  • L_Interface=PacketOpenAdapter((char*)Liste_PT_Interfaces[P_numero]);
  • PacketSetHwFilter(L_Interface,NDIS_PACKET_TYPE_PROMISCUOUS);
  • PacketSetBuff(L_Interface,1024000);
  • PacketSetReadTimeout(L_Interface,5000);
  • return(L_Interface);
  • }
  • //------------------------------------------------------------------------------
  • bool capture_trame(LPADAPTER P_Interface, BYTE *P_Buffer, int P_taille)
  • {
  • _PACKET L_Packet;
  • bool L_Trame_Est_Capture;
  • L_Packet.Buffer= P_Buffer;
  • L_Packet.Length=P_taille;
  • L_Trame_Est_Capture=PacketReceivePacket(P_Interface,&L_Packet,TRUE);
  • return(L_Trame_Est_Capture);
  • }
  • //------------------------------------------------------------------------------
  • void fermeture_interface(LPADAPTER P_Interface)
  • {
  • PacketCloseAdapter(P_Interface);
  • }
  • //------------------------------------------------------------------------------
  • void capture_synthetique()
  • {
  • int L_numero;
  • unsigned int L_Taille_Trame;
  • bool L_Trame_Est_Capture;
  • BYTE L_Buffer[1514+sizeof(bpf_hdr)];
  • LPADAPTER L_Interface;
  • obtenir_liste_interfaces();
  • L_numero=choisir_interface();
  • L_Interface=ouverture_interface(L_numero);
  • L_Trame_Est_Capture=capture_trame(L_Interface, L_Buffer,sizeof(L_Buffer));
  • if(L_Trame_Est_Capture==true)
  • {
  • L_Taille_Trame=((bpf_hdr*)L_Buffer)->bh_datalen;
  • Affiche_Trame(L_Buffer+sizeof(bpf_hdr),L_Taille_Trame);
  • Affiche_Trame_synthetique(L_Buffer+sizeof(bpf_hdr),L_Taille_Trame);
  • }
  • fermeture_interface(L_Interface);
  • }
  • //------------------------------------------------------------------------------
  • void affiche_ICMP(BYTE *P_Buffer)
  • {
  • printf("\n\nNiveau 4 : ICMP");
  • printf("\nType : ");
  • switch(P_Buffer[34])
  • {
  • case 0 : printf("Echo Replay\n"); break;
  • case 3 : printf("Destination Unreachable\n"); break;
  • case 4 : printf("Sourece Quench\n"); break;
  • case 5 : printf("Redirect\n"); break;
  • case 8 : printf("Echo Request\n"); break;
  • case 11 : printf("Time Exceeded\n"); break;
  • case 12 : printf("Parameter Problem\n"); break;
  • case 13 : printf("Timestamp Request\n"); break;
  • case 14 : printf("Timestamp Reply\n"); break;
  • case 15 : printf("Information Request\n"); break;
  • case 16 : printf("Information Reply\n"); break;
  • case 17 : printf("Address Mask Request\n"); break;
  • case 18 : printf("Addresse Mask Reply\n"); break;
  • }
  • printf("Code : %02X",P_Buffer[35]);
  • printf("\nChecksum : %02X %02X",P_Buffer[36],P_Buffer[37]);
  • }
  • //------------------------------------------------------------------------------
  • void affiche_TCP(BYTE *P_Buffer)
  • {
  • int L_seize_bits;
  • int L_HLEN;
  • int L_flag;
  • int L_flag_masque;
  • printf("\n\nNiveau 4 : TCP");
  • printf("\nSource Port : %02X %02X",P_Buffer[34],P_Buffer[35]);
  • printf("\nDestination Port : %02X %02X",P_Buffer[36],P_Buffer[37]);
  • printf("\nSequence Number : %02X %02X ",P_Buffer[38],P_Buffer[39]);
  • printf("%02X %02X",P_Buffer[40],P_Buffer[41]);
  • printf("\nAcknolegement Number : %02X %02X ",P_Buffer[42],P_Buffer[43]);
  • printf("%02X %02X",P_Buffer[44],P_Buffer[45]);
  • L_HLEN=P_Buffer[46]>>4;
  • printf("\nHeader Length : %d bytes",L_HLEN);
  • L_flag_masque=63; //masque pour les 6 derniers bits de l'octet 47
  • L_flag=P_Buffer[47] & L_flag_masque;
  • printf("\nFlag : %d",L_flag);
  • printf("\n\t-URG : %d",(L_flag&32)>>5);
  • printf("\n\t-ACK : %d",(L_flag&16)>>4);
  • printf("\n\t-PSH : %d",(L_flag&8)>>3);
  • printf("\n\t-RST : %d",(L_flag&4)>>2);
  • printf("\n\t-SYN : %d",(L_flag&2)>>1);
  • printf("\n\t-FIN : %d",L_flag&1);
  • printf("\nWindows : %02X %02X",P_Buffer[48],P_Buffer[49]);
  • printf("\nChecksum : %02X %02X",P_Buffer[50],P_Buffer[51]);
  • printf("\nUrgent pointer : %02X",P_Buffer[52],P_Buffer[53]);
  • }
  • //------------------------------------------------------------------------------
  • void affiche_UDP(BYTE *P_Buffer)
  • {
  • printf("\n\nNiveau 4 : UDP");
  • printf("\nSource Port : %02X %02X",P_Buffer[34],P_Buffer[35]);
  • printf("\nDestination Port : %02X %02X",P_Buffer[36],P_Buffer[37]);
  • printf("\nMessage Length : %d bytes",P_Buffer[38]+P_Buffer[39]);
  • printf("\nHeader Checksum : %02X %02X", P_Buffer[40],P_Buffer[41]);
  • }
  • //------------------------------------------------------------------------------
  • void affiche_IP(BYTE *P_Buffer)
  • {
  • int L_index;
  • int L_masque;
  • int L_masque2;
  • int L_dizaine;
  • int L_unite;
  • int L_Length;
  • int L_id;
  • int frag;
  • int position;
  • L_masque=15;
  • L_masque2=8191;
  • printf("\nNiveau 3 : IP");
  • L_unite=P_Buffer[14]&L_masque; //récupération de l'unité
  • L_dizaine=P_Buffer[14]>>4; //récupération de la dizaine
  • L_dizaine=L_dizaine&L_masque;
  • printf("\nVersion : %d",L_dizaine);
  • printf("\nHeader Length : %d bytes",L_unite);
  • printf("\nType of service : %d",P_Buffer[15]);
  • L_Length=P_Buffer[16]+P_Buffer[17];
  • printf("\nTotal Length : %d bytes",L_Length);
  • L_id=P_Buffer[18]+P_Buffer[19];
  • printf("\nIdentification : %d",L_id);
  • frag=P_Buffer[20]>>5; //récupération des
  • printf("\nFraguement : %d",frag); //trois premiers bits
  • position=P_Buffer[20]<<8; //concaténation des octets
  • position=position ^ P_Buffer[21]; //20 et 21 puis récupération
  • position=position & L_masque2; //des 13 derniers bits
  • printf("\nPositionnement : %02X",position);
  • printf("\nDuree de vie : %d",P_Buffer[22]);
  • printf("\nProtocole : %d",P_Buffer[23]);
  • printf("\nHeader Cheksum : %02X %02X",P_Buffer[24],P_Buffer[25]);
  • printf("\nAdresse source : ");
  • for(L_index=26;L_index<30;L_index++)
  • {printf("%d.",P_Buffer[L_index]);}
  • printf("\nAdresse de destination : ");
  • for(L_index=30;L_index<34;L_index++)
  • {printf("%d.",P_Buffer[L_index]);}
  • switch(P_Buffer[23])
  • {
  • case 1 : affiche_ICMP(P_Buffer);
  • break;
  • case 6 : affiche_TCP(P_Buffer);
  • break;
  • case 7 : affiche_UDP(P_Buffer);
  • break;
  • }
  • }
  • //------------------------------------------------------------------------------
  • void affiche_ARP(BYTE *P_Buffer)
  • {
  • int L_index;
  • printf("\nNiveau 3 : ARP");
  • printf("\nNetwork Type : ");
  • if(P_Buffer[15]==1)printf("Ethernet");
  • if(P_Buffer[15]==3)printf("Token Ring");
  • printf("\nProtocole Type : ");
  • if((P_Buffer[16]==8) && (P_Buffer[17]==0))printf("IP");
  • printf("\nHardware Adress Length : %d bytes",P_Buffer[18]);
  • printf("\nLogical Adress Length : %d bytes",P_Buffer[19]);
  • printf("\nOperation : ");
  • if(P_Buffer[21]==1)printf("Request ARP");
  • if(P_Buffer[21]==2)printf("Answer ARP");
  • printf("\nSender Hardware Adress : ");
  • for(L_index=22;L_index<28;L_index++)
  • {printf("%02X ",P_Buffer[L_index]);}
  • printf("\nSender Internet Adress : ");
  • for(L_index=28;L_index<32;L_index++)
  • {printf("%d.",P_Buffer[L_index]);}
  • printf("\nTarget Hardware Adress : ");
  • for(L_index=32;L_index<38;L_index++)
  • {printf("%02X ",P_Buffer[L_index]);}
  • printf("\nTarget Internet Adress : ");
  • for(L_index=38;L_index<42;L_index++)
  • {printf("%d.",P_Buffer[L_index]);}
  • }
  • //------------------------------------------------------------------------------
  • void affiche_detail(BYTE *P_Buffer, int P_Taille)
  • {
  • Affiche_Trame_synthetique(P_Buffer, P_Taille);
  • if((P_Buffer[12]==8) && (P_Buffer[13]==0))
  • {
  • affiche_IP(P_Buffer);
  • }
  • if( (P_Buffer[12]==8) && (P_Buffer[13]==6))
  • {
  • affiche_ARP(P_Buffer);
  • }
  • }
  • //------------------------------------------------------------------------------
  • void capture_detaille()
  • {
  • BYTE L_Buffer[1514+sizeof(bpf_hdr)];
  • LPADAPTER L_Interface;
  • int L_numero;
  • int L_Taille;
  • bool L_ok;
  • bool L_Trame_Est_Capture;
  • obtenir_liste_interfaces();
  • L_numero=choisir_interface();
  • L_Interface=ouverture_interface(L_numero);
  • L_Trame_Est_Capture=capture_trame(L_Interface,L_Buffer,sizeof(L_Buffer));
  • if(L_Trame_Est_Capture==true)
  • {
  • L_Taille=((bpf_hdr*)L_Buffer)->bh_datalen;
  • affiche_detail(L_Buffer+sizeof(bpf_hdr), L_Taille);
  • }
  • fermeture_interface(L_Interface);
  • }
  • //------------------------------------------------------------------------------
  • int choix_nombre_trame()
  • {
  • int L_nombre;
  • printf("\nEntrer le nombre de trame a capturer : ");
  • scanf("%d",&L_nombre);
  • return(L_nombre);
  • }
  • //------------------------------------------------------------------------------
  • int broadcast(BYTE *P_Buffer,bool P_action)
  • {
  • int L_index;
  • int L_broadcast;
  • int L_arp;
  • int L_retour;
  • bool ok;
  • if(P_action==true)
  • {
  • L_index=0;
  • do
  • {
  • if(P_Buffer[L_index]==0xFF)ok=true;
  • else ok=false;
  • L_index++;
  • }
  • while(L_index<6 && ok!=false);
  • if(ok==true)L_broadcast=1;
  • if(ok==false)L_broadcast=0;
  • L_retour=L_broadcast;
  • }
  • if(P_action==false)
  • {
  • if( (P_Buffer[12]==8) && (P_Buffer[13]==6) )L_arp=1;
  • else L_arp=0;
  • L_retour=L_arp;
  • }
  • return(L_retour);
  • }
  • //------------------------------------------------------------------------------
  • void capture_analyse()
  • {
  • BYTE L_Buffer[1514+sizeof(bpf_hdr)];
  • LPADAPTER L_Interface;
  • _PACKET L_Packet;
  • int L_numero;
  • int L_taille;
  • int L_compteur;
  • int L_nombre_trame;
  • int L_broadcast;
  • int L_compteur_broadcast;
  • int L_arp;
  • int L_compteur_arp;
  • bool L_Trame_Capture;
  • float L_pourcentage_cast;
  • float L_pourcentage_arp;
  • L_compteur_broadcast=0;
  • L_compteur_arp=0;
  • obtenir_liste_interfaces();
  • L_numero=choisir_interface();
  • L_nombre_trame=choix_nombre_trame();
  • L_Interface=ouverture_interface(L_numero);
  • for(L_compteur=0;L_compteur<L_nombre_trame;L_compteur++)
  • {
  • L_Trame_Capture=capture_trame(L_Interface,L_Buffer,sizeof(L_Buffer));
  • if(L_Trame_Capture==true)
  • {
  • L_taille=((bpf_hdr*)L_Buffer)->bh_datalen;
  • printf("\nTrame prise\n\n");
  • printf("Taille de la trame : %d\n\n", L_taille);
  • affiche_detail(L_Buffer+sizeof(bpf_hdr), L_taille);
  • L_broadcast=broadcast(L_Buffer+sizeof(bpf_hdr),true);
  • L_arp=broadcast(L_Buffer+sizeof(bpf_hdr),false);
  • L_compteur_broadcast=L_compteur_broadcast+L_broadcast;
  • L_compteur_arp=L_compteur_arp+L_arp;
  • }
  • }
  • L_pourcentage_cast=float(L_compteur_broadcast*100)/L_nombre_trame;
  • printf("\n\nNombre de trame Broadcast : ");
  • printf("%d, soit %4.2f%% ",L_compteur_broadcast,L_pourcentage_cast);
  • printf("de la capture\n");
  • if(L_compteur_broadcast!=0) //division par 0 impossible
  • {
  • L_pourcentage_arp=float(L_compteur_arp*100)/L_compteur_broadcast;
  • printf("Nombre de trame ARP : ");
  • printf("%d, soit %4.2f%% ",L_compteur_arp,L_pourcentage_arp);
  • printf("des trames broadcast\n");
  • fermeture_interface(L_Interface);
  • }
  • }
  • //------------------------------------------------------------------------------
  • void ip()
  • {
  • npf_if_addr* L_adresse;
  • int L_numero;
  • long L_mask;
  • printf("\nEn cours de developpement ! ! ! ");
  • obtenir_liste_interfaces();
  • L_numero=choisir_interface();
  • PacketGetNetInfoEx((char*)Liste_PT_Interfaces[L_numero], L_adresse, &L_mask);
  • printf("\nL'adresse de l'interface est : %02X",L_adresse);
  • printf("\nSon masque est : %02X",L_mask);
  • }
  • //------------------------------------------------------------------------------
  • void traitement_choix(int P_choix)
  • {
  • switch(P_choix)
  • {
  • case 1 : capture_synthetique();
  • break;
  • case 2 : capture_detaille();
  • break;
  • case 3 : capture_analyse();
  • break;
  • case 4 : ip();
  • break;
  • case 5 : printf("\nAu revoir ! ! !\n"); _sleep(2); exit(0);
  • }
  • }
  • //------------------------------------------------------------------------------
  • void main()
  • {
  • int L_choix;
  • do
  • {
  • clrscr();
  • affiche_menu();
  • L_choix=saisir_choix();
  • traitement_choix(L_choix);
  • printf("\n\nRecommencer oui(o), non(hit any key)\n");
  • }
  • while(getch()=='o');
  • }
  • //---------------------------------FIN------------------------------------------
#pragma hdrstop
#include <vcl.h>
#include <dos.h>
#include <conio.h> 
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <packet32.h>
#include <ntddndis1.h>

//Déclaration de variable globales
wchar_t Buffer_Liste_Interfaces[8192];
wchar_t *Liste_PT_Interfaces[10];
//------------------------------------------------------------------------------
void affiche_menu()
{
        printf("Choissisez votre type de capture\n\n");
        printf("1) Capture en mode synthetique\n");
        printf("2) Capture en mode detaille\n");
        printf("3) Capture en mode analyse\n");
        printf("4) Obtenir l'adresse IP d'une interface\n");
        printf("5) Quitter\n");
}
//------------------------------------------------------------------------------
int saisir_choix()
{
int L_choix;

        do
        {
                printf("\nChoix : ");
                scanf("%d",&L_choix);
        }
        while(L_choix<1||L_choix>5);
        
        return(L_choix);
}
//------------------------------------------------------------------------------
void Affiche_Trame(BYTE *P_Buffer,int P_Taille)
{
int L_index;

        printf("\n\nTrame prise\n\n");
        printf("Taille de la trame : %d\n\n", P_Taille);
        for(L_index=0; L_index<P_Taille; L_index++)
        {
                printf("%02X ",P_Buffer[L_index]);
                printf(" ");
        }
}
//------------------------------------------------------------------------------
void Affiche_Trame_synthetique(BYTE *P_Buffer,int P_Taille)
{
int L_code;
int L_index;
int L_ligne;
int L_octet;
int L_octet2;
int L_taille;
int L_indice;
int L_char;
int L_compteur;
int L_compteur2;
int L_space;
bool ok;

        L_ligne=0;
        L_octet=0;
        L_octet2=0;
        L_space=0;
        printf("\n");

        while(1)
        {
                        printf("\n%08X    ",L_ligne);
                        L_compteur=0;
                        do
                        {
                                if(L_octet<P_Taille)
                                {
                                        printf("%02X ", P_Buffer[L_octet]);
                                        L_octet++;
                                }

                                if(L_space>=P_Taille)
                                {
                                        printf("   ");
                                }
                                L_compteur++;
                                L_space++ ;
                        }
                        while(L_compteur<16);

                        printf("    ");

                        L_compteur2=0;

                        do
                        {
                                if(isalnum(P_Buffer[L_octet2])!=0)
                                {
                                        printf("%c",P_Buffer[L_octet2]);
                                }
                                else
                                {
                                        printf(".");
                                }
                                L_octet2++;

                                if(L_octet2>=P_Taille)break;
                                L_compteur2++;
                        }
                        while(L_compteur2<16);

                        if(L_octet2>=P_Taille)break;
                        L_ligne=L_ligne+16;
        }

        printf("\n\nAdresse destination : ");
        for(L_index=0; L_index<6; L_index++)
        {
                printf("%02X ", P_Buffer[L_index]);

        }
        printf("\nAdresse source : ");
        for(L_index=6; L_index<12; L_index++)
        {
                printf("%02X ", P_Buffer[L_index]);
        }
        printf("\nCode protocolaire : ");
        for(L_index=12; L_index<14; L_index++)
        {
                printf("%02X ", P_Buffer[L_index]);
        }

        L_code= P_Buffer[12]<<8;
        L_code=L_code^P_Buffer[13];

        if(L_code>1500)
        {

               printf("\nType de trame : ETHERNET II\n");
        }
        else
        {

                printf("\nType de trame : 802.3\n");
                printf("\nTaille des donnees : ");
                L_taille= P_Buffer[12]+ P_Buffer[13];
                printf("%d octets",L_taille);

                printf("\nDSAP : ");
                if(P_Buffer[14]==0xE0)printf("IPX Protocol");
                if(P_Buffer[14]==0xF0)printf("NetBeui Protocol");
                else{printf("Unnamed Protocol");}

                printf("\nSSAP : %02X",P_Buffer[15]);

                printf("\nCommand : ");
                if(P_Buffer[15]==0)printf("Trame I\n");
                if(P_Buffer[15]==64)printf("Trame S\n");
                else{printf("Unnamed Trame");}
        }
}
//------------------------------------------------------------------------------
void obtenir_liste_interfaces()
{
DWORD L_Taille;
WORD L_Taille_Chaine;
WORD L_Index;
wchar_t* L_Position;

        L_Taille=sizeof(Buffer_Liste_Interfaces);
        PacketGetAdapterNames((char*)Buffer_Liste_Interfaces,&L_Taille);
        L_Position=Buffer_Liste_Interfaces;

        L_Index=0;
        printf("\nListe des interfaces actuelles : \n\n");
        do
        {
                Liste_PT_Interfaces[L_Index] = L_Position;
                wprintf(L"%d]%s\n",L_Index, Liste_PT_Interfaces[L_Index]);
                L_Taille_Chaine=wcslen(Liste_PT_Interfaces[L_Index]);
                L_Position=L_Position+L_Taille_Chaine+1;
                L_Index++;
        }
        while(*L_Position!=0);
}
//------------------------------------------------------------------------------
int choisir_interface()
{
int L_interface;

        printf("\nChoisissez l'interface que vous voulez exploiter : ");
        scanf("%d",&L_interface);
        return(L_interface);
}
//------------------------------------------------------------------------------
LPADAPTER ouverture_interface(int P_numero)
{
LPADAPTER L_Interface;

        L_Interface=PacketOpenAdapter((char*)Liste_PT_Interfaces[P_numero]);
        PacketSetHwFilter(L_Interface,NDIS_PACKET_TYPE_PROMISCUOUS);
        PacketSetBuff(L_Interface,1024000);
        PacketSetReadTimeout(L_Interface,5000);
        return(L_Interface);
}
//------------------------------------------------------------------------------
bool capture_trame(LPADAPTER P_Interface, BYTE *P_Buffer, int P_taille)
{
_PACKET L_Packet;
bool L_Trame_Est_Capture;

        L_Packet.Buffer= P_Buffer;
        L_Packet.Length=P_taille;
        L_Trame_Est_Capture=PacketReceivePacket(P_Interface,&L_Packet,TRUE);
        return(L_Trame_Est_Capture);
}
//------------------------------------------------------------------------------
void fermeture_interface(LPADAPTER P_Interface)
{
        PacketCloseAdapter(P_Interface);
}
//------------------------------------------------------------------------------
void capture_synthetique()
{
int L_numero;
unsigned int L_Taille_Trame;
bool L_Trame_Est_Capture;
BYTE L_Buffer[1514+sizeof(bpf_hdr)];
LPADAPTER L_Interface;

        obtenir_liste_interfaces();

        L_numero=choisir_interface();

        L_Interface=ouverture_interface(L_numero);

        L_Trame_Est_Capture=capture_trame(L_Interface, L_Buffer,sizeof(L_Buffer));

        if(L_Trame_Est_Capture==true)
        {
                L_Taille_Trame=((bpf_hdr*)L_Buffer)->bh_datalen;
                Affiche_Trame(L_Buffer+sizeof(bpf_hdr),L_Taille_Trame);
           Affiche_Trame_synthetique(L_Buffer+sizeof(bpf_hdr),L_Taille_Trame);
        }

        fermeture_interface(L_Interface);
}
//------------------------------------------------------------------------------
void affiche_ICMP(BYTE *P_Buffer)
{
        printf("\n\nNiveau 4 : ICMP");
        printf("\nType : ");

                switch(P_Buffer[34])
                {
                        case 0  : printf("Echo Replay\n"); break;
                        case 3  : printf("Destination Unreachable\n"); break;
                        case 4  : printf("Sourece Quench\n"); break;
                        case 5  : printf("Redirect\n"); break;
                        case 8  : printf("Echo Request\n"); break;
                        case 11 : printf("Time Exceeded\n"); break;
                        case 12 : printf("Parameter Problem\n"); break;
                        case 13 : printf("Timestamp Request\n"); break;
                        case 14 : printf("Timestamp Reply\n"); break;
                        case 15 : printf("Information Request\n"); break;
                        case 16 : printf("Information Reply\n"); break;
                        case 17 : printf("Address Mask Request\n"); break;
                        case 18 : printf("Addresse Mask Reply\n"); break;
                }
        printf("Code : %02X",P_Buffer[35]);
        printf("\nChecksum : %02X %02X",P_Buffer[36],P_Buffer[37]);
}
//------------------------------------------------------------------------------
void affiche_TCP(BYTE *P_Buffer)
{
int L_seize_bits;
int L_HLEN;
int L_flag;
int L_flag_masque; 

        printf("\n\nNiveau 4 : TCP");
        printf("\nSource Port : %02X %02X",P_Buffer[34],P_Buffer[35]);
        printf("\nDestination Port : %02X %02X",P_Buffer[36],P_Buffer[37]);
        printf("\nSequence Number : %02X %02X ",P_Buffer[38],P_Buffer[39]);
        printf("%02X %02X",P_Buffer[40],P_Buffer[41]);
        printf("\nAcknolegement Number : %02X %02X ",P_Buffer[42],P_Buffer[43]);
        printf("%02X %02X",P_Buffer[44],P_Buffer[45]);

        L_HLEN=P_Buffer[46]>>4;
        printf("\nHeader Length : %d bytes",L_HLEN);

        L_flag_masque=63;                     //masque pour les 6 derniers bits de l'octet 47
        L_flag=P_Buffer[47] & L_flag_masque;
        printf("\nFlag : %d",L_flag);
        printf("\n\t-URG : %d",(L_flag&32)>>5);
        printf("\n\t-ACK : %d",(L_flag&16)>>4);
        printf("\n\t-PSH : %d",(L_flag&8)>>3);
        printf("\n\t-RST : %d",(L_flag&4)>>2);
        printf("\n\t-SYN : %d",(L_flag&2)>>1);
        printf("\n\t-FIN : %d",L_flag&1);

        printf("\nWindows : %02X %02X",P_Buffer[48],P_Buffer[49]);
        printf("\nChecksum : %02X %02X",P_Buffer[50],P_Buffer[51]);
        printf("\nUrgent pointer : %02X",P_Buffer[52],P_Buffer[53]);
}
//------------------------------------------------------------------------------
void affiche_UDP(BYTE *P_Buffer)
{
        printf("\n\nNiveau 4 : UDP");
        printf("\nSource Port : %02X %02X",P_Buffer[34],P_Buffer[35]);
        printf("\nDestination Port : %02X %02X",P_Buffer[36],P_Buffer[37]);
        printf("\nMessage Length : %d bytes",P_Buffer[38]+P_Buffer[39]);
        printf("\nHeader Checksum : %02X %02X", P_Buffer[40],P_Buffer[41]);
}
//------------------------------------------------------------------------------
void affiche_IP(BYTE *P_Buffer)
{
int L_index;
int L_masque;
int L_masque2;
int L_dizaine;
int L_unite;
int L_Length;
int L_id;
int frag;
int position;

        L_masque=15;
        L_masque2=8191;

        printf("\nNiveau 3 : IP");

        L_unite=P_Buffer[14]&L_masque;                  //récupération de l'unité
        L_dizaine=P_Buffer[14]>>4;                      //récupération de la dizaine
        L_dizaine=L_dizaine&L_masque;
        printf("\nVersion : %d",L_dizaine);
        printf("\nHeader Length : %d bytes",L_unite);
        printf("\nType of service : %d",P_Buffer[15]);

        L_Length=P_Buffer[16]+P_Buffer[17];
        printf("\nTotal Length : %d bytes",L_Length);

        L_id=P_Buffer[18]+P_Buffer[19];
        printf("\nIdentification : %d",L_id);

        frag=P_Buffer[20]>>5;                           //récupération des
        printf("\nFraguement : %d",frag);               //trois premiers bits

        position=P_Buffer[20]<<8;                       //concaténation des octets
        position=position ^ P_Buffer[21];               //20 et 21 puis récupération
        position=position & L_masque2;                  //des 13 derniers bits
        printf("\nPositionnement : %02X",position);

        printf("\nDuree de vie : %d",P_Buffer[22]);

        printf("\nProtocole : %d",P_Buffer[23]);

        printf("\nHeader Cheksum : %02X %02X",P_Buffer[24],P_Buffer[25]);

        printf("\nAdresse source : ");
        for(L_index=26;L_index<30;L_index++)
        {printf("%d.",P_Buffer[L_index]);}

        printf("\nAdresse de destination : ");
        for(L_index=30;L_index<34;L_index++)
        {printf("%d.",P_Buffer[L_index]);}

                switch(P_Buffer[23])
                {
                        case 1 : affiche_ICMP(P_Buffer);
                                        break;
                        case 6 : affiche_TCP(P_Buffer);
                                        break;
                        case 7 : affiche_UDP(P_Buffer);
                                        break;
                }
}
//------------------------------------------------------------------------------
void affiche_ARP(BYTE *P_Buffer)
{
int L_index;

        printf("\nNiveau 3 : ARP");

        printf("\nNetwork Type : ");
        if(P_Buffer[15]==1)printf("Ethernet");
        if(P_Buffer[15]==3)printf("Token Ring");

        printf("\nProtocole Type : ");
        if((P_Buffer[16]==8) && (P_Buffer[17]==0))printf("IP");

        printf("\nHardware Adress Length : %d bytes",P_Buffer[18]);
        printf("\nLogical Adress Length : %d bytes",P_Buffer[19]);

        printf("\nOperation : ");
        if(P_Buffer[21]==1)printf("Request ARP");
        if(P_Buffer[21]==2)printf("Answer ARP");

        printf("\nSender Hardware Adress : ");
        for(L_index=22;L_index<28;L_index++)
        {printf("%02X ",P_Buffer[L_index]);}

        printf("\nSender Internet Adress : ");
        for(L_index=28;L_index<32;L_index++)
        {printf("%d.",P_Buffer[L_index]);}

        printf("\nTarget Hardware Adress : ");
         for(L_index=32;L_index<38;L_index++)
        {printf("%02X ",P_Buffer[L_index]);}

        printf("\nTarget Internet Adress : ");
         for(L_index=38;L_index<42;L_index++)
        {printf("%d.",P_Buffer[L_index]);}

}
//------------------------------------------------------------------------------
void affiche_detail(BYTE *P_Buffer, int P_Taille)
{

        Affiche_Trame_synthetique(P_Buffer, P_Taille);

        if((P_Buffer[12]==8) &&  (P_Buffer[13]==0))
        {
                affiche_IP(P_Buffer);
        }

        if( (P_Buffer[12]==8) && (P_Buffer[13]==6))
        {
                affiche_ARP(P_Buffer);
        }
}
//------------------------------------------------------------------------------
void capture_detaille()
{
BYTE L_Buffer[1514+sizeof(bpf_hdr)];
LPADAPTER L_Interface;
int L_numero;
int L_Taille;
bool L_ok;
bool L_Trame_Est_Capture;


        obtenir_liste_interfaces();

        L_numero=choisir_interface();

        L_Interface=ouverture_interface(L_numero);

        L_Trame_Est_Capture=capture_trame(L_Interface,L_Buffer,sizeof(L_Buffer));

        if(L_Trame_Est_Capture==true)
        {
                L_Taille=((bpf_hdr*)L_Buffer)->bh_datalen;
                affiche_detail(L_Buffer+sizeof(bpf_hdr), L_Taille);
        }

        fermeture_interface(L_Interface);
}
//------------------------------------------------------------------------------
int choix_nombre_trame()
{
int L_nombre;
        printf("\nEntrer le nombre de trame a capturer : ");
        scanf("%d",&L_nombre);
        return(L_nombre);
}
//------------------------------------------------------------------------------
int broadcast(BYTE *P_Buffer,bool P_action)
{
int L_index;
int L_broadcast;
int L_arp;
int L_retour;
bool ok;

        if(P_action==true)
        {
                L_index=0;

                do
                {
                        if(P_Buffer[L_index]==0xFF)ok=true;
                        else ok=false;
                        L_index++;
                }
                while(L_index<6 && ok!=false);

                if(ok==true)L_broadcast=1;
                if(ok==false)L_broadcast=0;
                L_retour=L_broadcast;
        }

        if(P_action==false)
        {
                if( (P_Buffer[12]==8) && (P_Buffer[13]==6) )L_arp=1;
                else L_arp=0;
                L_retour=L_arp;
        }

        return(L_retour);
}
//------------------------------------------------------------------------------
void capture_analyse()
{
BYTE L_Buffer[1514+sizeof(bpf_hdr)];
LPADAPTER L_Interface;
_PACKET L_Packet;
int L_numero;
int L_taille;
int L_compteur;
int L_nombre_trame;
int L_broadcast;
int L_compteur_broadcast;
int L_arp;
int L_compteur_arp;
bool L_Trame_Capture;
float L_pourcentage_cast;
float L_pourcentage_arp;

        L_compteur_broadcast=0;
        L_compteur_arp=0;

        obtenir_liste_interfaces();

        L_numero=choisir_interface();

        L_nombre_trame=choix_nombre_trame();

        L_Interface=ouverture_interface(L_numero);

        for(L_compteur=0;L_compteur<L_nombre_trame;L_compteur++)
        {

        L_Trame_Capture=capture_trame(L_Interface,L_Buffer,sizeof(L_Buffer));

                if(L_Trame_Capture==true)
                {
                        L_taille=((bpf_hdr*)L_Buffer)->bh_datalen;
                        printf("\nTrame prise\n\n");
                        printf("Taille de la trame : %d\n\n", L_taille);
                        affiche_detail(L_Buffer+sizeof(bpf_hdr), L_taille);
                        L_broadcast=broadcast(L_Buffer+sizeof(bpf_hdr),true);
                        L_arp=broadcast(L_Buffer+sizeof(bpf_hdr),false);
                        L_compteur_broadcast=L_compteur_broadcast+L_broadcast;
                        L_compteur_arp=L_compteur_arp+L_arp;
                }
        }

        L_pourcentage_cast=float(L_compteur_broadcast*100)/L_nombre_trame;
        printf("\n\nNombre de trame Broadcast : ");
        printf("%d, soit %4.2f%% ",L_compteur_broadcast,L_pourcentage_cast);
        printf("de la capture\n");

        if(L_compteur_broadcast!=0)                     //division par 0 impossible
        {
        L_pourcentage_arp=float(L_compteur_arp*100)/L_compteur_broadcast;
        printf("Nombre de trame ARP : ");
        printf("%d, soit %4.2f%% ",L_compteur_arp,L_pourcentage_arp);
        printf("des trames broadcast\n");
        fermeture_interface(L_Interface);
        }
}
//------------------------------------------------------------------------------
void ip()
{
npf_if_addr* L_adresse;
int L_numero;
long L_mask;

        printf("\nEn cours de developpement ! ! ! ");
        obtenir_liste_interfaces();
        L_numero=choisir_interface();
        PacketGetNetInfoEx((char*)Liste_PT_Interfaces[L_numero], L_adresse, &L_mask);
        printf("\nL'adresse de l'interface est : %02X",L_adresse);
        printf("\nSon masque est : %02X",L_mask);
}
//------------------------------------------------------------------------------
void traitement_choix(int P_choix)
{
        switch(P_choix)
        {
                case 1 : capture_synthetique();
                                break;
                case 2 : capture_detaille();
                                break;
                case 3 : capture_analyse();
                                break;
                case 4 : ip();
                                break;
                case 5 : printf("\nAu revoir ! ! !\n"); _sleep(2); exit(0);
        }
}
//------------------------------------------------------------------------------
void main()
{
int L_choix;

        do
        {
                clrscr();
                affiche_menu();
                L_choix=saisir_choix();
                traitement_choix(L_choix);
                printf("\n\nRecommencer oui(o), non(hit any key)\n");
        }
        while(getch()=='o');
}
//---------------------------------FIN------------------------------------------



 Sources du même auteur

TRAITEMENT DE TABLEAU AVEC ALLOCATION & RESTITUTIONN DE MEMO...
MULTIPLICATION DE DEUX MATRICES EN C
RÉECRIT UN TEXTE A L'ENVERS
TRI A BULLE EN C

 Sources de la même categorie

Source avec Zip Source avec une capture MAP_MAKER_JEU par seekplus
Source avec Zip Source avec une capture Source .NET (Dotnet) EMISSION D'UN OCTET SUR LE PORT SÉRIE - CLASSE SERIALPORT par jmchatelet01
Source avec Zip Source .NET (Dotnet) RESOLV EQU DE DEGRES N par darckangel731
Source avec Zip Source avec une capture Source .NET (Dotnet) INTEROP XCHAT / .NET : CHARGEUR DE PLUGINS MANAGÉS par TeBeCo
Source avec Zip Source avec une capture Source .NET (Dotnet) SCANNER D'ADRESSES MAILS PRÉSENTENT SUR GOOGLE par Zaltez

Commentaires et avis

Commentaire de damien174 le 09/06/2003 19:38:14

slt, c pas mal ton truc !!!
juste un truc est ce qu'on peut le faire aussi sous VB6, si oui comment
merci

Commentaire de HotSpot le 18/02/2004 01:34:40

ca fait longtemps que je cherchait une source comme ca ... j'avais la flem de la faire .. merci en tt cas .. et bon courage

NB : a oui j'y penssais pk tu utulise pas une classe .. ton code sera bcps plus comprhenssible par moi et aussi par toi lors de la relecture ..

Bye :)

Commentaire de kelsey le 18/02/2004 14:40:35

Le passage en classe  est prevus pour bientot!! A suivre....

Commentaire de manutrium le 07/03/2004 23:55:44

slt,
je n'arrive pas à compiler ss builder 6.
&lt;packet32.h&gt; n'existe pas. Si je met &lt;packet.h&gt;, il ne connait pas "LPADAPTER".
Quelqu'un a-t-il une solution ?

Commentaire de juju2004 le 22/04/2004 17:17:48

slt,

Je voulais savoir en fait à koi te servait vcl.h ????
connais pas cette librairie ... serait elle de ton cru?
merci d'avance

Commentaire de poirouge le 21/06/2004 10:37:05

juju2004=&gt;
vcl.h est pour Builder
manutrium=&gt;
Il faut telechager winpcap, D2ZIPPER, copier "packet.h", d'autres .h et enfin inclure Packet.lib pour que cela marche

Commentaire de jayjay le 06/01/2005 00:37:30

Bonjour, je dois avoir des problèmes de configuration avec C++ builder 5.0 (je sais vieille version). Quelqu'un pourrait m'envoyer l'exécutable et les fichiers de projet. Merci d'avance...

Commentaire de kelsey le 06/01/2005 15:41:57

Comment ca des problémes de configurations...........!!!
Sois plus explicite s'il te plait.

Commentaire de skott le 22/02/2005 21:02:45

salut

j'ai essaye d'exécuté le code avec visual c++6.0 mais

il'ya plein d'erreur . comment fair ?

j'ai téléchargé  WpdPack mais j'ai pas trouver le fich vcl.h

merci

Commentaire de kelsey le 22/02/2005 22:09:37

Quel genre d'erreur?
la librairie vcl.h est utilisée sous builder quand on utilise des objets pour les IHM, si tu éxécutes ton code en expert console tu n'en auras pas besoin.
Pour le WpdPack il faut l'installer et en extraire les librairies packet32.h ntddndis.h que tu renommeras
ntddndis1.h.
Mais explique moi plus précisement tes problémes de compilations (variables non reconnues, type non identifié....).



Commentaire de skott le 24/02/2005 08:47:55

oui le pb c'est lors de la compilation il ya un pb avec le fich Packet32.h  j'obtien les erreurs suivant:

structure non defenie struct  "sockaddr_storage"

cette struct n'est pas reconnue .
j'ai essaye de la modifier par "sockaddr_in " et sa marché  mais est ce que c'est juste ???

Commentaire de feufolet le 28/04/2005 15:11:53

y aura t'il un moyen de connaitre la bande passante avec ce programme

Commentaire de islamm le 24/11/2005 20:56:25

salut je fai un projet de fin d'etude sur la voix sur ip et je dois developper un pt logiciel qui permet de simuler le trafic dans le reseau en insistant sur les 4 parametres de la qualite de services :delait de bout en bout,bande passante,gigue..
alors si qlq a une idee qu'il me contact a cette adresse mouna.fersi@gmail.com
merci d'avance

Commentaire de islamm le 24/11/2005 21:28:09

salut je fai un projet de fin d'etude sur la voix sur ip et je dois developper un pt logiciel qui permet de simuler le trafic dans le reseau en insistant sur les 4 parametres de la qualite de services :delait de bout en bout,bande passante,gigue..
alors si qlq a une idee qu'il me contact a cette adresse mouna.fersi@gmail.com
merci d'avance

Commentaire de oukid le 18/03/2006 15:21:43

   Salut
Je veux utiliser votre programme mais j’ai d’énormes problèmes au niveau de l’édition de lien.
Les messages d’erreur affichés par le compilateur sont les suivants :
[Lieur Erreur] Unresolved external '_PacketGetAdapterNames' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ
pareil pour
          _PacketOpen Adapter
          _PacketSetHwFilter
          _PacketSetBuff
          _PacketSetReadTimeOut
          _PacketReceivePacket
          _PacketCloseAdapter
Je tiens  à vous indiquer que  j’utilise les bibliothèques Packet32.h et ntddndis.h du wpdpack, que j’ai placé le fichier packet.DLL dans les répertoires System et System32 et que j’ai aussi installé le winpcap.
          J’attends avec impatience votre réponse.
                               Merci.

Commentaire de bouchjrada le 15/04/2006 20:22:26

bonjour,
j'ai bien lu le code et la discussion ci-dessus, ensuite j'ai telecharger le fichier zip (WPdpack) et j'ai copie tous ses fichiers .h dans le dossier include de l'instalation de turbo c++ et de Dev-c++, j'ai installer aussi WinPcap et j'ai copie les fichiers .Dll de WPdpack dans les dossiers system et system32 et après tous cela j'assaié de comppiler le code sous turbo c++ et dev-c++, mais il ma donné les 23 erreurs suivants:
1---
7 C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31,               from main.cpp In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,               from main.cpp
2---
7 C:\projet\main.cpp                  from main.cpp
3--
32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
4--
8 C:\Dev-Cpp\include\packet32.h:25,               from main.cpp In file included from C:/Dev-Cpp/include/packet32.h:25,               from main.cpp
5--
8 C:\projet\main.cpp                  from main.cpp
6--
/Dev-Cpp/include/ntddpack.h C:\projet\C ntddndis.h: No such file or directory.
7---
8 C:\Dev-Cpp\include\packet32.h:25,               from main.cpp In file included from C:/Dev-Cpp/include/packet32.h:25,               from main.cpp
8--
8 C:\projet\main.cpp                  from main.cpp
9---
10 C:\Dev-Cpp\include\ntddpack.h `ULONG' does not name a type
10--
11 C:\Dev-Cpp\include\ntddpack.h `ULONG' does not name a type
11--
12 C:\Dev-Cpp\include\ntddpack.h `UCHAR' does not name a type
12---
9 C:\projet\main.cpp In file included from main.cpp
13--
1451 C:\Dev-Cpp\include\ntddndis1.h stray '\26' in program
14--
9 C:\projet\main.cpp In file included from main.cpp
15--
1451:2 C:\Dev-Cpp\include\ntddndis1.h [Warning] no newline at end of file
16--
C:\projet\main.cpp In function `void ip()':
17--
569 C:\projet\main.cpp `npf_if_addr' undeclared (first use this function)
18--
  (Each undeclared identifier is reported only once for each function it appears in.)
19---
569 C:\projet\main.cpp `L_adresse' undeclared (first use this function)
20--
576 C:\projet\main.cpp `PacketGetNetInfoEx' undeclared (first use this function)
20--
576 C:\projet\main.cpp At global scope:
--
598 C:\projet\main.cpp `main' must return `int'
21--
C:\projet\main.cpp In function `int main(...)':
22--
603 C:\projet\main.cpp `clrscr' undeclared (first use this function)
23--
C:\projet\Makefile.win [Build Error]  [main.o] Error 1

S.V.P est ce que quelqu'un peut me dire d'ou vient ces erreurs et Merci d'avance.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,530 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales