BCLinux8.*构建部署nmap 7.95

定义SPEC文件

首先从nmap的github上下载SPEC定义文件,然后进行修改,如下:

# To build a static RPM, add
#     --define "static 1"
# to the rpmbuild command line. To build without Ncat, add
#     --define "buildncat 0"
# To build without Nping, add
#     --define "buildnping 0"
#
# To specify openssl dir, add something like:
#     --define "openssl /usr/local/ssl"

%define name nmap
%define version 7.95
%define release 2
%define _prefix /usr
%define makeargs OPENSSL_LIBS="%{openssl}/lib64/libssl.a %{openssl}/lib64/libcrypto.a" LIBSSL="%{openssl}/lib64/libssl.a %{openssl}/lib64/libcrypto.a" ZLIB_LIBS="$(pwd)/libz/libz.a" LIBZ="$(pwd)/lib64/libz.a"

Summary: Network exploration tool and security scanner
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Epoch: 2
License: https://nmap.org/man/man-legal.html
Group: Applications/System
Source0: %{name}-%{version}.tar.bz2
URL: https://nmap.org

# Disable automatic dependency calculation because we want to provide
# packages for more than one version of Python. Without this, RPM will
# grep through the installed files and automatically add things like
#   Requires: python(abi) = 2.4
# setup.py takes care of adjusting sys.path to point to wherever the
# modules were installed so it's not dependent on any particular ABI.
AutoReqProv: no
# For Ndiff.
BuildRequires: python3-devel
Requires: python3 >= 3.0
%global debug_package %{nil}

# RPM can't be relocatable until I stop storing path info in the binary.
Prefix: %{_prefix}
BuildRoot: %{_tmppath}/%{name}-root

%description

Nmap ("Network Mapper") is a free and open source utility
for network exploration or security auditing. Many systems and network
administrators also find it useful for tasks such as network
inventory, managing service upgrade schedules, and monitoring host or
service uptime. Nmap uses raw IP packets in novel ways to determine
what hosts are available on the network, what services (application
name and version) those hosts are offering, what operating systems
(and OS versions) they are running, what type of packet
filters/firewalls are in use, and dozens of other characteristics. It
was designed to rapidly scan large networks, but works fine against
single hosts. Nmap runs on all major computer operating systems, and
both console and graphical versions are available.

%prep
%setup -q

%build

./configure --prefix=%{_prefix} -without-zenmap --without-ncat --without-nping --without-ndiff 

make

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# Don't package the Ndiff uninstaller with the RPM.
rm -f $RPM_BUILD_ROOT%{_bindir}/uninstall_ndiff
strip $RPM_BUILD_ROOT%{_bindir}/* || :
gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || :

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc LICENSE
%doc docs/README
%doc docs/nmap.usage.txt
%doc %{_prefix}/share/man/man1/nmap.1*
%doc %{_prefix}/share/man/*/man1/nmap.1*
%{_bindir}/nmap
%{_datadir}/nmap


%changelog

* Sat Jun 06 2009 Fyodor (fyodor(a)insecure.org)
- Removed changelog entries as SVN is a more authoritative source. Execute:
- svn log --username guest --password "" https://svn.nmap.org/nmap/nmap.spec.in

安装编译环境

分别在CentOS7.9、AnolisOS8.9上搭建编译环境。

yum -y groupinstall Development Tools
yum -y install openssl-devel python3-devel libssh2-devel flex bison byacc libpcap epel-rpm-macros libtool

yum -y install rpmdevtools rpm-build rpmrebuild

准备构建环境

su - user1
rpmdev-setuptree 
~]$ ll ~/
总用量 0
drwxrwxr-x 7 user1 user1 72 8月   6 15:15 rpmbuild
cp /opt/nmap-7.95.tar.bz2 ~/rpmbuild/SOURCES/

构建RPM包

rpmbuild -ba SPECS/nmap-7.95-2.spec 

构建完验证

适配CentOS7、AnolisOS8.*、BCLinux8.*、openEuler。

rpm -ivh nmap-7.95-2.x86_64.el7.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:nmap-2:7.95-2                    ################################# [100%]
[root@ultraamr-node02 /]# nmap -V
Nmap version 7.95 ( https://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.4.6 openssl-1.0.2k-fips nmap-libssh2-1.11.0 libz-1.2.7 nmap-libpcre2-10.43 nmap-libpcap-1.10.4 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用[1],nmap是一款网络探测和安全审计工具。使用-v选项可以增加扫描的详细程度,使用-vv选项可以进一步增加详细程度。因此,nmap -v scanme.nmap.org扫描的详细程度比nmap -vv scanme.nmap.org扫描的详细程度要少。 下面是两个命令的示例: 1. nmap -v scanme.nmap.org扫描的输出示例: ```shell Starting Nmap 7.80 ( https://nmap.org ) at 2021-08-17 09:30 PDT Initiating Ping Scan at 09:30 Scanning scanme.nmap.org (45.33.32.156) [2 ports] Completed Ping Scan at 09:30, 0.00s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 09:30 Completed Parallel DNS resolution of 1 host. at 09:30, 0.02s elapsed Initiating Connect Scan at 09:30 Scanning scanme.nmap.org (45.33.32.156) [1000 ports] Discovered open port 80/tcp on 45.33.32.156 Discovered open port 22/tcp on 45.33.32.156 Completed Connect Scan at 09:30, 0.11s elapsed (1000 total ports) Nmap scan report for scanme.nmap.org (45.33.32.156) Host is up (0.11s latency). Other addresses for scanme.nmap.org (not scanned): 2600:3c03::f03c:91ff:fe18:bb2f Not shown: 998 filtered ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http Read data files from: /usr/bin/../share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds ``` 2. nmap -vv scanme.nmap.org扫描的输出示例: ```shell Starting Nmap 7.80 ( https://nmap.org ) at 2021-08-17 09:31 PDT Initiating Ping Scan at 09:31 Scanning scanme.nmap.org (45.33.32.156) [2 ports] Packet capture filter (device eth0): icmp and ((ip[20:2] - ip[16:2]) - ((ip[0]&0xf)<<2)) != 0 Completed Ping Scan at 09:31, 0.00s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 09:31 Completed Parallel DNS resolution of 1 host. at 09:31, 0.02s elapsed Initiating Connect Scan at 09:31 Scanning scanme.nmap.org (45.33.32.156) [1000 ports] Discovered open port 80/tcp on 45.33.32.156 Discovered open port 22/tcp on 45.33.32.156 Completed Connect Scan at 09:31, 0.11s elapsed (1000 total ports) Nmap scan report for scanme.nmap.org (45.33.32.156) Host is up, received syn-ack (0.11s latency). Other addresses for scanme.nmap.org (not scanned): 2600:3c03::f03c:91ff:fe18:bb2f Not shown: 998 filtered ports Reason: 998 no-responses and 2 host-prohibited PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 56 80/tcp open http syn-ack ttl 56 Read data files from: /usr/bin/../share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值