Skip to content

Commit e9f341f

Browse files
committed
Rename to more intention-revealing name
1 parent 41e41e2 commit e9f341f

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

lib/msf/core/encoded_payload.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def self.create(pinst, reqs = {})
2323
p = EncodedPayload.new(pinst.framework, pinst, reqs)
2424

2525
p.generate(reqs['Raw'])
26-
26+
2727
return p
2828
end
2929

@@ -59,7 +59,7 @@ def generate(raw = nil)
5959
if (priority == 0)
6060
Thread.current.priority = 1
6161
end
62-
62+
6363
begin
6464
# First, validate
6565
pinst.validate()
@@ -115,6 +115,7 @@ def encode
115115
if reqs['Encoder']
116116
reqs['Encoder'] = reqs['Encoder'].encode(framework.encoders.keys[0].encoding)
117117
end
118+
118119
# If the caller had a preferred encoder, use this encoder only
119120
if ((reqs['Encoder']) and (preferred = framework.encoders[reqs['Encoder']]))
120121
encoders = [ [reqs['Encoder'], preferred] ]
@@ -166,7 +167,7 @@ def encode
166167
if (reqs['ForceSaveRegisters'] and
167168
reqs['EncoderOptions'] and
168169
(reqs['EncoderOptions']['SaveRegisters'].to_s.length > 0) and
169-
(! self.encoder.preserves_registers?))
170+
(! self.encoder.can_preserve_registers?))
170171
wlog("#{pinst.refname}: Encoder #{encoder.refname} does not preserve registers and the caller needs #{reqs['EncoderOptions']['SaveRegisters']} preserved.",
171172
'core', LEV_1)
172173
next
@@ -238,10 +239,11 @@ def encode
238239
self.encoded = eout
239240
break
240241
}
242+
241243
# If the encoded payload is nil, raise an exception saying that we
242244
# suck at life.
243245
if (self.encoded == nil)
244-
self.encoder = nil
246+
self.encoder = nil
245247
raise NoEncodersSucceededError,
246248
"#{pinst.refname}: All encoders failed to encode.",
247249
caller

lib/msf/core/encoder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def to_native(buf)
400400
#
401401
# Determines whether the encoder can preserve registers at all
402402
#
403-
def preserves_registers?
403+
def can_preserve_registers?
404404
false
405405
end
406406

modules/encoders/x86/call4_dword_xor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def decoder_stub(state)
5151
end
5252

5353
# Indicate that this module can preserve some registers
54-
def preserves_registers?
54+
def can_preserve_registers?
5555
true
5656
end
5757

modules/encoders/x86/countdown.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def encode_block(state, block)
6464
end
6565

6666
# Indicate that this module can preserve some registers
67-
def preserves_registers?
67+
def can_preserve_registers?
6868
true
6969
end
7070

modules/encoders/x86/fnstenv_mov.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def decoder_stub(state)
5555
end
5656

5757
# Indicate that this module can preserve some registers
58-
def preserves_registers?
58+
def can_preserve_registers?
5959
true
6060
end
6161

modules/encoders/x86/shikata_ga_nai.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def decoder_stub(state)
6969
end
7070

7171
# Indicate that this module can preserve some registers
72-
def preserves_registers?
72+
def can_preserve_registers?
7373
true
7474
end
7575

0 commit comments

Comments
 (0)