This commit is contained in:
parent
4e23ebe167
commit
123724321c
35
Makefile
35
Makefile
@ -6,11 +6,10 @@
|
|||||||
# $date: Sun Jul 25 17:56:15 MET DST 1999$
|
# $date: Sun Jul 25 17:56:15 MET DST 1999$
|
||||||
# $rev: 3$
|
# $rev: 3$
|
||||||
|
|
||||||
CC= gcc
|
CC= clang
|
||||||
AR=/usr/bin/ar
|
AR=/usr/bin/ar
|
||||||
RANLIB=/usr/bin/ranlib
|
RANLIB=/usr/bin/ranlib
|
||||||
CCOPT= -O2 -Wall
|
CCOPT= -O2 -Wall
|
||||||
DEBUG= -g
|
|
||||||
#uncomment the following if you need libpcap based build under linux
|
#uncomment the following if you need libpcap based build under linux
|
||||||
#(not raccomanded)
|
#(not raccomanded)
|
||||||
COMPILE_TIME=
|
COMPILE_TIME=
|
||||||
@ -36,42 +35,42 @@ OBJ= main.o getifname.o getlhs.o \
|
|||||||
|
|
||||||
ARSOBJ = ars.o apd.o split.o
|
ARSOBJ = ars.o apd.o split.o
|
||||||
|
|
||||||
all: hping6
|
all: hping3
|
||||||
|
|
||||||
libars.a: $(ARSOBJ)
|
libars.a: $(ARSOBJ)
|
||||||
$(AR) rc $@ $^
|
$(AR) rc $@ $^
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
hping6: byteorder.h $(OBJ)
|
hping3: byteorder.h $(OBJ)
|
||||||
$(CC) -o hping6 $(CCOPT) $(DEBUG) $(OBJ) $(PCAP)
|
$(CC) -o hping3 $(CCOPT) $(OBJ) $(PCAP)
|
||||||
@echo
|
@echo
|
||||||
./hping6 -v
|
./hping3 -v
|
||||||
@echo "use \`make strip' to strip hping6 binary"
|
@echo "use \`make strip' to strip hping3 binary"
|
||||||
@echo "use \`make install' to install hping6"
|
@echo "use \`make install' to install hping3"
|
||||||
|
|
||||||
byteorder.h:
|
byteorder.h:
|
||||||
./configure
|
./configure
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CCOPT) $(DEBUG) $(COMPILE_TIME) $<
|
$(CC) -c $(CCOPT) $(COMPILE_TIME) $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf hping6 *.o *.a
|
rm -rf hping3 *.o *.a
|
||||||
-(cd utils; $(MAKE) clean)
|
-(cd utils; $(MAKE) clean)
|
||||||
|
|
||||||
distclean:
|
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)
|
-(cd utils; $(MAKE) clean)
|
||||||
|
|
||||||
install: hping6
|
install: hping3
|
||||||
mkdir -p ${prefix}/sbin/
|
mkdir -p ${prefix}/sbin/
|
||||||
cp -f hping6 ${prefix}/sbin/
|
cp -f hping3 ${prefix}/sbin/
|
||||||
chmod 755 ${prefix}/sbin/hping6
|
chmod 755 ${prefix}/sbin/hping3
|
||||||
@if [ -f ${prefix}/sbin/hping2 ]; then \
|
@if [ -f ${prefix}/sbin/hping2 ]; then \
|
||||||
rm ${prefix}/sbin/hping2; \
|
rm ${prefix}/sbin/hping2; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
strip: hping6
|
strip: hping3
|
||||||
@ls -l ./hping6
|
@ls -l ./hping3
|
||||||
strip hping6
|
strip hping3
|
||||||
@ls -l ./hping6
|
@ls -l ./hping3
|
||||||
|
16
README.md
16
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`
|
* `--pps`
|
||||||
* `--bps` - set outgoing pps/bps rates. Return packets are not processed in these modes.
|
* `--bps` - set outgoing pps/bps rates. Return packets are not processed in these modes.
|
||||||
* `-flood`-send packets as soon as posible.
|
* `-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
|
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=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
|
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:
|
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
|
`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
|
||||||
|
6
main.c
6
main.c
@ -187,8 +187,8 @@ int main(int argc, char **argv)
|
|||||||
int c, hdr_size;
|
int c, hdr_size;
|
||||||
|
|
||||||
if (parse_options(argc, argv) == -1) {
|
if (parse_options(argc, argv) == -1) {
|
||||||
printf("hping6: missing host argument\n"
|
printf("hping3: missing host argument\n"
|
||||||
"Try `hping6 --help' for more information.\n");
|
"Try `hping3 --help' for more information.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ int main(int argc, char **argv)
|
|||||||
/* if we are in listemode enter in listenmain() else */
|
/* if we are in listemode enter in listenmain() else */
|
||||||
/* print HPING... bla bla bla and enter in wait_packet() */
|
/* print HPING... bla bla bla and enter in wait_packet() */
|
||||||
if (opt_listenmode) {
|
if (opt_listenmode) {
|
||||||
fprintf(stderr, "hping6 listen mode\n");
|
fprintf(stderr, "hping3 listen mode\n");
|
||||||
|
|
||||||
/* memory protection */
|
/* memory protection */
|
||||||
if (memlockall() == -1) {
|
if (memlockall() == -1) {
|
||||||
|
@ -26,7 +26,7 @@ void print_statistics(int signal_id)
|
|||||||
#endif /* OSTYPE_LINUX && !FORCE_LIBPCAP */
|
#endif /* OSTYPE_LINUX && !FORCE_LIBPCAP */
|
||||||
|
|
||||||
if (recv_pkt > 0){
|
if (recv_pkt > 0){
|
||||||
losspack=(recv_pkt<sent_pkt)?recv_pkt/sent_pkt:0;
|
losspack=(recv_pkt!=sent_pkt)?(recv_pkt/sent_pkt):0;
|
||||||
lossrate = 100 - ((recv_pkt*100)/sent_pkt);
|
lossrate = 100 - ((recv_pkt*100)/sent_pkt);
|
||||||
}else{
|
}else{
|
||||||
losspack=!sent_pkt?0:sent_pkt;
|
losspack=!sent_pkt?0:sent_pkt;
|
||||||
@ -34,7 +34,7 @@ void print_statistics(int signal_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\n--- %s 统计 ---\n", targetname);
|
fprintf(stderr, "\n--- %s 统计 ---\n", targetname);
|
||||||
fprintf(stderr, "发送: %d|收到: %d|%d%% 丢包率|丢了 %d 个包\n", sent_pkt, recv_pkt, lossrate,losspack);
|
fprintf(stderr, "发送: %d|收到: %d|%d%% 丢包率|已丢弃 %d\n", sent_pkt, recv_pkt, lossrate,losspack);
|
||||||
if (out_of_sequence_pkt)
|
if (out_of_sequence_pkt)
|
||||||
fprintf(stderr, "已收到 %d 个乱序数据包\n",
|
fprintf(stderr, "已收到 %d 个乱序数据包\n",
|
||||||
out_of_sequence_pkt);
|
out_of_sequence_pkt);
|
||||||
|
Loading…
Reference in New Issue
Block a user