Skip to content

Commit

Permalink
reorder requires
Browse files Browse the repository at this point in the history
  • Loading branch information
david942j committed May 26, 2017
1 parent c1ce8f8 commit e385067
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
When playing ctf pwn challenges we usually need the one-gadget RCE (remote code execution),
which leads to call `execve('/bin/sh', NULL, NULL)`.

This gem provides such gadgets finder, no need to use objdump or IDA-pro every time like a fool :wink:.
This gem provides such gadgets finder, no need to use objdump or IDA-pro every time like a fool :wink:

To use this tool, just type `one_gadget` in command line and enjoy the magic :laughing:!
To use this tool, just type `one_gadget /path/to/libc` in command line and enjoy the magic :laughing:

Note: Supports amd64 and i386!

Expand All @@ -24,13 +24,13 @@ Available on RubyGems.org!
gem install one_gadget
```

Note: you need to have ruby version >= 2.1.0, you can use `ruby --version` to check.
Note: require ruby version >= 2.1.0, you can use `ruby --version` to check.

## Implementation

OneGadget use simple self-implement symbolic execution to find the constraints of gadgets.

The article introducing how I developed this tool can be found [here](https://david942j.blogspot.com/2017/02/project-one-gadget-in-glibc.html).
The article introducing how I develop this tool can be found [here](https://david942j.blogspot.com/2017/02/project-one-gadget-in-glibc.html).

## Usage

Expand Down Expand Up @@ -134,4 +134,4 @@ one_gadget('60131540dadc6796cab33388349e6e4e68692053')
Any suggestion or feature request is welcome! Feel free to send a pull request.

Please let me know if you find any libc that make OneGadget fail to find gadgets.
And, if you like this work, I'll be happy to be [stared](https://github.com/david942j/one_gadget/stargazers) :grimacing:.
And, if you like this work, I'll be happy to be [stared](https://github.com/david942j/one_gadget/stargazers) :grimacing:
3 changes: 0 additions & 3 deletions lib/one_gadget.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# OneGadget - To find the execve(/bin/sh, 0, 0) in glibc.
#
# @author david942j
require 'one_gadget/helper'

# Main module.
module OneGadget
Expand Down Expand Up @@ -45,8 +44,6 @@ def gadgets(file: nil, build_id: nil, details: false, force_file: false)
# Can be either +build_id+ or path to libc.
# @param [Mixed] options
# See {OneGadget#gadgets} for ore information.
# @param [String] build_id
# Libc's +build_id+.
# @return [Array<OneGadget::Gadget::Gadget>, Array<Integer>]
# The gadgets found.
# @example
Expand Down
2 changes: 1 addition & 1 deletion lib/one_gadget/fetcher.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'one_gadget/helper'
require 'one_gadget/fetchers/amd64'
require 'one_gadget/fetchers/i386'
require 'one_gadget/gadget'
require 'one_gadget/helper'

module OneGadget
# To find gadgets.
Expand Down
3 changes: 2 additions & 1 deletion lib/one_gadget/fetchers/amd64.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'one_gadget/fetchers/base'
require 'one_gadget/emulators/amd64'
require 'one_gadget/fetchers/base'

module OneGadget
module Fetcher
# Fetcher for amd64.
Expand Down
5 changes: 3 additions & 2 deletions lib/one_gadget/fetchers/i386.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require 'one_gadget/fetchers/base'
require 'one_gadget/emulators/i386'
require 'elftools'

require 'one_gadget/emulators/i386'
require 'one_gadget/fetchers/base'

module OneGadget
module Fetcher
# Fetcher for i386.
Expand Down
1 change: 1 addition & 0 deletions lib/one_gadget/logger.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'logger'

require 'one_gadget/helper'

module OneGadget
Expand Down
4 changes: 3 additions & 1 deletion one_gadget.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'one_gadget/version'

require 'date'

require 'one_gadget/version'

Gem::Specification.new do |s|
s.name = 'one_gadget'
s.version = ::OneGadget::VERSION
Expand Down
1 change: 1 addition & 0 deletions spec/gadget_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'one_gadget/gadget'
require 'one_gadget/helper'

describe OneGadget::Gadget do
before(:all) do
@build_id = 'fake_id'
Expand Down

0 comments on commit e385067

Please sign in to comment.