one_gadget: converts spec files to gem2rpm

master
Carlos Mogas da Silva 3 years ago
parent 3c63923851
commit 5db7396977
  1. BIN
      one_gadget/SOURCES/rubygem-bindata-2.4.10.tar.gz
  2. 12
      one_gadget/SOURCES/rubygem-bindata-fix-gemspec-files.patch
  3. BIN
      one_gadget/bindata-2.4.10.gem
  4. 5
      one_gadget/create_srpm.sh
  5. BIN
      one_gadget/elftools-1.1.3.gem
  6. BIN
      one_gadget/one_gadget-1.7.4.gem
  7. 41
      one_gadget/one_gadget.spec
  8. BIN
      one_gadget/rubygem-bindata-2.4.10-1.fc34.src.rpm
  9. 88
      one_gadget/rubygem-bindata.spec
  10. 78
      one_gadget/rubygem-elftools.spec
  11. 83
      one_gadget/rubygem-one_gadget.spec

@ -1,12 +0,0 @@
diff -u a/bindata.gemspec b/bindata.gemspec
--- a/bindata.gemspec 2021-05-21 13:29:34.158562502 +0100
+++ b/bindata.gemspec 2021-05-21 13:42:00.930029375 +0100
@@ -12,7 +12,7 @@
s.require_path = 'lib'
s.extra_rdoc_files = ['NEWS.rdoc']
s.rdoc_options << '--main' << 'NEWS.rdoc'
- s.files = `git ls-files`.split("\n")
+ s.files = Dir['lib/**/*.rb'] + %w(README.md)
s.license = 'Ruby'
s.add_development_dependency('rake')

Binary file not shown.

@ -1,5 +0,0 @@
#!/bin/bash
rpmbuild --define "_topdir `pwd`" -bs rubygem-bindata.spec
mv SRPMS/* .
rmdir BUILDROOT RPMS SRPMS BUILD

Binary file not shown.

Binary file not shown.

@ -1,41 +0,0 @@
%define debug_package %{nil}
%define gem_name one_gadget
Name: %{gem_name}
Version: 1.7.4
Release: 1%{?dist}
Summary: Tool to find an execve call to /bin/sh
License: MIT
URL: https://github.com/david942j/%{gem_name}
Source: https://github.com/david942j/%{gem_name}/archive/refs/tags/v%{version}.tar.gz
BuildRequires: rubygems-devel
BuildArch: noarch
%description
When playing ctf pwn challenges we usually need the one-gadget RCE
(remote code execution), which leads to call execve('/bin/sh', NULL, NULL).
%prep
%autosetup -n %{gem_name}-%{version}
%build
gem build %{gem_name}.gemspec
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
cp -a ./%{_bindir}/* %{buildroot}%{_bindir}
%files
%_bindir/*
%{gem_dir}/*
%doc LICENSE README.md
%changelog
* Fri May 21 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 1.7.4-1
- Initial import

@ -1,40 +1,82 @@
%define debug_package %{nil} # Generated from bindata-2.4.10.gem by gem2rpm -*- rpm-spec -*-
%global gem_name bindata
%define gem_name bindata Name: rubygem-%{gem_name}
Version: 2.4.10
Release: 2%{?dist}
Summary: A declarative way to read and write binary file formats
License: Ruby
URL: https://github.com/dmendel/bindata
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby
# BuildRequires: rubygem(minitest) > 5.0.0
# BuildRequires: rubygem(minitest) < 5.12.0
# BuildRequires: rubygem(coveralls)
BuildArch: noarch
Name: rubygem-%{gem_name} %description
Version: 2.4.10 BinData is a declarative way to read and write binary file formats.
Release: 1%{?dist} This means the programmer specifies *what* the format of the binary
Summary: BinData provides a declarative way to read and write structured binary data. data is, and BinData works out *how* to read and write data in this
format. It is an easier ( and more readable ) alternative to
ruby's #pack and #unpack methods.
License: BSD-2-Clause
URL: https://github.com/dmendel/%{gem_name}
Source: %{name}-%{version}.tar.gz
Patch: rubygem-bindata-fix-gemspec-files.patch
BuildRequires: rubygems-devel %package doc
BuildArch: noarch Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description %description doc
BinData makes it easy to create new data types. Documentation for %{name}.
It supports all the common primitive datatypes that are found in structured binary data formats.
Support for dependent and variable length fields is built in.
%prep %prep
%autosetup -n %{gem_name}-%{version} %setup -q -n %{gem_name}-%{version}
%build %build
gem build %{gem_name}.gemspec # Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install %gem_install
%install %install
mkdir -p %{buildroot}%{gem_dir} mkdir -p %{buildroot}%{gem_dir}
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/ cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
# ruby -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
popd
%files %files
%{gem_dir}/* %dir %{gem_instdir}
%doc BSDL README.md %exclude %{gem_instdir}/.gitignore
%exclude %{gem_instdir}/.travis.yml
%{gem_instdir}/BSDL
%license %{gem_instdir}/COPYING
%{gem_instdir}/INSTALL
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/ChangeLog.rdoc
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/NEWS.rdoc
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/bindata.gemspec
%{gem_instdir}/examples
%{gem_instdir}/test
%changelog %changelog
* Fri May 21 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 2.4.10-1 * Tue May 25 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 2.4.10-1
- Initial import - Initial package

@ -1,37 +1,75 @@
%define debug_package %{nil} # Generated from elftools-1.1.3.gem by gem2rpm -*- rpm-spec -*-
%global gem_name elftools
%define gem_name elftools Name: rubygem-%{gem_name}
Version: 1.1.3
Release: 2%{?dist}
Summary: ELFTools - Pure ruby library for parsing and patching ELF files
License: MIT
URL: https://github.com/david942j/rbelftools
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 2.3
# BuildRequires: rubygem(pry) >= 0.10
# BuildRequires: rubygem(pry) < 1
# BuildRequires: rubygem(rspec) >= 3.7
# BuildRequires: rubygem(rspec) < 4
# BuildRequires: rubygem(rubocop) >= 0.59
# BuildRequires: rubygem(rubocop) < 1
# BuildRequires: rubygem(simplecov) >= 0.17
# BuildRequires: rubygem(simplecov) < 1
# BuildRequires: rubygem(yard) >= 0.9
# BuildRequires: rubygem(yard) < 1
BuildArch: noarch
Name: rubygem-%{gem_name} %description
Version: 1.1.3 A light weight ELF parser. elftools is designed to be a low-level ELF
Release: 1%{?dist} parser.
Summary: Pure ruby library for parsing and patching ELF files. Inspired by https://github.com/eliben/pyelftools.
License: MIT
URL: https://github.com/david942j/rb%{gem_name}
Source: https://github.com/david942j/rb%{gem_name}/archive/refs/tags/v%{version}.tar.gz
BuildRequires: rubygems-devel %package doc
BuildArch: noarch Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description %description doc
ELF parser in pure ruby implementation. This work is inspired by pyelftools by Eli Bendersky. Documentation for %{name}.
%prep %prep
%autosetup -n rb%{gem_name}-%{version} %setup -q -n %{gem_name}-%{version}
%build %build
gem build %{gem_name}.gemspec # Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install %gem_install
%install %install
mkdir -p %{buildroot}%{gem_dir} mkdir -p %{buildroot}%{gem_dir}
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/ cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
# rspec spec
popd
%files %files
%{gem_dir}/* %dir %{gem_instdir}
%doc LICENSE README.md %{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%changelog %changelog
* Fri May 21 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 1.1.3-1 * Tue May 25 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 1.1.3-1
- Initial import - Initial package

@ -0,0 +1,83 @@
# Generated from one_gadget-1.7.4.gem by gem2rpm -*- rpm-spec -*-
%global gem_name one_gadget
Name: rubygem-%{gem_name}
Version: 1.7.4
Release: 2%{?dist}
Summary: one_gadget
License: MIT
URL: https://github.com/david942j/one_gadget
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 2.4
# BuildRequires: rubygem(rspec) >= 3.7
# BuildRequires: rubygem(rspec) < 4
# BuildRequires: rubygem(rubocop) >= 1.0
# BuildRequires: rubygem(rubocop) < 2
# BuildRequires: rubygem(simplecov) >= 0.18.5
# BuildRequires: rubygem(simplecov) < 0.19
# BuildRequires: rubygem(yard) >= 0.9
# BuildRequires: rubygem(yard) < 1
BuildArch: noarch
Provides: %{gem_name} = %{version}
%description
When playing ctf pwn challenges we usually needs the one-gadget of
execve('/bin/sh', NULL, NULL).
This gem provides such gadget finder, no need to use IDA-pro every time like a
fool :p.
Type `one_gadget /path/to/libc` in terminal and having fun!
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* \
%{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%check
pushd .%{gem_instdir}
# rspec spec
popd
%files
%dir %{gem_instdir}
%{_bindir}/one_gadget
%{gem_instdir}/bin
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%changelog
* Tue May 25 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 1.7.4-1
- Initial package
Loading…
Cancel
Save