📄 hping2.8
字号:
this option. Also note that using hping you are able to use record routeeven if target host filter ICMP. Record route is an IP option, notan ICMP option, so you can use record route option even in TCP and UDPmode..SH ICMP RELATED OPTIONS.TP.I -C --icmptype typeSet icmp type, default is.B ICMP echo request(implies --icmp).TP.I -K --icmpcode codeSet icmp code, default is 0. (implies --icmp).TP.I --icmp-ipverSet IP version of IP header contained into ICMP data, default is 4..TP.I --icmp-iphlenSet IP header length of IP header contained into ICMP data, default is 5 (5 word of 32 bits)..TP.I --icmp-iplenSet IP packet length of IP header contained into ICMP data, default is the reallength..TP.I --icmp-ipidSet IP id of IP header contained into ICMP data, default is random..TP.I --icmp-ipprotoSet IP protocol of IP header contained into ICMP data, default is TCP..TP.I --icmp-cksumSet ICMP checksum, for default is the valid checksum..TP.I --icmp-tsAlias for --icmptype 13 (to send ICMP timestamp requests).TP.I --icmp-addrAlias for --icmptype 17 (to send ICMP address mask requests).SH TCP/UDP RELATED OPTIONS.TP.I -s --baseport source porthping2 uses source port in order to guess replies sequence number. Itstarts with a base source port number, and increase this number for eachpacket sent. When packet is received sequence number can be computed as.I replies.dest.port - base.source.port.Default base source port is random, using this option you are able toset different number. If you need that source port not be increased foreach sent packet use the.I -k --keepoption..TP.I -p --destport [+][+]dest portSet destination port, default is 0. If '+' character precedes dest portnumber (i.e. +1024) destination port will be increased for each replyreceived. If double '+' precedes dest port number (i.e. ++1024), destinationport will be increased for each packet sent.By default destination port can be modified interactively using.B CTRL+z..TP.I --keepkeep still source port, see.I --baseportfor more information..TP.I -w --winSet TCP window size. Default is 64..TP.I -O --tcpoffSet fake tcp data offset. Normal data offset is tcphdrlen / 4..TP.I -M --tcpseqSet the TCP sequence number..TP.I -L --tcpackSet the TCP ack..TP.I -Q --seqnumThis option can be used in order to collect sequence numbers generatedby target host. This can be useful when you need to analyze whetherTCP sequence number is predictable. Output example:.B #hping2 win98 --seqnum -p 139 -S -i u1 -I eth0.nfHPING uaz (eth0 192.168.4.41): S set, 40 headers + 0 data bytes2361294848 +23612948482411626496 +503316482545844224 +1342177282713616384 +1677721602881388544 +1677721603049160704 +1677721603216932864 +1677721603384705024 +1677721603552477184 +1677721603720249344 +1677721603888021504 +1677721604055793664 +1677721604223565824 +167772160.fiThe first column reports the sequence number, the second differencebetween current and last sequence number. As you can see target host's sequencenumbers are predictable..TP.I -b --badcksumsend packets with a bad UDP/TCP checksum.TP.I --tcp-timestampenable the TCP timestamp option, and try to guess the timestamp updatefrequency and the remote system uptime..TP.I -F --finset FIN tcp flag..TP.I -S --synset SYN tcp flag..TP.I -R --rstset RST tcp flag..TP.I -P --pushset PUSH tcp flag..TP.I -A --ackset ACK tcp flag..TP.I -U --urgset URG tcp flag..TP.I -X --xmasset Xmas tcp flag..TP.I -Y --ymasset Ymas tcp flag..SH COMMON OPTIONS.TP.I -d --data data sizeset packet body size. Warning, using --data 40 hping2 will not generate0 byte packets but protocol_header+40 bytes. hping2 will displaypacket size information as first line output, like this:.B HPING www.yahoo.com (ppp0 204.71.200.67): NO FLAGS are set, 40 headers + 40 data bytes.TP.I -E --file filenameUse.B filenamecontents to fill packet's data..TP.I -e --sign signatureFill first.I signature lengthbytes of data with.I signature.If.I signature lengthis bigger than data size an error message will be displayed.This option can be used safely with.I --file filenameoption, remainder data space will be filled using.I filename.TP.I -j --dumpDump received packets in hex..TP.I -J --printDump received packets's printable characters..TP.I -B --safeEnable safe protocol, using this option lost packets in file transferswill be resent. For example in order to send file /etc/passwd from hostA to host B you may use the following:.nf.I [host_a].B # hping2 host_b --udp -p 53 -d 100 --sign signature --safe --file /etc/passwd.I [host_b].B # hping2 host_a --listen signature --safe --icmp.fi.TP.I -u --endIf you are using.I --file filenameoption, tell you when EOF has been reached. Moreover prevent that other endaccept more packets. Please, for more information see the.B HPING2-HOWTO..TP.I -T --tracerouteTraceroute mode. Using this option hping2 will increase ttl for each.B ICMP time to live 0 during transitreceived. Try.B hping2 host --traceroute.This option implies --bind and --ttl 1. You can override the ttl of 1using the --ttl option. Since 2.0.0 stable it prints RTT information..TP.I --tr-keep-ttlKeep the TTL fixed in traceroute mode, so you can monitor just one hopin the route. For example, to monitor how the 5th hop changes orhow its RTT changes you can try.B hping2 host --traceroute --ttl 5 --tr-keep-ttl..TP.I --tr-stopIf this option is specified hping will exit once the first packetthat isn't an ICMP time exceeded is received. This better emulatesthe traceroute behavior..TP.I --tr-no-rttDon't show RTT information in traceroute mode. The ICMP time exceeded RTTinformation aren't even calculated if this option is set..TP.I --tcpexitcodeExit with last received packet tcp->th_flag as exit code. Useful for scriptsthat need, for example, to known if the port 999 of some host reply withSYN/ACK or with RST in response to SYN, i.e. the service is up or down..SH TCP OUTPUT FORMATThe standard TCP output format is the following:len=46 ip=192.168.1.1 flags=RA DF seq=0 ttl=255 id=0 win=0 rtt=0.4 ms.B lenis the size, in bytes, of the data captured from the data link layerexcluding the data link header size. This may not match the IP datagramsize due to low level transport layer padding..B ipis the source ip address..B flagsare the TCP flags, R for RESET, S for SYN, A for ACK, F for FIN,P for PUSH, U for URGENT, X for not standard 0x40, Y for not standard0x80.If the reply contains.B DFthe IP header has the don't fragment bit set..B seqis the sequence number of the packet, obtained using the sourceport for TCP/UDP packets, the sequence field for ICMP packets..B idis the IP ID field..B winis the TCP window size..B rttis the round trip time in milliseconds.If you run hping using the.B -Vcommand line switch it will display additional information about thepacket, example:len=46 ip=192.168.1.1 flags=RA DF seq=0 ttl=255 id=0 win=0 rtt=0.4 mstos=0 iplen=40 seq=0 ack=1223672061 sum=e61d urp=0 .B tosis the type of service field of the IP header..B iplenis the IP total len field.B seq and ackare the sequence and acknowledge 32bit numbers in the TCP header..B sumis the TCP header checksum value.B urpis the TCP urgent pointer value.SH UDP OUTPUT FORMATThe standard output format is:len=46 ip=192.168.1.1 seq=0 ttl=64 id=0 rtt=6.0 msThe field meaning is just the same as the TCP output meaning of thesame fields..SH ICMP OUTPUT FORMATAn example of ICMP output is:ICMP Port Unreachable from ip=192.168.1.1 name=nano.marmoc.netIt is very simple to understand. It starts with the string "ICMP"followed by the description of the ICMP error, Port Unreachablein the example. The ip field is the IP source address of the IPdatagram containing the ICMP error, the name field is just thenumerical address resolved to a name (a dns PTR request) or UNKNOWN if theresolution failed.The ICMP Time exceeded during transit or reassembly format is a bitdifferent:TTL 0 during transit from ip=192.168.1.1 name=nano.marmoc.netTTL 0 during reassembly from ip=192.70.106.25 name=UNKNOWN The only difference is the description of the error, it starts withTTL 0..SH AUTHORSalvatore Sanfilippo <antirez@invece.org>, with the help of the people mentioned in AUTHORS file and at http://www.hping.org/authors.html.SH BUGSEven using the --end and --safe options to transfer files the final packetwill be padded with 0x00 bytes..PPData is read without care about alignment, but alignment is enforcedin the data structures.This will not be a problem under i386 but, while usually the TCP/IPheaders are naturally aligned, may create problems with differentprocessors and bogus packets if there is some unaligned access aroundthe code (hopefully none)..PPOn solaris hping does not work on the loopback interface. This seemsa solaris problem, as stated in the tcpdump-workers mailing list,so the libpcap can't do nothing to handle it properly..SH SEE ALSOping(8), traceroute(8), ifconfig(8), nmap(1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -