Browse Source

one_gadget: converts spec files to gem2rpm

master
Carlos Mogas da Silva 6 months ago
parent
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

BIN
one_gadget/SOURCES/rubygem-bindata-2.4.10.tar.gz

Binary file not shown.

12
one_gadget/SOURCES/rubygem-bindata-fix-gemspec-files.patch

@ -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')

BIN
one_gadget/bindata-2.4.10.gem

Binary file not shown.

5
one_gadget/create_srpm.sh

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

BIN
one_gadget/elftools-1.1.3.gem

Binary file not shown.

BIN
one_gadget/one_gadget-1.7.4.gem

Binary file not shown.

41
one_gadget/one_gadget.spec

@ -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

BIN
one_gadget/rubygem-bindata-2.4.10-1.fc34.src.rpm

Binary file not shown.

88
one_gadget/rubygem-bindata.spec

@ -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}
Version: 2.4.10
Release: 1%{?dist}
Summary: BinData provides a declarative way to read and write structured binary data.
%description
BinData is a declarative way to read and write binary file formats.
This means the programmer specifies *what* the format of the binary
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
BuildArch: noarch
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description
BinData makes it easy to create new data types.
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.
%description doc
Documentation for %{name}.
%prep
%autosetup -n %{gem_name}-%{version}
%setup -q -n %{gem_name}-%{version}
%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
%install
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
%{gem_dir}/*
%doc BSDL README.md
%dir %{gem_instdir}
%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
* Fri May 21 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 2.4.10-1
- Initial import
* Tue May 25 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 2.4.10-1
- Initial package

78
one_gadget/rubygem-elftools.spec

@ -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}
Version: 1.1.3
Release: 1%{?dist}
Summary: Pure ruby library for parsing and patching ELF files.
%description
A light weight ELF parser. elftools is designed to be a low-level ELF
parser.
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
BuildArch: noarch
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description
ELF parser in pure ruby implementation. This work is inspired by pyelftools by Eli Bendersky.
%description doc
Documentation for %{name}.
%prep
%autosetup -n rb%{gem_name}-%{version}
%setup -q -n %{gem_name}-%{version}
%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
%install
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
%{gem_dir}/*
%doc LICENSE README.md
%dir %{gem_instdir}
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%changelog
* Fri May 21 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 1.1.3-1
- Initial import
* Tue May 25 2021 Carlos Mogas da Silva <r3pek@r3pek.org> - 1.1.3-1
- Initial package

83
one_gadget/rubygem-one_gadget.spec

@ -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