Accueil > Forum > > > > Help!!!!
Help!!!!
mercredi 26 septembre 2007 à 10:13:01 |
Help!!!!

bayroom
|
Salut tout le monde, bon je fait un projet de sniffer+routteur en java, la partie sniff c'est OK mais le probléme est avec la partie routeur... J'ai trouvé un exemple en VB mais je n'arrive pas à le comprendre alors si vous pouvez me donner un coup de main et le recoder en java ou m'aider à le faire, je pollue je sait mais je suit vraiment dans l'impasse...Merci à tous...... Voici le code du routeur en VB; Public Sub Routes_Paquets(xProto As Byte, Donnee As String) ' on va router un paquet avec une nouvelle ip de destination On Error Resume Next 'on active ou désactive la prise en charge du protocole pour le routage If Form1.OptionRouteur(2).Value = 0 Then If xProto = 1 Then xProto = 0 ' icmp If Form1.OptionRouteur(1).Value = 0 Then If xProto = 17 Then xProto = 0 ' udp If Form1.OptionRouteur(0).Value = 0 Then If xProto = 6 Then xProto = 0 ' tcp ' on charge dans notre nouvelle entête eip,l'entete ip qu'on vient juste de sniffer With eIP ' entête ip .VerLen = &H45 .id = xEnteteIp.id .Offset = xEnteteIp.Offset .Ttl = xEnteteIp.Ttl .SourceIp = inet_addr(Form1.txtRouteur(0).Text) ' <-- nouvelle ip source .DestIp = inet_addr(Form1.txtRouteur(1).Text) '<-- nouvelle ip destination .Protocol = xProto .Tos = xEnteteIp.Tos .Checksum = 0 ' <--- nouveau checksum à recalculé .Checksum = UnsignedToInteger(Check.Checksum(VarPtr(eIP), LenB(eIP))) End With
If eIP.Protocol = 6 Or eIP.Protocol = 17 Then 'pseudo entete uniquement pour tcp ou udp ' pseudo entête uniquement pour le calcule du checksum With ePS .IPsource = eIP.SourceIp .IPdestination = eIP.DestIp .Protocol = eIP.Protocol .Reserved = 0 End With End If
Select Case xProto Case 6 ' = TCP ePS.Len = ntohs(LenB(eTCP) + UBound(xData)) '<- taille pseudoEntete With eTCP .Ack = xEnteteTcp.Ack .DataOffset = xEnteteTcp.DataOffset .Flag = xEnteteTcp.Flag .PortDesti = xEnteteTcp.PortDesti .PortSource = xEnteteTcp.PortSource .Sequence = xEnteteTcp.Sequence .UrgentPointer = xEnteteTcp.UrgentPointer .Windows = xEnteteTcp.Windows .Checksum = 0 .Checksum = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData))) End With eIP.TotalLength = ntohs(LenB(eIP) + LenB(eTCP) + UBound(xData)) ' taille entête ip Case 17 ' = UDP ePS.Len = ntohs(LenB(eUDP) + UBound(xData)) With eUDP ' on garde les mêmes valeurs du paquet qu'on à sniffer pour notre nouvelle entête .SourcePort = xEnteteUdp.SourcePort .DestPort = xEnteteUdp.DestPort .udpChecksum = 0 .Len = ePS.Len ' <- nouvelle taille de l'entête udp End With 'on calcule le checksum pour l'entete udp eUDP.udpChecksum = UnsignedToInteger(CheckUdp(VarPtr(ePS), LenB(ePS), VarPtr(eUDP), LenB(eUDP), VarPtr(xData(0)), UBound(xData))) eIP.TotalLength = ntohs((LenB(eIP) + LenB(eUDP) + UBound(xData))) ' taille entête ip Case 1 ' = ICMP With eICMP ' entête icmp , on garde les mêmes valeurs .Type = xEnteteIcmp.Type .Code = xEnteteIcmp.Code .Identifiant = xEnteteIcmp.Identifiant .Sequence = xEnteteIcmp.Sequence .Checksum = xEnteteIcmp.Checksum End With eIP.TotalLength = ntohs(LenB(eIP) + LenB(eICMP) + UBound(xData)) ' taille entête ip End Select
Dim xPaquet() As Byte ' on forge notre trame = Entête ip + datagramme(entête tcp ou icmp ou udp +data) Select Case xProto Case 6 'on forge un paquet TCP ReDim xPaquet(LenB(eIP) + LenB(eTCP) + UBound(xData)) CopyMemory ByVal VarPtr(xPaquet(0)), ByVal VarPtr(eIP), LenB(eIP) CopyMemory ByVal VarPtr(xPaquet(LenB(eIP))), ByVal VarPtr(eTCP), LenB(eTCP) CopyMemory ByVal VarPtr(xPaquet(LenB(eIP) + LenB(eTCP))), ByVal VarPtr(xData(0)), UBound(xData) Case 17 'on forge un paquet UDP ReDim xPaquet(LenB(eIP) + LenB(eUDP) + UBound(xData)) CopyMemory ByVal VarPtr(xPaquet(0)), ByVal VarPtr(eIP), LenB(eIP) CopyMemory ByVal VarPtr(xPaquet(LenB(eIP))), ByVal VarPtr(eUDP), LenB(eUDP) CopyMemory ByVal VarPtr(xPaquet(LenB(eIP) + LenB(eUDP))), ByVal VarPtr(xData(0)), UBound(xData) Case 1 ' on forge un paquet ICMP ReDim xPaquet(LenB(eIP) + LenB(eICMP) + UBound(xData)) CopyMemory ByVal VarPtr(xPaquet(0)), ByVal VarPtr(eIP), LenB(eIP) CopyMemory ByVal VarPtr(xPaquet(LenB(eIP))), ByVal VarPtr(eICMP), LenB(eICMP) CopyMemory ByVal VarPtr(xPaquet(LenB(eIP) + LenB(eICMP))), ByVal VarPtr(xData(0)), UBound(xData) End Select ' structure de destinantion Call CreateSocket(VarPtr(xPaquet(0)), CInt(xProto)) Dim SockAddr As SOCK_ADDR SockAddr.sin_zero(0) = 0 SockAddr.sin_family = AF_INET '<-famille protocole If xProto = 6 Then SockAddr.sin_port = xEnteteTcp.PortDesti ' port de destination pour tcp If xProto = 17 Then SockAddr.sin_port = xEnteteUdp.DestPort ' port de destination pour udp ' <-------------- rien pour icmp,pas de port -------------------------> SockAddr.sin_addr.S_addr = eIP.DestIp ' adresse de destination ' la fonction Sendto va nous permettre d'envoyer un paquet à une adresse spécifiée par la structure to de type sockaddr. SendData = sendto(zSock, ByVal VarPtr(xPaquet(0)), UBound(xPaquet), 0, SockAddr, LenB(SockAddr)) If SendData > 0 Then Debug.Print "envoi réussi" ' Compteur de paquet router Select Case xProto ' mise à jour Case 1 Form1.OptionRouteur(2).Tag = Form1.OptionRouteur(2).Tag + 1 Form1.OptionRouteur(2).Caption = "ICMP (" & Form1.OptionRouteur(2).Tag & ")" Case 17 Form1.OptionRouteur(1).Tag = Form1.OptionRouteur(1).Tag + 1 Form1.OptionRouteur(1).Caption = "UDP (" & Form1.OptionRouteur(1).Tag & ")" Case 6 Form1.OptionRouteur(0).Tag = Form1.OptionRouteur(0).Tag + 1 Form1.OptionRouteur(0).Caption = "TCP (" & Form1.OptionRouteur(0).Tag & ")" End Select Form1.Label2(4).Tag = Form1.Label2(4).Tag + 1: Form1.Label2(4).Caption = "ROUTE : " & Form1.Label2(4).Tag Else Debug.Print "erreur envoi" End If Call ListePaquet(Donnee, CInt(xProto)) End Sub Public Sub CreateSocket(adrs As Long, Proto As Integer) Dim StartupInfo As WSA_DATA WSAStartup &H202, StartupInfo If Proto = 6 Or Proto = 1 Then zSock = socket(AF_INET, SOCK_RAW, Proto) Else zSock = socket(AF_INET, SOCK_DGRAM, 17) setsockopt zSock, IPPROTO_IP, IP_HDRINCL, adrs, 4 End Sub Sub ListePaquet(xData As String, Proto As Integer) Dim Parent As Node, EnteteA As Node, EnteteB As Node, flags As Node, Titre As String, Info As String
If Proto = 6 Then Titre = "Entete Tcp" Else If Proto = 17 Then Titre = "Entete Udp" Else Titre = "Entete Icmp" Info = FonctionIp(eIP.SourceIp) & " --> " & FonctionIp(eIP.DestIp) & Space(10) & IIf(Proto = 1, vbNullString, Mid(xData, 1, 70) & "...") ' on quitte si le protocole ne correspond pas à TCP Or UDP Or ICMP If Proto <> 6 And Proto <> 17 And Proto <> 1 Then Exit Sub Set Parent = Form1.Tree(2).Nodes.Add(): Parent = Info: Parent.Image = 1 Set EnteteA = Form1.Tree(2).Nodes.Add(Parent, tvwChild): EnteteA = "Entete ip": EnteteA.Image = 2 Set EnteteB = Form1.Tree(2).Nodes.Add(Parent, tvwChild): EnteteB = Titre: EnteteB.Image = 2 Parent.Tag = xData EnteteA.Tag = xEnteteIp.SourceIp With eIP ' on affiche les valeurs des entetes ip Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "Source IP . . . . . . . . . " & FonctionIp(.SourceIp), 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "Destination IP . . . . . . . . . " & FonctionIp(.DestIp), 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "Time To Live (TTL) . . . . . . . . . " & .Ttl, 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "IP Version . . . . . . . . .IPv" & HiNibble(.VerLen), 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "Identification . . . . . . . . . " & IntegerToUnsigned(.id), 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "DataOffset. . . . . . . . ." & IntegerToUnsigned(ntohs(.Offset)), 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "Checksum . . . . . . . . . " & IntegerToUnsigned(ntohs(.Checksum)), 3 Form1.Tree(2).Nodes.Add EnteteA, tvwChild, , "Longueur . . . . . . . . . " & ntohs(.TotalLength), 3 End With Select Case Proto Case 1 With eICMP ' ICMP Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Type. . . . . . . . . " & IcmpTypeValeur(.Type), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Code . . . . . . . . ." & IcmpCodeValeur(.Type, .Code), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Checksum . . . . . . . ." & IntegerToUnsigned(ntohs(.Checksum)), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Identifiant. . . . . . . . ." & ntohl(.Identifiant), 3 End With Case 6 With eTCP ' TCP Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Source Port. . . . . . . . ." & ntohs(.PortSource), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Dest Port. . . . . . . . ." & ntohs(.PortDesti), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "DataOffset. . . . . . . . ." & IntegerToUnsigned(ntohs(.DataOffset)), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Ack. . . . . . . . ." & LongToUnsigned(ntohl(.Ack)), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Sequence. . . . . . . . ." & LongToUnsigned(ntohl(.Sequence)), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Urgent Pointer. . . . . . . . ." & ntohs(.UrgentPointer), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Windows. . . . . . . . ." & ntohs(.Windows), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Checksum . . . . . . . . ." & IntegerToUnsigned(ntohs(.Checksum)), 3 End With Case 17 With eUDP ' UDP Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Source Port. . . . . . . . ." & ntohs(.SourcePort), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Dest Port. . . . . . . . ." & ntohs(.DestPort), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Longueur. . . . . . . . ." & ntohs(.Len), 3 Form1.Tree(2).Nodes.Add EnteteB, tvwChild, , "Checksum. . . . . . . . ." & IntegerToUnsigned(ntohs(.udpChecksum)), 3 End With End Select End Sub
|
|
mercredi 26 septembre 2007 à 11:45:15 |
Re : Help!!!!

_Syl_
|
Réponse acceptée !
Bonjour,
Voilà le code traduit en C#, la syntaxe de java et de C# étant proche (plus en tout cas que VB et java) ca devrait t'aider un peu.
public void Routes_Paquets(byte xProto, string Donnee) {
// on va router un paquet avec une nouvelle ip de destination
// TODO: On Error Resume Next Warning!!!: The statement is not translatable
if ((Form1.OptionRouteur(2).Value == 0)) {
if ((xProto == 1)) {
xProto = 0;
}
}
// icmp
if ((Form1.OptionRouteur(1).Value == 0)) {
if ((xProto == 17)) {
xProto = 0;
}
}
// udp
if ((Form1.OptionRouteur(0).Value == 0)) {
if ((xProto == 6)) {
xProto = 0;
}
}
// tcp
// on charge dans notre nouvelle ent�te eip,l'entete ip qu'on vient juste de sniffer
// With...
// ent�te ip
xEnteteIp.Ttl.SourceIp = inet_addr(Form1.txtRouteur(0).Text);
xEnteteIp.Offset.Ttl = inet_addr(Form1.txtRouteur(0).Text);
xEnteteIp.id.Offset = inet_addr(Form1.txtRouteur(0).Text);
69.id = inet_addr(Form1.txtRouteur(0).Text);
eIP.VerLen = inet_addr(Form1.txtRouteur(0).Text);
// <-- nouvelle ip source
eIP.DestIp = inet_addr(Form1.txtRouteur(1).Text);
// <-- nouvelle ip destination
xEnteteIp.Tos.Checksum = 0;
xProto.Tos = 0;
eIP.Protocol = 0;
// <--- nouveau checksum � recalcul�
eIP.Checksum = UnsignedToInteger(Check.Checksum(VarPtr(eIP), LenB(eIP)));
if (((eIP.Protocol == 6)
|| (eIP.Protocol == 17))) {
// pseudo entete uniquement pour tcp ou udp
// pseudo ent�te uniquement pour le calcule du checksum
// With...
eIP.DestIp.Protocol = 0;
eIP.SourceIp.IPdestination = 0;
ePS.IPsource = 0;
}
switch (xProto) {
case 6:
// = TCP
ePS.Len = ntohs((LenB(eTCP) + UBound(xData)));
// <- taille pseudoEntete
// With...
xEnteteTcp.Windows.Checksum = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.UrgentPointer.Windows = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.Sequence.UrgentPointer = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.PortSource.Sequence = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.PortDesti.PortSource = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.Flag.PortDesti = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.DataOffset.Flag = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
xEnteteTcp.Ack.DataOffset = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
eTCP.Ack = UnsignedToInteger(CheckTcp(VarPtr(ePS), LenB(ePS), VarPtr(eTCP), LenB(eTCP), VarPtr(xData(0)), UBound(xData)));
eIP.TotalLength = ntohs((LenB(eIP)
+ (LenB(eTCP) + UBound(xData))));
// taille ent�te ip
break;
case 17:
// = UDP
ePS.Len = ntohs((LenB(eUDP) + UBound(xData)));
// With...
// on garde les m�mes valeurs du paquet qu'on � sniffer pour notre nouvelle ent�te
0.Len = ePS.Len;
xEnteteUdp.DestPort.udpChecksum = ePS.Len;
xEnteteUdp.SourcePort.DestPort = ePS.Len;
eUDP.SourcePort = ePS.Len;
// <- nouvelle taille de l'ent�te udp
// on calcule le checksum pour l'entete udp
eUDP.udpChecksum = UnsignedToInteger(CheckUdp(VarPtr(ePS), LenB(ePS), VarPtr(eUDP), LenB(eUDP), VarPtr(xData(0)), UBound(xData)));
eIP.TotalLength = ntohs((LenB(eIP)
+ (LenB(eUDP) + UBound(xData))));
// taille ent�te ip
break;
case 1:
// = ICMP
// With...
// ent�te icmp , on garde les m�mes valeurs
xEnteteIcmp.Sequence.Checksum = xEnteteIcmp.Checksum;
xEnteteIcmp.Identifiant.Sequence = xEnteteIcmp.Checksum;
xEnteteIcmp.Code.Identifiant = xEnteteIcmp.Checksum;
xEnteteIcmp.Type.Code = xEnteteIcmp.Checksum;
eICMP.Type = xEnteteIcmp.Checksum;
eIP.TotalLength = ntohs((LenB(eIP)
+ (LenB(eICMP) + UBound(xData))));
// taille ent�te ip
break;
}
byte[] xPaquet;
// on forge notre trame = Ent�te ip + datagramme(ent�te tcp ou icmp ou udp +data)
switch (xProto) {
case 6:
// on forge un paquet TCP
object xPaquet;
CopyMemory;
VarPtr(xPaquet[0]);
VarPtr(eIP);
LenB(eIP);
CopyMemory;
VarPtr(xPaquet[LenB(eIP)]);
VarPtr(eTCP);
LenB(eTCP);
CopyMemory;
VarPtr(xPaquet[(LenB(eIP) + LenB(eTCP))]);
VarPtr(xData(0));
UBound(xData);
break;
case 17:
// on forge un paquet UDP
object xPaquet;
CopyMemory;
VarPtr(xPaquet[0]);
VarPtr(eIP);
LenB(eIP);
CopyMemory;
VarPtr(xPaquet[LenB(eIP)]);
VarPtr(eUDP);
LenB(eUDP);
CopyMemory;
VarPtr(xPaquet[(LenB(eIP) + LenB(eUDP))]);
VarPtr(xData(0));
UBound(xData);
break;
case 1:
// on forge un paquet ICMP
object xPaquet;
CopyMemory;
VarPtr(xPaquet[0]);
VarPtr(eIP);
LenB(eIP);
CopyMemory;
VarPtr(xPaquet[LenB(eIP)]);
VarPtr(eICMP);
LenB(eICMP);
CopyMemory;
VarPtr(xPaquet[(LenB(eIP) + LenB(eICMP))]);
VarPtr(xData(0));
UBound(xData);
break;
}
// structure de destinantion
CreateSocket(VarPtr(xPaquet[0]), int.Parse(xProto));
SOCK_ADDR SockAddr;
SockAddr.sin_zero(0) = 0;
SockAddr.sin_family = AF_INET;
// <-famille protocole
if ((xProto == 6)) {
SockAddr.sin_port = xEnteteTcp.PortDesti;
}
// port de destination pour tcp
if ((xProto == 17)) {
SockAddr.sin_port = xEnteteUdp.DestPort;
}
// port de destination pour udp
// <-------------- rien pour icmp,pas de port ------------------------->
SockAddr.sin_addr.S_addr = eIP.DestIp;
// adresse de destination
// la fonction Sendto va nous permettre d'envoyer un paquet � une adresse sp�cifi�e par la structure to de type sockaddr.
SendData = sendto(zSock, VarPtr(xPaquet[0]), UBound(xPaquet), 0, SockAddr, LenB(SockAddr));
if ((SendData > 0)) {
Debug.Print;
"envoi r�ussi";
switch (xProto) {
case 1:
Form1.OptionRouteur(2).Tag = (Form1.OptionRouteur(2).Tag + 1);
Form1.OptionRouteur(2).Caption = ("ICMP ("
+ (Form1.OptionRouteur(2).Tag + ")"));
break;
case 17:
Form1.OptionRouteur(1).Tag = (Form1.OptionRouteur(1).Tag + 1);
Form1.OptionRouteur(1).Caption = ("UDP ("
+ (Form1.OptionRouteur(1).Tag + ")"));
break;
case 6:
Form1.OptionRouteur(0).Tag = (Form1.OptionRouteur(0).Tag + 1);
Form1.OptionRouteur(0).Caption = ("TCP ("
+ (Form1.OptionRouteur(0).Tag + ")"));
break;
}
Form1.Label2(4).Tag = (Form1.Label2(4).Tag + 1);
Form1.Label2(4).Caption = ("ROUTE : " + Form1.Label2(4).Tag);
}
else {
Debug.Print;
"erreur envoi";
}
ListePaquet(Donnee, int.Parse(xProto));
}
public void CreateSocket(long adrs, int Proto) {
WSA_DATA StartupInfo;
WSAStartup;
514;
StartupInfo;
if (((Proto == 6)
|| (Proto == 1))) {
zSock = socket(AF_INET, SOCK_RAW, Proto);
}
else {
zSock = socket(AF_INET, SOCK_DGRAM, 17);
}
setsockopt;
zSock;
IPPROTO_IP;
IP_HDRINCL;
adrs;
4;
}
void ListePaquet(string xData, int Proto) {
Node Parent;
Node EnteteA;
Node EnteteB;
Node flags;
string Titre;
string Info;
if ((Proto == 6)) {
Titre = "Entete Tcp";
}
else if ((Proto == 17)) {
Titre = "Entete Udp";
}
else {
Titre = "Entete Icmp";
}
Info = (FonctionIp(eIP.SourceIp) + (" --> "
+ (FonctionIp(eIP.DestIp)
+ (Space(10) + ( (Proto == 1) ? null : (xData.Substring(0, 70) + "...") )))));
// on quitte si le protocole ne correspond pas � TCP Or UDP Or ICMP
if (((Proto != 6)
&& ((Proto != 17)
&& (Proto != 1)))) {
return;
}
Parent = Form1.Tree(2).Nodes.Add();
Parent = Info;
Parent.Image = 1;
EnteteA = Form1.Tree(2).Nodes.Add(Parent, tvwChild);
EnteteA = "Entete ip";
EnteteA.Image = 2;
EnteteB = Form1.Tree(2).Nodes.Add(Parent, tvwChild);
EnteteB = Titre;
EnteteB.Image = 2;
Parent.Tag = xData;
EnteteA.Tag = xEnteteIp.SourceIp;
// With...
// on affiche les valeurs des entetes ip
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("Source IP . . . . . . . . . " + FonctionIp(eIP.SourceIp));
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("Destination IP . . . . . . . . . " + FonctionIp(eIP.DestIp));
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("Time To Live (TTL) . . . . . . . . . " + eIP.Ttl);
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("IP Version . . . . . . . . .IPv" + HiNibble(eIP.VerLen));
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("Identification . . . . . . . . . " + IntegerToUnsigned(eIP.id));
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("DataOffset. . . . . . . . ." + IntegerToUnsigned(ntohs(eIP.Offset)));
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("Checksum . . . . . . . . . " + IntegerToUnsigned(ntohs(eIP.Checksum)));
3;
Form1.Tree(2).Nodes.Add;
EnteteA;
tvwChild;
("Longueur . . . . . . . . . " + ntohs(eIP.TotalLength));
3;
switch (Proto) {
case 1:
// With...
// ICMP
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Type. . . . . . . . . " + IcmpTypeValeur(eICMP.Type));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Code . . . . . . . . ." + IcmpCodeValeur(eICMP.Type, eICMP.Code));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Checksum . . . . . . . ." + IntegerToUnsigned(ntohs(eICMP.Checksum)));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Identifiant. . . . . . . . ." + ntohl(eICMP.Identifiant));
3;
break;
case 6:
// With...
// TCP
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Source Port. . . . . . . . ." + ntohs(eTCP.PortSource));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Dest Port. . . . . . . . ." + ntohs(eTCP.PortDesti));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("DataOffset. . . . . . . . ." + IntegerToUnsigned(ntohs(eTCP.DataOffset)));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Ack. . . . . . . . ." + LongToUnsigned(ntohl(eTCP.Ack)));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Sequence. . . . . . . . ." + LongToUnsigned(ntohl(eTCP.Sequence)));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Urgent Pointer. . . . . . . . ." + ntohs(eTCP.UrgentPointer));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Windows. . . . . . . . ." + ntohs(eTCP.Windows));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Checksum . . . . . . . . ." + IntegerToUnsigned(ntohs(eTCP.Checksum)));
3;
break;
case 17:
// With...
// UDP
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Source Port. . . . . . . . ." + ntohs(eUDP.SourcePort));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Dest Port. . . . . . . . ." + ntohs(eUDP.DestPort));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Longueur. . . . . . . . ." + ntohs(eUDP.Len));
3;
Form1.Tree(2).Nodes.Add;
EnteteB;
tvwChild;
("Checksum. . . . . . . . ." + IntegerToUnsigned(ntohs(eUDP.udpChecksum)));
3;
break;
}
}
pour info, voici le lien d'un traducteur VB->C# : http://www.carlosag.net/Tools/CodeTranslator/Default.aspx
En esperant avoir aidé un peu
Bonne fin de journée
|
|
mercredi 26 septembre 2007 à 15:44:45 |
Re : Help!!!!
|
vendredi 28 septembre 2007 à 12:22:00 |
Re : Help!!!!

bayroom
|
Je vous présente toutes mes excuses pour le mal que j'ai fait, je ne savais pas quoi faire et j'ai perdu beaucoup de temp à chercher sans trouver, la prochaine fois je veillerais à mieux respecter le reglement, désolé encore...
A présent il va me faloir demander encore de l'aide pour trouver comment exprimer ma gratitude enver _Syl_; vous m'avez beaucoup aidé et encore merci pour le traducteur, j'épère bien avoir la chance de vous rendre ce service un jour...
|
|
Cette discussion est classée dans : form1, tree, eip, varptr, lenb
Répondre à ce message
Sujets en rapport avec ce message
validation de deux formulaire [ par jfkill ]
J'ai deux formulaire sur une meme page et je veux valider c'est deux formulaire de facon indépendanteParce que j'en ai un francais et un autre anglais
Où trouver le package com.sun.xml.tree ? [ par Tara ]
Bonjour à tous,J'aimerais générer un fichier xml. Pour cela , j'ai besoin du package com.sun.xml.tree pour utiliser XmlDocument, mais impossible de tr
création d'un arbre (tree) [ par logarfr ]
Je suis en train de réaliser une application en servlet. Je récupère d'une base de données des répertoires. J'aimerais réaliser un arbre avec ces répe
icone et tree [ par WhereIsRomeo ]
bonjour, j'ai construit une arborescence et je voudrais changer l'icone de chaque noeud en fonction du contenu de ce noeudest-ce possible ?j'ai essaye
tree maching [ par skatchoula ]
j'ai besoin d'une version en java d'un algorithme de comparaison de deux arbres (tree maching). De préférence celui de Kuo Chung Tai ou celui de Zhang
[Jtree][TreeExpansionListener][débutant}Problèmes multiples... [ par Wahoo ]
Bonjour,je rencontre actuellement un problème avec mon Jtree et mon TreeExpansionListener.Voici une partie de code:TreeExpansionListener texl = new Tr
Pb Jtree et icone !!! grrrrrrrrrr [ par fmazoue ]
ENcore un problème ! Ca change !Bon voilà que j'explique ce qui me tracasse !J'ai fait un JTree qui permet d'avoir une arborescence de ses fichier de
Filtre sur un tree model [ par p0236 ]
Bojour a tous , je voulais savoir si c'était possible (je sais que oui car tout est possible) de faire un filtre sur un treemodelMerci d'avance<img sr
JScrollPane dans un JPanel [ par c1rd3c ]
Bonjour, J'ai un JPanel dans le lequel je ve mettre un JScrollBar pour pouvoir mon arbre a l'interieur. Voici mon code source : TreePanel = new JPan
JTree et MouseListener [ par nounouX ]
Salut a tous, Voila je suis toujours sur mon "messenger like" :D, bon grace a vos conseille j ai reussi a faire un jolie Jtree etc... seulement voila,
Livres en rapport
|
Derniers Blogs
TECHDAYS PARIS 2010 : SHAREPOINT 2010 POUR LES DéVELOPPEURSTECHDAYS PARIS 2010 : SHAREPOINT 2010 POUR LES DéVELOPPEURS par ROMELARD Fabrice
Animé par: Laurent Cotton Le développement dans SharePoint 2010 passe par plusieurs axes qui seront évoqués dans cette session, mais plus particulièrement les développements simples lié au besoin Business Business Connectivity Services Ce BCS es...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : PLEINIèRE DERNIER JOURTECHDAYS PARIS 2010 : PLEINIèRE DERNIER JOUR par ROMELARD Fabrice
Cette session est la dernière pleinière de ces 3 jours de TechDays Paris 2010. Généralement, cette troisième journée est plus axée sur l'avenir vu par Microsoft. Après un retour sur l'avenir vu par la Science Fiction ou par ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|