# this spec file was largely based of the altlinux version of it
%define debug_package %{nil}

Name:           dirb
Version:        2.22
Release:        2%{?dist}
Summary:        DIRB is a Web Content Scanner

%global _version %(v=%{version}; echo ${v/./})

License:        GPLv2
URL:            http://dirb.sourceforge.net/
Source:         dirb%{_version}.tar.gz
Patch:          Fix-DIRB-for-GCC-10.patch
Patch1:         update-default-wordlist-path.patch

BuildRequires:  libcurl-devel autoconf gcc make

%description
It looks for existing (and/or hidden) Web Objects.
It basically works by launching a dictionary based attack against a web server and analizing the response.

%prep
%autosetup -n %{name}%{_version} -p 1

%build
%configure
make

%install
%make_install
mv %buildroot/%_bindir/gendict{,-dirb}
mkdir -p %buildroot/%_datadir/dirb/
find wordlists/ -maxdepth 1 -type f -exec install -m 0644 '{}' %buildroot/%_datadir/dirb/ \;
mkdir -p %buildroot/%_datadir/dirb/others
find wordlists/others -maxdepth 1 -type f -exec install -m 0644 '{}' %buildroot/%_datadir/dirb/others \;
mkdir -p %buildroot/%_datadir/dirb/stress
find wordlists/stress -maxdepth 1 -type f -exec install -m 0644 '{}' %buildroot/%_datadir/dirb/stress \;
mkdir -p %buildroot/%_datadir/dirb/vulns
find wordlists/vulns -maxdepth 1 -type f -exec install -m 0644 '{}' %buildroot/%_datadir/dirb/vulns \;

%files
%_bindir/*
%_mandir/man1/*
%dir %_datadir/%{name}
%_datadir/%{name}/*
%doc LICENSE.txt README.txt docs/GENDICT.TXT docs/FAQ.txt docs/TRICKS.txt docs/CHANGES.txt

%changelog
* Sun May 23 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 2.22-2
- Update default wordlist path

* Wed May 19 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 2.22-1
- Initial release on COPR

* Wed Dec 09 2020 Nikita Ermakov <arei@altlinux.org> 2.22-alt3
- Fix DIRB for GCC 10.

* Tue Nov 12 2019 Nikita Ermakov <arei@altlinux.org> 2.22-alt2
- Rename gendict to gendict-dirb to avoid collisions with icu-utils.

* Tue Nov 12 2019 Nikita Ermakov <arei@altlinux.org> 2.22-alt1
- Initial build for ALT Linux Sisyphus.
