rubypwn 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/docs/source/basic.rst +4 -4
- data/docs/source/elf.rst +6 -4
- data/lib/elf.rb +5 -3
- data/rubypwn.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbf422884fedea20a4e5333215889316c4b0def9
|
4
|
+
data.tar.gz: 6af0c1423b2f3be68fb4582d556fde27eddc0c07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dea9f3490428d7878404d8eadc82a9dee7f840a390f8ba507fe1605732aa8db070188cfea53fa995f2d62567f9cb953f5f82df9467340ec18521632dd21af89
|
7
|
+
data.tar.gz: 35f02a7e251653d738db0617b3bf8bc1b907e8afdf35cdb64ef13df00f2be0b527268b6bfdcfaa67f6f32df45575592a2ac6d1947b31bc60ac6e339c51d188c8
|
data/.gitignore
CHANGED
data/docs/source/basic.rst
CHANGED
@@ -3,10 +3,10 @@ Useful Function
|
|
3
3
|
|
4
4
|
* **def i64()** ::
|
5
5
|
|
6
|
-
2.2.2 :004 > a =
|
7
|
-
=>
|
8
|
-
2.2.2 :005 >
|
9
|
-
=>
|
6
|
+
2.2.2 :004 > a = 0x1234567890abcdef
|
7
|
+
=> 1311768467294899695
|
8
|
+
2.2.2 :005 > i64 a
|
9
|
+
=> "\xEF\xCD\xAB\x90xV4\x12"
|
10
10
|
|
11
11
|
|
12
12
|
* **def i32()**
|
data/docs/source/elf.rst
CHANGED
@@ -3,11 +3,11 @@ class Elf
|
|
3
3
|
|
4
4
|
Used to get some constant value from the binary::
|
5
5
|
|
6
|
-
2.2.
|
7
|
-
2.2.
|
6
|
+
2.2.2 :001 > require 'pp'
|
7
|
+
2.2.2 :001 > require 'rubypwn'
|
8
8
|
=> true
|
9
|
-
2.2.
|
10
|
-
2.2.2 :
|
9
|
+
2.2.2 :002 > e = Elf.new "traveller"
|
10
|
+
2.2.2 :003 > pp Elf.new "traveller"
|
11
11
|
#<Elf:0x007fdd23c3b510
|
12
12
|
@arch="x86",
|
13
13
|
@bits=32,
|
@@ -35,3 +35,5 @@ Used to get some constant value from the binary::
|
|
35
35
|
"kill"=>134521264,
|
36
36
|
"__sigsetjmp"=>134521268,
|
37
37
|
"exit"=>134521272}>
|
38
|
+
2.2.2 :007 > puts "%08x" % e.got['kill']
|
39
|
+
0804a1b0
|
data/lib/elf.rb
CHANGED
@@ -146,7 +146,7 @@ class ElfParser < BinData::Record
|
|
146
146
|
int32 :sh_type
|
147
147
|
choice :sh_flags, :selection => lambda{e_ident.ei_class}, :choices => {1 => :int32, 2 => :int64}
|
148
148
|
# Section virtual addr at execution
|
149
|
-
choice :sh_addr, :selection => lambda{e_ident.ei_class}, :choices => {1 => :
|
149
|
+
choice :sh_addr, :selection => lambda{e_ident.ei_class}, :choices => {1 => :uint32, 2 => :uint64}
|
150
150
|
# Section file offset
|
151
151
|
choice :sh_offset, :selection => lambda{e_ident.ei_class}, :choices => {1 => :uint32, 2 => :uint64}
|
152
152
|
# Section size in bytes
|
@@ -271,13 +271,13 @@ end
|
|
271
271
|
|
272
272
|
class Elf
|
273
273
|
#attr_accessor :gotplt
|
274
|
-
attr_accessor :arch, :bits, :dynamic, :got, :global
|
274
|
+
attr_accessor :arch, :bits, :dynamic, :sections, :got, :global
|
275
275
|
|
276
276
|
def initialize(file)
|
277
277
|
# To avoid unicode
|
278
278
|
binary = File.read(file).force_encoding('binary')
|
279
279
|
# To fix bugs leading eof, that's why here is a newline ...
|
280
|
-
elf = ElfParser.read binary + "\n"
|
280
|
+
elf = ElfParser.read binary + "\n"
|
281
281
|
# parse information we need
|
282
282
|
extract_info binary, elf
|
283
283
|
end
|
@@ -300,9 +300,11 @@ class Elf
|
|
300
300
|
def parse_section_name(binary, elf)
|
301
301
|
strtab_offset = elf.sh[elf.e_shstrndx].sh_offset.to_i
|
302
302
|
strtab = binary[(strtab_offset)..-1]
|
303
|
+
@sections = {}
|
303
304
|
elf.e_shnum.times do |i|
|
304
305
|
sh_name = elf.sh[i].sh_name.to_i
|
305
306
|
elf.sh[i].name_str.assign BinData::Stringz.read strtab[sh_name..-1]
|
307
|
+
@sections[elf.sh[i].name_str.to_s] = elf.sh[i].sh_addr.to_i
|
306
308
|
end
|
307
309
|
end
|
308
310
|
|
data/rubypwn.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rubypwn'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2015-09-
|
3
|
+
s.version = '0.0.11'
|
4
|
+
s.date = '2015-09-08'
|
5
5
|
s.summary = "ruby pwn tools"
|
6
6
|
s.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
|
7
7
|
A simple library for CTF pwning challenges.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubypwn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- atdog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.4.
|
139
|
+
rubygems_version: 2.4.5.1
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: ruby pwn tools
|