diff -ru hafiye-1.0/Packet.c hafiye-1.0-pl1/Packet.c --- hafiye-1.0/Packet.c Thu Jun 13 01:43:35 2002 +++ hafiye-1.0-pl1/Packet.c Wed Aug 25 10:25:11 2004 @@ -113,6 +113,8 @@ int protident; struct in_addr in; unsigned retn = 0; + int i = 0, j = 0; + u_char *pptr = NULL; if (proto < 0) return; @@ -125,7 +127,12 @@ if((p = lfour[proto]) == NULL) { fprintf(stderr, "layer_four_packet_handler: I don't have protocol knowledge base for Protocol ID: %d\nPlease add knowledge base information with Protocol_Id=%d to Layer IV knowledge base\nand restart me!\n", proto, proto); fprintf(stderr, "Dumping packet contents...\n"); - fwrite(packet, sizeof(char), len, stdout); + for (i = 0; i < len; i++) { + if (isgraph(packet[i]) || isspace(packet[i])) + fputc(packet[i], stdout); + else + fputc('.', stdout); + } fwrite("\n", sizeof(char), 1, stdout); fflush(stdout); return; @@ -146,7 +153,15 @@ printf("\t\tPacket Payload Dump: \n"); if (p != NULL) { - fwrite(packet + p->len, sizeof(char), len - p->len, stdout); + pptr = packet + p->len; + j = len - p->len; + for (i = 0; i < j; i++) { + if (isgraph(pptr[i]) || isspace(packet[i])) + fputc(packet[i], stdout); + else + fputc('.', stdout); + } + fwrite("\n", sizeof(char), 1, stdout); fflush(stdout); } }