Blob Blame History Raw
%global srcname ROPGadget

Name:           python-%{srcname}
Version:        5.4
Release:        1%{?dist}
Summary:        A tool to find ROP gadgets in program files

License:        GPLv2
URL:            https://pypi.python.org/pypi/%{srcname}
Source0:        https://files.pythonhosted.org/packages/source/R/%{srcname}/%{srcname}-%{version}.tar.gz
Source1:        https://raw.githubusercontent.com/JonathanSalwan/ROPgadget/282d8516f21c85b17cab95165620bb4009cc68a0/COPYING
Source2:        https://raw.githubusercontent.com/JonathanSalwan/ROPgadget/282d8516f21c85b17cab95165620bb4009cc68a0/README.md

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python3-devel
BuildRequires:  %{py2_dist capstone}
BuildRequires:  %{py3_dist capstone}

%description
ROPGadget lets you search your gadgets on your binaries to facilitate
your ROP exploitation. ROPgadget supports ELF, PE and Mach-O format on
x86, x64, ARM, ARM64, PowerPC, SPARC and MIPS architectures.

%package -n python2-%{srcname}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{srcname}}
Requires:       %{py2_dist capstone}

%description -n python2-%{srcname}
ROPGadget lets you search your gadgets on your binaries to facilitate
your ROP exploitation. ROPgadget supports ELF, PE and Mach-O format on
x86, x64, ARM, ARM64, PowerPC, SPARC and MIPS architectures.

%package -n python3-%{srcname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{srcname}}
Requires:       %{py3_dist capstone}

%description -n python3-%{srcname}
ROPGadget lets you search your gadgets on your binaries to facilitate
your ROP exploitation. ROPgadget supports ELF, PE and Mach-O format on
x86, x64, ARM, ARM64, PowerPC, SPARC and MIPS architectures.

%prep
%autosetup -n %{srcname}-%{version}
cp -p %SOURCE1 .
cp -p %SOURCE2 .

%build
%py2_build
%py3_build

%install
%py2_install
%py3_install
for lib in $(find %{buildroot}%{python2_sitelib}/ropgadget/ \
                  %{buildroot}%{python3_sitelib}/ropgadget/ -name "*.py"); do
  sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
  touch -r $lib $lib.new &&
  mv $lib.new $lib
done

%files -n python2-%{srcname}
%doc COPYING README.md
%{python2_sitelib}/ropgadget
%{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info

%files -n python3-%{srcname}
%doc COPYING README.md
%{python3_sitelib}/ropgadget
%{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info
%{_bindir}/*

%changelog
* Sat Jun 16 2018 W. Michael Petullo <mike@flyn.org> - 3.12.0-1
- Initial package