Skip to content

Commit

Permalink
Minor fixes to ruby style things
Browse files Browse the repository at this point in the history
  • Loading branch information
floyd-fuh committed Nov 17, 2014
1 parent 91aa5fa commit 9243cfd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions lib/msf/core/exploit/tincd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def send_recv(packet_payload)
end
rescue Errno::ECONNRESET
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). '\
'Wrong server public key possible too. '\
'Please recheck client name, client private key and '\
'server public key.'
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). ' +
'Wrong server public key possible too. ' +
'Please recheck client name, client private key and ' +
'server public key.'
else
fail 'Server reset the connection, reason unknown.'
end
Expand Down Expand Up @@ -149,7 +149,7 @@ def process_data(data)
data = read_line
vprint_status("Received Metakey from server: [#{data[0..30]}...]")
data = data.split(' ')
fail 'Error in protocol. The first byte should be an ASCII 1.' unless data[0] == '1'
fail 'Error in protocol. The first byte should be an ASCII 1.' unless data.first == '1'
hexkey_s2 = data[5].rstrip # ("\n")
fail "Error in protocol. metakey length should be #{@client_key_len}." unless hexkey_s2.length == @client_key_len * 2
@enckey_s2 = [hexkey_s2].pack('H*')
Expand Down Expand Up @@ -179,10 +179,10 @@ def process_data(data)
need_len = 2 * @client_key_len + 3
if @inbuffer.length >= need_len
data = pop_inbuffer_and_decrypt(need_len)
vprint_status("Received challenge from server: "\
"[#{data.unpack('H*')[0][0..30]}...]")
vprint_status("Received challenge from server: " +
"[#{data.unpack('H*')[0][0..30]}...]")
data = data.split(' ', 2)
fail 'Error in protocol. The first byte should be an ASCII 2. Got #{data[0]}.' unless data[0] == '2'
fail 'Error in protocol. The first byte should be an ASCII 2. Got #{data[0]}.' unless data.first == '2'
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
Expand All @@ -193,17 +193,17 @@ def process_data(data)
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]}...]")
vprint_status("Received challenge reply from server:" +
" [#{data.unpack('H*')[0][0..30]}...]")
@state = :ack_state
ack
end
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]}...]")
vprint_status("Received ack (server accepted challenge response):" +
"[#{data.unpack('H*')[0][0..30]}...]")
@state = :done_state
send_packet
end
Expand All @@ -216,7 +216,7 @@ def process_data(data)
#
def handle_write
# handle encryption queue first
if @encryption_queue.length > 0
unless @encryption_queue.empty?
msg = @encryption_queue[0]
@encryption_queue.delete_at(0)
@buffer = @bf_enc_cipher.update(msg)
Expand All @@ -225,10 +225,10 @@ def handle_write
# the resulting block is used to encrypt the next block.
end

if @buffer.length > 0
unless @buffer.empty?
sent = send_data(@buffer)
vprint_status("Sent #{sent} bytes: "\
"[#{@buffer.unpack('H*')[0][0..30]}...]")
vprint_status("Sent #{sent} bytes: " +
"[#{@buffer.unpack('H*')[0][0..30]}...]")
@buffer = @buffer[sent..@buffer.length]
end
end
Expand Down Expand Up @@ -318,8 +318,8 @@ def challenge_reply(challenge2)
# Ack state to signalise challenge/response was successfull
#
def ack
vprint_status('Sending ack (signalise server that we accept challenge'\
'reply, ciphertext)')
vprint_status('Sending ack (signalise server that we accept challenge' +
'reply, ciphertext)')
@encryption_queue.push("4 #{datastore['RPORT']} 123 0 \n")
handle_write
end
Expand Down
2 changes: 1 addition & 1 deletion modules/exploits/multi/vpn/tincd_bof.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def initialize(info = {})
# Has to be short, usually either . or /tmp works
# /tmp could be mounted as noexec
# . is usually only working if tincd is running as root
OptString.new('BINARY_DROP_LOCATION', [false, 'Location to drop executable on server, usually /tmp or .', '/tmp']),
OptString.new('BINARY_DROP_LOCATION', [false, 'Short location to drop executable on server, usually /tmp or .', '/tmp']),
OptInt.new('BRUTEFORCE_TRIES', [false, 'How many brute force tries (ASLR brute force)', 200]),
OptInt.new('WAIT', [false, 'Waiting time for server daemon restart (ASLR brute force)', 3])
], self
Expand Down

0 comments on commit 9243cfd

Please sign in to comment.