Nmap Development mailing list archives
Re: Status Report #16 of 17
From: Jack Grahl <mnvl16 () yahoo co uk>
Date: Mon, 10 Aug 2009 23:15:19 +0000 (GMT)
Regarding detecting the right ICMP packets. The following patch worked for me, but with one problem. When printing
stats at the end, every ICMP packet, not just the relevant ones, was included in the RCVD stats for all targets
combined, although the individual host stats were correct. This is because addRecvPacket is called in line 1613 just
above the part I changed, regardless of the packet.
I'm not sure how best to fix that, IF this is right solution.
Jack
--- nping/nping.cc 2009-08-11 00:00:33.000000000 +0100
+++ nping-build/nping.cc 2009-08-09 11:54:14.000000000 +0100
@@ -174,6 +174,7 @@
int do_safe_checks();
void test_stuff();
struct sockaddr_storage *getSrcSockAddrFromPacket(u8 *pkt, size_t pktLen);
+struct sockaddr_storage *getIcmpDestAddrFromPacket(u8 *pkt, size_t pktLen);
u16 *getSrcPortFromPacket(u8 *pkt, size_t pktLen);
u8 *getTCPheaderLocation(u8 *pkt, size_t pktLen);
@@ -1619,7 +1620,11 @@
trg->setProbeRecvTCP(*prt, 0);
}
}else if (o.getMode()==ICMP){
+ if(trg != NULL){
trg->setProbeRecvICMP(0, 0);
+ }else if (trg=o.targets.findTarget( getIcmpDestAddrFromPacket((u8*)packet, packetlen))){
+ trg->setProbeRecvICMP(0, 0);
+ }
}
break;
@@ -1857,6 +1862,25 @@
} /* End of getSrcSockAddrFromPacket() */
+/** @warning Returns pointer to an internal static buffer */
+struct sockaddr_storage *getIcmpDestAddrFromPacket(u8 *pkt, size_t pktLen){
+
+static struct sockaddr_storage ss;
+struct sockaddr_in *s_ip4=(struct sockaddr_in *)&ss;
+struct ip *i4=(struct ip*)pkt;
+memset(&ss, 0, sizeof(struct sockaddr_storage));
+
+ if(pkt==NULL || pktLen < 48)
+ return NULL;
+
+ s_ip4->sin_family=AF_INET;
+ memcpy(&(s_ip4->sin_addr.s_addr), pkt+44, 4);
+
+ return &ss;
+
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
Current thread:
- Status Report #16 of 17 Luis M. (Aug 10)
- Re: Status Report #16 of 17 Jack Grahl (Aug 10)
- Re: Status Report #16 of 17 Luis M. (Aug 11)
- Re: Status Report #16 of 17 Jack Grahl (Aug 12)
- Re: Status Report #16 of 17 Luis M. (Aug 11)
- <Possible follow-ups>
- Status Report #16 of 17 J Marlow (Aug 10)
- Re: Status Report #16 of 17 ithilgore (Aug 10)
- Re: Status Report #16 of 17 Joao Correa (Aug 10)
- Re: Status Report #16 of 17 Patrick Donnelly (Aug 10)
- Re: Status Report #16 of 17 venkat sanaka (Aug 11)
- Re: Status Report #16 of 17 Jack Grahl (Aug 10)
