Name: sqlmap Version: 1.9.4 Release: 1%{?dist} Summary: Automatic SQL injection and database takeover tool License: GPL-2.0-only URL: https://github.com/sqlmapproject/sqlmap Source0: %{URL}/archive/refs/tags/%{version}.tar.gz BuildArch: noarch BuildRequires: git Requires: python, sh Requires(post): /usr/bin/python # Optional dependencies # perl: icmpsh extra tool # python-sqlalchemy: MySQL/MariaDB connection Provides: sqlmap Conflicts: sqlmap %description sqlmap is an open source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over of database servers. %prep %autosetup %build # Compile Python bytecode (normal and optimized) #find . -name "*.py" -exec python -m compileall {} \; #find . -name "*.py" -exec python -O -m compileall {} \; %install # Create directories install -d %{buildroot}/etc install -d %{buildroot}/usr/bin install -d %{buildroot}/opt/sqlmap install -d %{buildroot}/usr/share/doc/sqlmap # Move doc and configuration mv doc %{buildroot}/usr/share/doc/sqlmap mv sqlmap.conf %{buildroot}/etc/sqlmap.conf ln -sf /etc/sqlmap.conf %{buildroot}/opt/sqlmap/sqlmap.conf # Copy rest of the files cp -a . %{buildroot}/opt/sqlmap # Change ambiguous shebang lines to python3 find %{buildroot}/opt/sqlmap -type -f -name "*.py" -exec sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python3|' {} \; # Create wrapper scripts cat > %{buildroot}/usr/bin/sqlmap << EOF #!/bin/sh cd /opt/sqlmap exec python sqlmap.py "\$@" EOF cat > %{buildroot}/usr/bin/sqlmapapi << EOF #!/bin/sh cd /opt/sqlmap exec python sqlmapapi.py "\$@" EOF chmod 755 %{buildroot}/usr/bin/sqlmap chmod 755 %{buildroot}/usr/bin/sqlmapapi %files %license LICENSE %doc %{_datadir}/doc/sqlmap %{_bindir}/sqlmap %{_bindir}/sqlmapapi %config(noreplace) /etc/sqlmap.conf /opt/sqlmap %changelog * Sat May 24 2025 Your Name - 1.9.4-1 - Initial RPM release based on PKGBUILD