Skip to content

Commit f4636c4

Browse files
committed
Removing unused endjunk, sections_end, cert_entry
1 parent 77e9996 commit f4636c4

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

lib/msf/util/exe.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,11 @@ def self.to_win32pe(framework, code, opts={})
169169
payload = win32_rwx_exec(code)
170170

171171
# Create a new PE object and run through sanity checks
172-
endjunk = true
173172
fsize = File.size(opts[:template])
174173
pe = Rex::PeParsey::Pe.new_from_file(opts[:template], true)
175174
text = nil
176-
sections_end = 0
177175
pe.sections.each do |sec|
178176
text = sec if sec.name == ".text"
179-
sections_end = sec.size + sec.file_offset if sec.file_offset >= sections_end
180-
endjunk = false if sec.contains_file_offset?(fsize-1)
181-
end
182-
#also check to see if there is a certificate
183-
cert_entry = pe.hdr.opt['DataDirectory'][4]
184-
#if the cert is the only thing past the sections, we can handle.
185-
if cert_entry.v['VirtualAddress'] + cert_entry.v['Size'] >= fsize and sections_end >= cert_entry.v['VirtualAddress']
186-
endjunk = false
187177
end
188178

189179
#try to inject code into executable by adding a section without affecting executable behavior

0 commit comments

Comments
 (0)