Replaced camel case states with snail_case
parent
9d848c8c3b
commit
3c1ce5072c
|
@ -44,7 +44,7 @@ module Exploit::Remote::TincdExploitClient
|
|||
# Setting up variables and calling cipher inits with file paths from configuration
|
||||
#
|
||||
def setup_ciphers
|
||||
@state = :idState
|
||||
@state = :id_state
|
||||
@buffer = ''
|
||||
@inbuffer = ''
|
||||
@encryption_queue = []
|
||||
|
@ -73,12 +73,12 @@ module Exploit::Remote::TincdExploitClient
|
|||
begin
|
||||
# send the first message
|
||||
id
|
||||
# Condition to get out of the while loop: ackState to false. Unsafe? Maybe a timeout?
|
||||
# Condition to get out of the while loop: ack_state to false. Unsafe? Maybe a timeout?
|
||||
while @keep_reading_socket
|
||||
process_data(sock.get_once)
|
||||
end
|
||||
rescue Errno::ECONNRESET
|
||||
if @state == :metakeyState
|
||||
if @state == :metakey_state
|
||||
fail 'Server reset the connection. Probably rejecting '\
|
||||
'the private key and/or client name (e.g. client name not associated '\
|
||||
'with client public key on server side). '\
|
||||
|
@ -138,15 +138,15 @@ module Exploit::Remote::TincdExploitClient
|
|||
@inbuffer += data
|
||||
end
|
||||
case @state
|
||||
when :idState
|
||||
when :id_state
|
||||
if line?
|
||||
data = read_line
|
||||
vprint_status("Received ID from server: [#{data[0..30]}]")
|
||||
@state = :metakeyState
|
||||
@state = :metakey_state
|
||||
# next expected state
|
||||
metakey
|
||||
end
|
||||
when :metakeyState
|
||||
when :metakey_state
|
||||
if line?
|
||||
data = read_line
|
||||
vprint_status("Received Metakey from server: [#{data[0..30]}...]")
|
||||
|
@ -174,10 +174,10 @@ module Exploit::Remote::TincdExploitClient
|
|||
# don't forget, it *does* matter if you do a
|
||||
# @bf_dec_cipher.reset or not, we're in OFB mode. DON'T.
|
||||
vprint_status('Metakey handshake/exchange completed')
|
||||
@state = :challengeState
|
||||
@state = :challenge_state
|
||||
challenge
|
||||
end
|
||||
when :challengeState
|
||||
when :challenge_state
|
||||
need_len = 2 * @client_key_len + 3
|
||||
if @inbuffer.length >= need_len
|
||||
data = pop_inbuffer_and_decrypt(need_len)
|
||||
|
@ -188,25 +188,25 @@ module Exploit::Remote::TincdExploitClient
|
|||
challenge2 = data[1][0...2 * @client_key_len]
|
||||
challenge2 = [challenge2].pack('H*')
|
||||
fail "Error in protocol. challenge2 length should be #{@client_key_len}." unless challenge2.length == @client_key_len
|
||||
@state = :challengeReplyState
|
||||
@state = :challenge_reply_state
|
||||
challenge_reply(challenge2)
|
||||
end
|
||||
when :challengeReplyState
|
||||
when :challenge_reply_state
|
||||
need_len = 43
|
||||
if @inbuffer.length >= need_len
|
||||
data = pop_inbuffer_and_decrypt(need_len)
|
||||
vprint_status("Received challenge reply from server:"\
|
||||
" [#{data.unpack('H*')[0][0..30]}...]")
|
||||
@state = :ackState
|
||||
@state = :ack_state
|
||||
ack
|
||||
end
|
||||
when :ackState
|
||||
when :ack_state
|
||||
need_len = 12
|
||||
if @inbuffer.length >= need_len
|
||||
data = pop_inbuffer_and_decrypt(need_len)
|
||||
vprint_status("Received ack (server accepted challenge response):"\
|
||||
"[#{data.unpack('H*')[0][0..30]}...]")
|
||||
@state = :doneState
|
||||
@state = :done_state
|
||||
send_packet
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue