This commit is contained in:
parent
701987af2c
commit
4e23ebe167
2
ars.h
2
ars.h
@ -381,7 +381,7 @@ struct ars_layer_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* ARS layer info table */
|
/* ARS layer info table */
|
||||||
struct ars_layer_info ars_linfo[ARS_TYPE_SIZE];
|
//struct ars_layer_info ars_linfo[ARS_TYPE_SIZE];
|
||||||
|
|
||||||
/* ARS interface managment structure and defines */
|
/* ARS interface managment structure and defines */
|
||||||
#define ARS_IF_UP (1 << 0)
|
#define ARS_IF_UP (1 << 0)
|
||||||
|
2
hping2.h
2
hping2.h
@ -409,7 +409,7 @@ struct delaytable_element {
|
|||||||
int status;
|
int status;
|
||||||
};
|
};
|
||||||
|
|
||||||
volatile struct delaytable_element delaytable[TABLESIZE];
|
//volatile struct delaytable_element delaytable[TABLESIZE];
|
||||||
|
|
||||||
/* protos */
|
/* protos */
|
||||||
void nop(void); /* nop */
|
void nop(void); /* nop */
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#ifndef _RELEASE_H
|
#ifndef _RELEASE_H
|
||||||
#define _RELEASE_H
|
#define _RELEASE_H
|
||||||
|
|
||||||
#define RELEASE_VERSION "3.0.0-koszik"
|
#define RELEASE_VERSION "3.0.1-koszik"
|
||||||
#define RELEASE_DATE "Sun Apr 16 07:19:17 CEST 2006"
|
#define RELEASE_DATE __TIME__
|
||||||
#define CONTACTS "<koszik@atw.hu>"
|
#define CONTACTS "<koszik@atw.hu>"
|
||||||
|
|
||||||
#endif /* _RELEASE_H */
|
#endif /* _RELEASE_H */
|
||||||
|
25
statistics.c
25
statistics.c
@ -18,28 +18,27 @@
|
|||||||
void print_statistics(int signal_id)
|
void print_statistics(int signal_id)
|
||||||
{
|
{
|
||||||
unsigned int lossrate;
|
unsigned int lossrate;
|
||||||
|
uint32_t losspack=0;
|
||||||
#if (defined OSTYPE_LINUX) && (!defined FORCE_LIBPCAP)
|
#if (defined OSTYPE_LINUX) && (!defined FORCE_LIBPCAP)
|
||||||
close_sockpacket(sockpacket);
|
close_sockpacket(sockpacket);
|
||||||
#else
|
#else
|
||||||
close_pcap();
|
close_pcap();
|
||||||
#endif /* OSTYPE_LINUX && !FORCE_LIBPCAP */
|
#endif /* OSTYPE_LINUX && !FORCE_LIBPCAP */
|
||||||
|
|
||||||
if (recv_pkt > 0)
|
if (recv_pkt > 0){
|
||||||
lossrate = 100 - ((recv_pkt*100)/sent_pkt);
|
losspack=(recv_pkt<sent_pkt)?recv_pkt/sent_pkt:0;
|
||||||
else
|
lossrate = 100 - ((recv_pkt*100)/sent_pkt);
|
||||||
if (!sent_pkt)
|
}else{
|
||||||
lossrate = 0;
|
losspack=!sent_pkt?0:sent_pkt;
|
||||||
else
|
lossrate=!sent_pkt?0:100;
|
||||||
lossrate = 100;
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\n--- %s hping statistic ---\n", targetname);
|
fprintf(stderr, "\n--- %s 统计 ---\n", targetname);
|
||||||
fprintf(stderr, "%d packets transmitted, %d packets received, "
|
fprintf(stderr, "发送: %d|收到: %d|%d%% 丢包率|丢了 %d 个包\n", sent_pkt, recv_pkt, lossrate,losspack);
|
||||||
"%d%% packet loss\n", sent_pkt, recv_pkt, lossrate);
|
|
||||||
if (out_of_sequence_pkt)
|
if (out_of_sequence_pkt)
|
||||||
fprintf(stderr, "%d out of sequence packets received\n",
|
fprintf(stderr, "已收到 %d 个乱序数据包\n",
|
||||||
out_of_sequence_pkt);
|
out_of_sequence_pkt);
|
||||||
fprintf(stderr, "round-trip min/avg/max = %.1f/%.1f/%.1f ms\n",
|
fprintf(stderr, "往返时间:\n最小:%.1f 毫秒\n平均: %.1f 毫秒\n最大:%.1f 毫秒\n",
|
||||||
rtt_min, rtt_avg, rtt_max);
|
rtt_min, rtt_avg, rtt_max);
|
||||||
|
|
||||||
/* manage exit code */
|
/* manage exit code */
|
||||||
|
16
waitpacket.c
16
waitpacket.c
@ -220,12 +220,12 @@ log_ipv4(int status, int sequence)
|
|||||||
rel_id = relativize_id(sequence, &ip_id);
|
rel_id = relativize_id(sequence, &ip_id);
|
||||||
else
|
else
|
||||||
rel_id = 0;
|
rel_id = 0;
|
||||||
printf("len=%d ip=%s ttl=%d %sid%s%d ", ip_size, inet_ntoa(src),
|
printf("\033[1;36m长度=%d ip=%s ttl=%d %sid%s%d ", ip_size, inet_ntoa(src),
|
||||||
ip->ttl,
|
ip->ttl,
|
||||||
(ntohs(ip->frag_off) ? "DF " : ""),
|
(ntohs(ip->frag_off) ? "DF " : ""),
|
||||||
(rel_id ? "=+" : "="), ip_id);
|
(rel_id ? "=+" : "="), ip_id);
|
||||||
if (opt_verbose && !opt_quiet)
|
if (opt_verbose && !opt_quiet)
|
||||||
printf("tos=%x iplen=%u\n", ip->tos, htons(ip->tot_len));
|
printf("tos=%x ip长度=%u\n", ip->tos, htons(ip->tot_len));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -233,7 +233,7 @@ log_ipv6(int status, int sequence)
|
|||||||
{
|
{
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
|
|
||||||
printf("len=%d ip=%s ttl=%d ", ip_size, inet_ntop(opt_af, &src6, tmp, sizeof(tmp)),
|
printf("\033[1;35m长度=%d ip=%s ttl=%d ", ip_size, inet_ntop(opt_af, &src6, tmp, sizeof(tmp)),
|
||||||
ip6->hoplimit);
|
ip6->hoplimit);
|
||||||
if (opt_verbose && !opt_quiet)
|
if (opt_verbose && !opt_quiet)
|
||||||
printf("tc=%x flowlabel=%u\n", (ip6->tc1 << 4) | ip6->tc2, (ip6->flowlabel1 << 16) | ip6->flowlabel2);
|
printf("tc=%x flowlabel=%u\n", (ip6->tc1 << 4) | ip6->tc2, (ip6->flowlabel1 << 16) | ip6->flowlabel2);
|
||||||
@ -304,7 +304,7 @@ void log_traceroute(void *packet, int size, int icmp_code)
|
|||||||
log_icmp_timeexc(inet_ntop(opt_af, &src6, tmp, sizeof(tmp)), icmp_code);
|
log_icmp_timeexc(inet_ntop(opt_af, &src6, tmp, sizeof(tmp)), icmp_code);
|
||||||
}
|
}
|
||||||
if (retval != -1)
|
if (retval != -1)
|
||||||
printf(" hoprtt=%.1f ms", rtt);
|
printf(" hoprtt=%.1f 毫秒", rtt);
|
||||||
if (!opt_tr_keep_ttl)
|
if (!opt_tr_keep_ttl)
|
||||||
src_ttl++;
|
src_ttl++;
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@ -338,7 +338,7 @@ int recv_icmp(void *packet, size_t size)
|
|||||||
status = rtt(&icmp_seq, 0, &ms_delay);
|
status = rtt(&icmp_seq, 0, &ms_delay);
|
||||||
log_ip(status, icmp_seq);
|
log_ip(status, icmp_seq);
|
||||||
|
|
||||||
printf("icmp_seq=%d rtt=%.1f ms\n", icmp_seq, ms_delay);
|
printf("icmp_seq=%d 往返时间=%.2f 毫秒\n", icmp_seq, ms_delay);
|
||||||
if (icmp->type == ICMP_TIMESTAMPREPLY) {
|
if (icmp->type == ICMP_TIMESTAMPREPLY) {
|
||||||
if ((size - ICMPHDR_SIZE) >= 12)
|
if ((size - ICMPHDR_SIZE) >= 12)
|
||||||
log_icmp_ts(packet+ICMPHDR_SIZE);
|
log_icmp_ts(packet+ICMPHDR_SIZE);
|
||||||
@ -416,7 +416,7 @@ int recv_icmp6(void *packet, size_t size)
|
|||||||
status = rtt(&icmp_seq, 0, &ms_delay);
|
status = rtt(&icmp_seq, 0, &ms_delay);
|
||||||
log_ip(status, icmp_seq);
|
log_ip(status, icmp_seq);
|
||||||
|
|
||||||
printf("icmp_seq=%d rtt=%.1f ms\n", icmp_seq, ms_delay);
|
printf("icmp_seq=%d 往返时间=%.2f 毫秒\n", icmp_seq, ms_delay);
|
||||||
notrace = 1;
|
notrace = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ int recv_udp(void *packet, size_t size)
|
|||||||
status = rtt(&sequence, ntohs(udp.uh_dport), &ms_delay);
|
status = rtt(&sequence, ntohs(udp.uh_dport), &ms_delay);
|
||||||
if (!opt_quiet) {
|
if (!opt_quiet) {
|
||||||
log_ip(status, sequence);
|
log_ip(status, sequence);
|
||||||
printf("seq=%d rtt=%.1f ms\n", sequence, ms_delay);
|
printf("seq=%d 往返时间=%.2f 毫秒\n", sequence, ms_delay);
|
||||||
}
|
}
|
||||||
if (opt_incdport && !opt_force_incdport)
|
if (opt_incdport && !opt_force_incdport)
|
||||||
dst_port++;
|
dst_port++;
|
||||||
@ -545,7 +545,7 @@ int recv_tcp(void *packet, size_t size)
|
|||||||
if (flags[0] == '\0') strcat(flags, "none");
|
if (flags[0] == '\0') strcat(flags, "none");
|
||||||
|
|
||||||
log_ip(status, sequence);
|
log_ip(status, sequence);
|
||||||
printf("sport=%d flags=%s seq=%d win=%d rtt=%.1f ms\n",
|
printf("源端口=%d 标志=%s seq=%d win=%d 往返时间=%.2f 毫秒\n",
|
||||||
ntohs(tcp.th_sport), flags, sequence,
|
ntohs(tcp.th_sport), flags, sequence,
|
||||||
ntohs(tcp.th_win), ms_delay);
|
ntohs(tcp.th_win), ms_delay);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user