From 123724321c521a38a443b9e808861ffec9e04f42 Mon Sep 17 00:00:00 2001 From: ecpvint Date: Fri, 21 Jun 2024 19:06:53 +0800 Subject: [PATCH] modify --- Makefile | 37 ++++++++++++++++++------------------- README.md | 16 +++++++++------- main.c | 6 +++--- statistics.c | 4 ++-- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index b0d6c16..65b37cd 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,10 @@ # $date: Sun Jul 25 17:56:15 MET DST 1999$ # $rev: 3$ -CC= gcc +CC= clang AR=/usr/bin/ar RANLIB=/usr/bin/ranlib -CCOPT= -O2 -Wall -DEBUG= -g +CCOPT= -O2 -Wall #uncomment the following if you need libpcap based build under linux #(not raccomanded) COMPILE_TIME= @@ -36,42 +35,42 @@ OBJ= main.o getifname.o getlhs.o \ ARSOBJ = ars.o apd.o split.o -all: hping6 +all: hping3 libars.a: $(ARSOBJ) $(AR) rc $@ $^ $(RANLIB) $@ -hping6: byteorder.h $(OBJ) - $(CC) -o hping6 $(CCOPT) $(DEBUG) $(OBJ) $(PCAP) +hping3: byteorder.h $(OBJ) + $(CC) -o hping3 $(CCOPT) $(OBJ) $(PCAP) @echo - ./hping6 -v - @echo "use \`make strip' to strip hping6 binary" - @echo "use \`make install' to install hping6" + ./hping3 -v + @echo "use \`make strip' to strip hping3 binary" + @echo "use \`make install' to install hping3" byteorder.h: ./configure .c.o: - $(CC) -c $(CCOPT) $(DEBUG) $(COMPILE_TIME) $< + $(CC) -c $(CCOPT) $(COMPILE_TIME) $< clean: - rm -rf hping6 *.o *.a + rm -rf hping3 *.o *.a -(cd utils; $(MAKE) clean) distclean: - rm -rf hping6 *.o *.a byteorder byteorder.h systype.h Makefile + rm -rf hping3 *.o *.a byteorder byteorder.h systype.h Makefile -(cd utils; $(MAKE) clean) -install: hping6 +install: hping3 mkdir -p ${prefix}/sbin/ - cp -f hping6 ${prefix}/sbin/ - chmod 755 ${prefix}/sbin/hping6 + cp -f hping3 ${prefix}/sbin/ + chmod 755 ${prefix}/sbin/hping3 @if [ -f ${prefix}/sbin/hping2 ]; then \ rm ${prefix}/sbin/hping2; \ fi -strip: hping6 - @ls -l ./hping6 - strip hping6 - @ls -l ./hping6 +strip: hping3 + @ls -l ./hping3 + strip hping3 + @ls -l ./hping3 diff --git a/README.md b/README.md index 57d8be0..286cdf4 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -This is regular hping2 with a few extra features: +此项目扩展至hping3,支持了ipv6和一些其他的 -* `-6` - required for ipv6 destinations +* `-6` - 来支持IPV6模式 * `--pps` * `--bps` - set outgoing pps/bps rates. Return packets are not processed in these modes. * `-flood`-send packets as soon as posible. -* random source ip and dest ip support ipv6 +* 随机源端口和目标端口支持 ipv6 -Example: +< 克隆来自 https://github.com/alex-testlab/hping6 - root@koszik-vps:~# ./hping6 ns1.atw.hu -6 -2 -p 53 -k -s 1583 --traceroute +例子: + + root@koszik-vps:~# ./hping3 ns1.atw.hu -6 -2 -p 53 -k -s 1583 --traceroute HPING ns1.atw.hu (eth0 2a01:270:0:2::11): udp mode set, 48 headers + 0 data bytes hop=1 TTL 0 during transit from ip=2a00:1f40:2::1 name=2a00-1f40-2--1.pool6.giganet.hu hoprtt=0.9 ms hop=2 TTL 0 during transit from ip=2a00:1f40:1:bb00::2:1 name=UNKNOWN hoprtt=1005.7 ms @@ -25,9 +27,9 @@ Example: TCP flood attack with random source ip with ipv6: - root@testlab:~# ./hping6 2022:1:1:1::2 -6 --rand-source --flood + root@testlab:~# ./hping3 2022:1:1:1::2 -6 --rand-source --flood `2022:1:1:1::2` is the ipv6 address you want to attack -doc: https://github.com/alex-testlab/hping6/wiki +doc: https://github.com/alex-testlab/hping3/wiki diff --git a/main.c b/main.c index f700c02..0f77470 100644 --- a/main.c +++ b/main.c @@ -187,8 +187,8 @@ int main(int argc, char **argv) int c, hdr_size; if (parse_options(argc, argv) == -1) { - printf("hping6: missing host argument\n" - "Try `hping6 --help' for more information.\n"); + printf("hping3: missing host argument\n" + "Try `hping3 --help' for more information.\n"); exit(1); } @@ -305,7 +305,7 @@ int main(int argc, char **argv) /* if we are in listemode enter in listenmain() else */ /* print HPING... bla bla bla and enter in wait_packet() */ if (opt_listenmode) { - fprintf(stderr, "hping6 listen mode\n"); + fprintf(stderr, "hping3 listen mode\n"); /* memory protection */ if (memlockall() == -1) { diff --git a/statistics.c b/statistics.c index 6e72d58..b5d5195 100644 --- a/statistics.c +++ b/statistics.c @@ -26,7 +26,7 @@ void print_statistics(int signal_id) #endif /* OSTYPE_LINUX && !FORCE_LIBPCAP */ if (recv_pkt > 0){ - losspack=(recv_pkt