Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed index out of range error

  • Loading branch information...
commit b28700b5db411843f51ecf7e0be7ce680ede97fc 1 parent 005d975
david karapetyan authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 players/secure_bot_net.rb
View
4 players/secure_bot_net.rb
@@ -31,7 +31,7 @@ def self.extended(base)
@target, friends = find_new_target
random_key = rand(secrets_length)
friends.each do |f|
- f.set_target(attack_message ^ (secrets[random_key] * secrets[random_key + 1]), random_key, @target)
+ f.set_target(attack_message ^ (secrets[random_key] * secrets[(random_key + 1) % secrets_length]), random_key, @target)
end
if @target
my_hp = stats[:health]
@@ -80,7 +80,7 @@ def self.extended(base)
end
define_method(:set_target) do |message, key_index, target|
- if (message ^ (secrets[key_index] * secrets[key_index + 1])) == attack_message
+ if (message ^ (secrets[key_index] * secrets[(key_index + 1) % secrets_length])) == attack_message
@target = target
end
nil # don't let the user know whether their cracking attempt was successful or not
Please sign in to comment.
Something went wrong with that request. Please try again.