【工具】hping安裝與使用(01)——安裝


hping官網介紹:http://www.hping.org/

hping is a command-line oriented TCP/IP packet assembler/analyzer. The interface is inspired to the ping(8) unix command, but hping isn't only able to send ICMP echo requests. It supports TCP, UDP, ICMP and RAW-IP protocols, has a traceroute mode, the ability to send files between a covered channel, and many other features.

While hping was mainly used as a security tool in the past, it can be used in many ways by people that don't care about security to test networks and hosts. A subset of the stuff you can do using hping:

  • Firewall testing
  • Advanced port scanning
  • Network testing, using different protocols, TOS, fragmentation
  • Manual path MTU discovery
  • Advanced traceroute, under all the supported protocols
  • Remote OS fingerprinting
  • Remote uptime guessing
  • TCP/IP stacks auditing
  • hping can also be useful to students that are learning TCP/IP.

Hping works on the following unix-like systems: Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOs X, Windows.

GitHub地址:https://github.com/antirez/hping

下載zip文件

先閱讀INSTALL 和 README ,檢查安裝是否有依賴,發現有以下內容:

REQUIREMENTS

A supported unix-like OS, gcc, root access.

Libpcap.

Tcl/Tk is optional but strongly suggested.

由此可見,依賴項有 gcc、libpcap、tcl,以及需要root權限

如果沒有安裝依賴包,編譯時會有以下錯誤:

# 缺少 libpcap、libpcap-devel
錯誤:

main.c:29:18: fatal error: pcap.h: No such file or directory
#include <pcap.h>
                  ^
compilation terminated.
make: *** [main.o] Error 1

解決方法: yum install -y  libpcap libpcap-devel

 

#  缺少 /usr/include/net/bpf.h

錯誤:

libpcap_stuff.c:19:21: fatal error: net/bpf.h: No such file or directory
#include <net/bpf.h>
                     ^
compilation terminated.
make: *** [libpcap_stuff.o] Error 1

解決方法:ln -sf /usr/include/pcap-bpf.h /usr/include/net/bpf.h

 

# 缺少 tcl、tcl-devel

錯誤:

/usr/bin/ld: cannot find -ltcl
collect2: error: ld returned 1 exit status
make: *** [hping3] Error 1

解決方法:yum install -y  tcl tcl-devel

 

安裝過程

1、先安裝依賴項

yum install -y gcc libpcap libpcap-devel tcl tcl-devel
ln -sf /usr/include/pcap-bpf.h /usr/include/net/bpf.h

2、安裝

unzip hping-master.zip
cd hping-master/
./configure
make
make install

 

使用說明

hping -h 可以查看使用方法

后續有時間繼續研究,並寫一些使用說明。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM