当前位置: 首页 > news >正文

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

相关文章:

  • 网络协议九 应用层 HTTPS
  • Spring Boot常用注解
  • MKS产品PECVD设备中应用PPT课件
  • 「Java 项目详解」API 文档搜索引擎(万字长文)
  • mapstruct学习笔记
  • STM32标准库学习笔记-1.基础知识
  • IOC--自定义IOC容器
  • windows安装android studio
  • 【ai】Easy-RAG 不行啊,RAGFlow官方demo行
  • 分布式日志
  • Vue是如何实现nextTick的?
  • Dockerfile搭建LNMP
  • 用Python实现9大回归算法详解——01. 线形回归算法
  • 《工厂模式在软件开发中的深度剖析与应用》
  • 苹果在iOS 18.1中向第三方开发者开放iPhone的NFC芯片
  • JavaScript AI 编程助手
  • Android之service两种启动方式的异同
  • 【自动驾驶】ROS远程节点的分布式通信
  • 【TiDB】09-修改tidb客户端访问密码
  • Lambda表达式与流式编程
  • 长三角铁路五一假期发送旅客超2000万人次,同比增幅超一成
  • 青岛双星名人集团董事长发公开信称家人逼迫交出管理权?公司回应
  • 证券时报头版:巴菲特留给投资界的珍贵启示
  • 今天全国铁路、公路进入返程高峰,这些路段时段通行压力大
  • “五一”假期首日迎出游高峰:火车站人流“堪比春运”,热门景区门票预订量同比增三成
  • 耶路撒冷发生山火,以防长宣布紧急状态