elftools 1.2.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elftools/dynamic.rb +1 -1
- data/lib/elftools/elf_file.rb +5 -5
- data/lib/elftools/note.rb +1 -1
- data/lib/elftools/sections/section.rb +1 -1
- data/lib/elftools/segments/segment.rb +4 -4
- data/lib/elftools/util.rb +1 -1
- data/lib/elftools/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baf5180fcccc876442fd65581828e91f8a362657f788a64c36ea7e2fbcd20c5a
|
4
|
+
data.tar.gz: 4372260ec8fc5ca97b96e14f6413ca5126c79f716446f804974f946ee06bd09f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c5ab262e05127590f9cf1e28cc787e63db35a8fce1a9be86a55ce2e1ec813a6044a0f68d26149ad222a1cc67ef763afdf3df219b9bf8de28095f5ac4b7e9500
|
7
|
+
data.tar.gz: fea4f806def364feca723f04490f80541466d39ef7ac24fa6eb491a463baa90839d2b0bc6e1234027959abe3ec7ef6ac6874afbe8cda915570ddf6f5527e2f70
|
data/lib/elftools/dynamic.rb
CHANGED
@@ -96,7 +96,7 @@ module ELFTools
|
|
96
96
|
@tag_at_map ||= {}
|
97
97
|
return @tag_at_map[n] if @tag_at_map[n]
|
98
98
|
|
99
|
-
dyn = Structs::ELF_Dyn.new(endian:
|
99
|
+
dyn = Structs::ELF_Dyn.new(endian:)
|
100
100
|
dyn.elf_class = header.elf_class
|
101
101
|
stream.pos = tag_start + n * dyn.num_bytes
|
102
102
|
dyn.offset = stream.pos
|
data/lib/elftools/elf_file.rb
CHANGED
@@ -36,7 +36,7 @@ module ELFTools
|
|
36
36
|
return @header if defined?(@header)
|
37
37
|
|
38
38
|
stream.pos = 0
|
39
|
-
@header = Structs::ELF_Ehdr.new(endian
|
39
|
+
@header = Structs::ELF_Ehdr.new(endian:, offset: stream.pos)
|
40
40
|
@header.elf_class = elf_class
|
41
41
|
@header.read(stream)
|
42
42
|
end
|
@@ -237,7 +237,7 @@ module ELFTools
|
|
237
237
|
# #=> #<ELFTools::Segments::NoteSegment:0x005629dda1e4f8>
|
238
238
|
#
|
239
239
|
# # this is ok
|
240
|
-
# elf.segment_by_type('note') # will be
|
240
|
+
# elf.segment_by_type('note') # will be transformed into `PT_NOTE`
|
241
241
|
# #=> #<ELFTools::Segments::NoteSegment:0x005629dda1e4f8>
|
242
242
|
# @example
|
243
243
|
# elf.segment_by_type(1337)
|
@@ -290,7 +290,7 @@ module ELFTools
|
|
290
290
|
# elf = ELFTools::ELFFile.new(File.open('/bin/cat'))
|
291
291
|
# elf.offset_from_vma(0x401337)
|
292
292
|
# #=> 4919 # 0x1337
|
293
|
-
def offset_from_vma(vma, size =
|
293
|
+
def offset_from_vma(vma, size = 1)
|
294
294
|
segments_by_type(:load) do |seg|
|
295
295
|
return seg.vma_to_offset(vma) if seg.vma_in?(vma, size)
|
296
296
|
end
|
@@ -358,7 +358,7 @@ module ELFTools
|
|
358
358
|
|
359
359
|
def create_section(n)
|
360
360
|
stream.pos = header.e_shoff + n * header.e_shentsize
|
361
|
-
shdr = Structs::ELF_Shdr.new(endian
|
361
|
+
shdr = Structs::ELF_Shdr.new(endian:, offset: stream.pos)
|
362
362
|
shdr.elf_class = elf_class
|
363
363
|
shdr.read(stream)
|
364
364
|
Sections::Section.create(shdr, stream,
|
@@ -369,7 +369,7 @@ module ELFTools
|
|
369
369
|
|
370
370
|
def create_segment(n)
|
371
371
|
stream.pos = header.e_phoff + n * header.e_phentsize
|
372
|
-
phdr = Structs::ELF_Phdr[elf_class].new(endian
|
372
|
+
phdr = Structs::ELF_Phdr[elf_class].new(endian:, offset: stream.pos)
|
373
373
|
phdr.elf_class = elf_class
|
374
374
|
Segments::Segment.create(phdr.read(stream), stream, offset_from_vma: method(:offset_from_vma))
|
375
375
|
end
|
data/lib/elftools/note.rb
CHANGED
@@ -79,7 +79,7 @@ module ELFTools
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def create_note(cur)
|
82
|
-
nhdr = Structs::ELF_Nhdr.new(endian
|
82
|
+
nhdr = Structs::ELF_Nhdr.new(endian:, offset: stream.pos).read(stream)
|
83
83
|
ELFTools::Note::Note.new(nhdr, stream, cur)
|
84
84
|
end
|
85
85
|
|
@@ -20,7 +20,7 @@ module ELFTools
|
|
20
20
|
@offset_from_vma = offset_from_vma
|
21
21
|
end
|
22
22
|
|
23
|
-
# Return +header.p_type+ in a
|
23
|
+
# Return +header.p_type+ in a simpler way.
|
24
24
|
# @return [Integer]
|
25
25
|
# The type, meaning of types are defined in {Constants::PT}.
|
26
26
|
def type
|
@@ -35,19 +35,19 @@ module ELFTools
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Is this segment readable?
|
38
|
-
# @return [Boolean]
|
38
|
+
# @return [Boolean] True or false.
|
39
39
|
def readable?
|
40
40
|
(header.p_flags & 4) == 4
|
41
41
|
end
|
42
42
|
|
43
43
|
# Is this segment writable?
|
44
|
-
# @return [Boolean]
|
44
|
+
# @return [Boolean] True or false.
|
45
45
|
def writable?
|
46
46
|
(header.p_flags & 2) == 2
|
47
47
|
end
|
48
48
|
|
49
49
|
# Is this segment executable?
|
50
|
-
# @return [Boolean]
|
50
|
+
# @return [Boolean] True or false.
|
51
51
|
def executable?
|
52
52
|
(header.p_flags & 1) == 1
|
53
53
|
end
|
data/lib/elftools/util.rb
CHANGED
@@ -5,7 +5,7 @@ module ELFTools
|
|
5
5
|
module Util
|
6
6
|
# Class methods.
|
7
7
|
module ClassMethods
|
8
|
-
# Round up the number to be
|
8
|
+
# Round up the number to be multiple of
|
9
9
|
# +2**bit+.
|
10
10
|
# @param [Integer] num Number to be rounded-up.
|
11
11
|
# @param [Integer] bit How many bit to be aligned.
|
data/lib/elftools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elftools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- david942j
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -169,14 +169,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
169
|
requirements:
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
172
|
+
version: '3.1'
|
173
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
175
|
- - ">="
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
178
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
179
|
+
rubygems_version: 3.5.3
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: ELFTools - Pure ruby library for parsing and patching ELF files
|