LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File nmap.spec of Package nmap (Project network:utilities)

#
# spec file for package nmap
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

%define with_system_lua 0%{?suse_version} >= 1220

Name:           nmap
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gtk2-devel
BuildRequires:  libpcap-devel
BuildRequires:  openssl-devel
BuildRequires:  pcre-devel
BuildRequires:  python-devel
BuildRequires:  update-desktop-files
%if %with_system_lua 
BuildRequires:  pkgconfig(lua) >= 5.2
%endif
%if 0%{?suse_version} >= 1230
BuildRequires:  gpg-offline
%endif
Url:            http://nmap.org/
Version:        6.45
Release:        0
Summary:        Portscanner
License:        GPL-2.0+
Group:          Productivity/Networking/Diagnostic
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         http://nmap.org/dist/nmap-%{version}.tar.bz2
Source1:        https://svn.nmap.org/nmap/docs/nmap_gpgkeys.txt#/%{name}.keyring
Source2:        http://nmap.org/dist/sigs/%{name}-%{version}.tar.bz2.asc
Patch:          nmap-6.00-libpcap-filter.diff
Patch1:         nmap-4.00-noreturn.diff
Patch2:         nmap-5.61-desktop_files.patch
Patch3:         nmap-4.75-nostrip.patch
Patch5:         su-to-zenmap.patch
Patch7:         nmap-ncat-skip-network-tests.patch

%description
Nmap is designed to allow system administrators and curious individuals
to scan large networks to determine which hosts are up and what
services they are offering. XNmap is a graphical front-end that shows
nmap's output clearly.

Find documentation in %{_docdir}/%{name}




Authors:
--------
    Fyodor <fyodor@dhp.com>

%package -n zenmap
Summary:        A Graphical Front-End for Nmap
Group:          Productivity/Networking/Diagnostic
Requires:       %name = %version
Obsoletes:      %name-gtk
Provides:       %name-gtk = %{version}-%{release}
%py_requires
Requires:       python-gtk

%description -n zenmap
zenmap is a graphical front-end for the nmap network scanner




Authors:
--------
    Fyodor <fyodor@dhp.com>

%package -n ncat
Summary:        Network Tool to concatenate and redirect Sockets
Group:          Productivity/Networking/Diagnostic

%description -n ncat
Ncat is a feature-packed networking utility which will read and write data
across a network from the command line. Ncat was written for the Nmap Project
and is the culmination of the currently splintered family of Netcat
incarnations. It uses both TCP and UDP for communication and is designed to be
a reliable back-end tool to instantly provide network connectivity to other
applications and users. Ncat will not only work with IPv4 and IPv6 but provides
the user with a virtually limitless number of potential uses.

Among Ncat´s vast number of features there is the ability to chain Ncats
together, redirect both TCP and UDP ports to other sites, SSL support, and
proxy connections via SOCKS4 or HTTP (CONNECT method) proxies (with optional
proxy authentication as well). Some general principles apply to most
applications and thus give you the capability of instantly adding networking
support to software that would normally never support it.




Authors:
--------
    Fyodor <fyodor@dhp.com>

%package -n ndiff
Summary:        Compare Results of Nmap Scans
Group:          Productivity/Networking/Diagnostic
%py_requires

%description -n ndiff
Ndiff is a tool to aid in the comparison of Nmap scans. It takes two Nmap XML
output files and prints the differences between them: hosts coming up and down,
ports becoming open or closed, etc.




Authors:
--------
    Fyodor <fyodor@dhp.com>

%package -n nping
Summary:        Compare Results of Nmap Scans
Group:          Productivity/Networking/Diagnostic

%description -n nping
Network packet generation tool / ping utility



Authors:
--------
    Fyodor <fyodor@dhp.com>
%prep
%{?gpg_verify: %gpg_verify %{S:2}}
%setup -q
%patch -p0
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch5 -p0
%patch7 -p1

#fix locale dir
mv zenmap/share/zenmap/locale zenmap/share
sed -i -e "s|^locale_dir =.*$|locale_dir = os.path.join('share','locale')|" \
 -e 's|join(self.install_data, data_dir)|join(self.install_data, "share")|' zenmap/setup.py
sed -i 's|^LOCALE_DIR = .*|LOCALE_DIR = join(prefix, "share", "locale")|' zenmap/zenmapCore/Paths.py

#fix pt_PT/pt zh/zh_CN locale
sed -i '/ALL_LINGUAS =/s/pt_PT/pt/' Makefile.in
sed -i '/ALL_LINGUAS =/s/zh/zh_CN/' Makefile.in
mv docs/man-xlate/nmap-pt_PT.1 docs/man-xlate/nmap-pt.1
mv docs/man-xlate/nmap-zh.1 docs/man-xlate/nmap-zh_CN.1

%build
export CFLAGS="%optflags -DOPENSSL_LOAD_CONF"
export CXXFLAGS="%optflags -DOPENSSL_LOAD_CONF"
%configure --with-libpcap=%{_usr} \
           --with-libdnet=included \
%if %with_system_lua
           --with-liblua=%{_usr} \
%else
           --with-liblua=included \
%endif
           --with-libpcre=%{_usr}

%__make %{?jobs:-j%jobs}

%install
%__make DESTDIR="%{buildroot}" deskdir="%{_datadir}/gnome/apps/Utilities/" install
%__rm "%{buildroot}%{_bindir}/uninstall_zenmap"
%__install -d "%{buildroot}/usr/share/pixmaps/"
%__ln_s ../zenmap/pixmaps/zenmap.png "%{buildroot}/usr/share/pixmaps/zenmap.png"
%suse_update_desktop_file zenmap System Network
%suse_update_desktop_file zenmap-root System Network
%find_lang zenmap
touch -r %{buildroot}/%{python_sitelib}/zenmapCore/Paths.py %{buildroot}/%{python_sitelib}/zenmapCore/Paths.pyc
dos2unix %{buildroot}%{_datadir}/%{name}/nselib/data/oracle-sids

%fdupes -s %{buildroot}

%check

pushd ncat
%__make check
popd

pushd libdnet-stripped
%__make check
popd

# retrieve list of compiled in modules
compiled_with=$("${RPM_BUILD_ROOT}%{_bindir}/nmap" -V | %__grep "Compiled with:" )
# for the following tests, the leading space is relevant
# check features built with system libraries
[[ $compiled_with == *\ libpcre-* ]]
[[ $compiled_with == *\ libpcap-* ]]
[[ $compiled_with == *\ openssl-* ]]
# check features built with included sources
[[ $compiled_with == *\ nmap-libdnet-* ]]
# check for lua
%if %with_system_lua
[[ $compiled_with == *\ liblua-5.2* ]]
%else
# lua in nmap tarball identifies itself as "liblua-5.2.1"
[[ $compiled_with == *\ liblua-5.2.1* ]]
%endif
#

%clean
%__rm -rf "%{buildroot}"

%files
%defattr(-,root,root)
%doc COPYING* CHANGELOG HACKING
%doc docs/README
%doc docs/nmap.usage.txt
%dir %{_mandir}/??
%dir %{_mandir}/??/man1
%dir %{_mandir}/??_??
%dir %{_mandir}/??_??/man1
%{_mandir}/man1/nmap.1.gz
%{_mandir}/*/man1/*
%{_bindir}/nmap
%{_datadir}/nmap

%files -n zenmap -f zenmap.lang
%defattr(-,root,root)
%{_bindir}/xnmap
%{_bindir}/zenmap
%{_bindir}/nmapfe
%{python_sitelib}/zenmap-%{version}-py%{py_ver}.egg-info
%{python_sitelib}/zenmapCore
%{python_sitelib}/zenmapGUI
%{python_sitelib}/radialnet
%{_datadir}/applications/zenmap-root.desktop
%{_datadir}/applications/zenmap.desktop
%{_datadir}/pixmaps/zenmap.png
%{_datadir}/zenmap
%{_mandir}/man1/zenmap.1.gz

%files -n ncat
%defattr(-,root,root)
%{_bindir}/ncat
%{_mandir}/man1/ncat.1.gz
%dir %{_datadir}/ncat
%config(noreplace) %{_datadir}/ncat/ca-bundle.crt

%files -n ndiff
%defattr(-,root,root)
%{_bindir}/ndiff
%{_mandir}/man1/ndiff.1.gz
%{python_sitelib}/ndiff.*

%files -n nping
%defattr(-,root,root)
%{_bindir}/nping
%{_mandir}/man1/nping.1.gz

%changelog