1
0
Fork 0

one_gadget: converts spec files to gem2rpm

This commit is contained in:
Carlos Mogas da Silva 2021-05-25 19:57:58 +01:00
parent 3c63923851
commit 5db7396977
11 changed files with 210 additions and 105 deletions

View file

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

View file

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

View file

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

View file

@ -1,40 +1,82 @@
%define debug_package %{nil}
%define gem_name bindata
# Generated from bindata-2.4.10.gem by gem2rpm -*- rpm-spec -*-
%global gem_name bindata
Name: rubygem-%{gem_name}
Version: 2.4.10
Release: 1%{?dist}
Summary: BinData provides a declarative way to read and write structured binary data.
License: BSD-2-Clause
URL: https://github.com/dmendel/%{gem_name}
Source: %{name}-%{version}.tar.gz
Patch: rubygem-bindata-fix-gemspec-files.patch
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
%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.
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.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%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

View file

@ -1,37 +1,75 @@
%define debug_package %{nil}
%define gem_name elftools
# Generated from elftools-1.1.3.gem by gem2rpm -*- rpm-spec -*-
%global gem_name elftools
Name: rubygem-%{gem_name}
Version: 1.1.3
Release: 1%{?dist}
Summary: Pure ruby library for parsing and patching ELF files.
Release: 2%{?dist}
Summary: ELFTools - Pure ruby library for parsing and patching ELF files
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
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
%description
ELF parser in pure ruby implementation. This work is inspired by pyelftools by Eli Bendersky.
A light weight ELF parser. elftools is designed to be a low-level ELF
parser.
Inspired by https://github.com/eliben/pyelftools.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%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

View file

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