rubypwn 0.0.11 → 0.0.12
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/docs/source/asm.rst +6 -6
- data/docs/source/elf.rst +33 -7
- data/lib/asm.rb +1 -1
- data/lib/elf.rb +9 -4
- data/rubypwn.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdbfa39fcd07f0f3e67209c9a003dd00cc7b4b94
|
4
|
+
data.tar.gz: a0abc8b6851725653437381ecbfc328509a3ba97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33b7b98a23449ac36c0bea51a1bb0bafab344f6d2717e1cfa21ff6eb12f2b199fe5a617124bab6d652ee18ccfbb3046272f1207e6a282e0eca61177b2b88825
|
7
|
+
data.tar.gz: f6ff1e327082bb8c3c21d71a45814cfe76d684ad8477ab0491f9079837a6d5af5bbfa07236d24733bd801678c01ca7325304eb6b8b82776bef5ed5f812a3fb18
|
data/docs/source/asm.rst
CHANGED
@@ -3,10 +3,10 @@ class Asm
|
|
3
3
|
|
4
4
|
Used to compile assembly code ::
|
5
5
|
|
6
|
-
2.2.
|
7
|
-
=> "
|
8
|
-
2.2.
|
9
|
-
=> "
|
10
|
-
2.2.
|
11
|
-
=> "
|
6
|
+
2.2.3 :004 > Asm.compile "push eax"
|
7
|
+
=> "50"
|
8
|
+
2.2.3 :005 > Asm.compile "push rax", arch: "amd64"
|
9
|
+
=> "50"
|
10
|
+
2.2.3 :012 > Asm.compile "mov r15, r14", arch: "arm", format: "c"
|
11
|
+
=> "\\x0e\\xf0\\xa0\\xe1"
|
12
12
|
|
data/docs/source/elf.rst
CHANGED
@@ -4,11 +4,11 @@ class Elf
|
|
4
4
|
Used to get some constant value from the binary::
|
5
5
|
|
6
6
|
2.2.2 :001 > require 'pp'
|
7
|
-
2.2.2 :
|
7
|
+
2.2.2 :002 > require 'rubypwn'
|
8
8
|
=> true
|
9
|
-
2.2.2 :
|
10
|
-
2.2.2 :
|
11
|
-
#<Elf:
|
9
|
+
2.2.2 :003 > e = Elf.new "traveller"
|
10
|
+
2.2.2 :004 > pp e
|
11
|
+
#<Elf:0x007fb498862550
|
12
12
|
@arch="x86",
|
13
13
|
@bits=32,
|
14
14
|
@dynamic=
|
@@ -34,6 +34,32 @@ Used to get some constant value from the binary::
|
|
34
34
|
"puts"=>134521260,
|
35
35
|
"kill"=>134521264,
|
36
36
|
"__sigsetjmp"=>134521268,
|
37
|
-
"exit"=>134521272}
|
38
|
-
|
39
|
-
|
37
|
+
"exit"=>134521272},
|
38
|
+
@sections=
|
39
|
+
{""=>{"offset"=>0, "flag"=>"r--"},
|
40
|
+
".interp"=>{"offset"=>134512948, "flag"=>"r--"},
|
41
|
+
".note.ABI-tag"=>{"offset"=>134512968, "flag"=>"r--"},
|
42
|
+
".hash"=>{"offset"=>134513000, "flag"=>"r--"},
|
43
|
+
".dynsym"=>{"offset"=>134513160, "flag"=>"r--"},
|
44
|
+
".dynstr"=>{"offset"=>134513496, "flag"=>"r--"},
|
45
|
+
".gnu.version"=>{"offset"=>134513728, "flag"=>"r--"},
|
46
|
+
".gnu.version_r"=>{"offset"=>134513772, "flag"=>"r--"},
|
47
|
+
".rel.dyn"=>{"offset"=>134513820, "flag"=>"r--"},
|
48
|
+
".rel.plt"=>{"offset"=>134513844, "flag"=>"r--"},
|
49
|
+
".init"=>{"offset"=>134513980, "flag"=>"r-x"},
|
50
|
+
".plt"=>{"offset"=>134514028, "flag"=>"r-x"},
|
51
|
+
".text"=>{"offset"=>134514320, "flag"=>"r-x"},
|
52
|
+
".fini"=>{"offset"=>134515932, "flag"=>"r-x"},
|
53
|
+
".rodata"=>{"offset"=>134515960, "flag"=>"r--"},
|
54
|
+
".eh_frame_hdr"=>{"offset"=>134516408, "flag"=>"r--"},
|
55
|
+
".eh_frame"=>{"offset"=>134516508, "flag"=>"r--"},
|
56
|
+
".ctors"=>{"offset"=>134520972, "flag"=>"rw-"},
|
57
|
+
".dtors"=>{"offset"=>134520980, "flag"=>"rw-"},
|
58
|
+
".jcr"=>{"offset"=>134520988, "flag"=>"rw-"},
|
59
|
+
".dynamic"=>{"offset"=>134520992, "flag"=>"rw-"},
|
60
|
+
".got"=>{"offset"=>134521192, "flag"=>"rw-"},
|
61
|
+
".got.plt"=>{"offset"=>134521196, "flag"=>"rw-"},
|
62
|
+
".data"=>{"offset"=>134521276, "flag"=>"rw-"},
|
63
|
+
".bss"=>{"offset"=>134521312, "flag"=>"rw-"},
|
64
|
+
".comment"=>{"offset"=>0, "flag"=>"r--"},
|
65
|
+
".shstrtab"=>{"offset"=>0, "flag"=>"r--"}}>
|
data/lib/asm.rb
CHANGED
@@ -4,7 +4,7 @@ require 'base64'
|
|
4
4
|
|
5
5
|
class Asm
|
6
6
|
# Supported Format: hex, c, binary
|
7
|
-
def self.compile(code, arch
|
7
|
+
def self.compile(code, arch:"i386", format:"hex")
|
8
8
|
r = RestClient.post 'http://atdog.tw/asm/compile', :code => code, :arch => arch, :format => format
|
9
9
|
r = JSON.parse r
|
10
10
|
if r['result'] == 1
|
data/lib/elf.rb
CHANGED
@@ -300,11 +300,16 @@ 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
|
+
@sections = Hash.new{|h, k| h[k] = Hash.new }
|
304
304
|
elf.e_shnum.times do |i|
|
305
305
|
sh_name = elf.sh[i].sh_name.to_i
|
306
306
|
elf.sh[i].name_str.assign BinData::Stringz.read strtab[sh_name..-1]
|
307
|
-
|
307
|
+
flag = "r"
|
308
|
+
flag += (elf.sh[i].sh_flags & 1) > 0 ? "w" : "-"
|
309
|
+
flag += (elf.sh[i].sh_flags & 4) > 0 ? "x" : "-"
|
310
|
+
|
311
|
+
@sections[elf.sh[i].name_str.to_s]["offset"] = elf.sh[i].sh_addr.to_i
|
312
|
+
@sections[elf.sh[i].name_str.to_s]["flag"] = flag
|
308
313
|
end
|
309
314
|
end
|
310
315
|
|
@@ -325,7 +330,7 @@ class Elf
|
|
325
330
|
@dynamic = {}
|
326
331
|
dynamic.each do |d|
|
327
332
|
# PLTREL
|
328
|
-
if d.d_tag == 20
|
333
|
+
if d.d_tag == 20
|
329
334
|
if d.d_val == 7
|
330
335
|
@dynamic["rel_type"]= "RELA"
|
331
336
|
elsif d.d_val == 17
|
@@ -417,7 +422,7 @@ class Elf
|
|
417
422
|
end
|
418
423
|
end
|
419
424
|
end
|
420
|
-
|
425
|
+
|
421
426
|
# extract information
|
422
427
|
@got = {}
|
423
428
|
rel.each do |r|
|
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.12'
|
4
|
+
s.date = '2015-09-09'
|
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.12
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|