Skip to content

Commit

Permalink
remove more instances of positive?
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Cook committed Aug 2, 2017
1 parent 6f97e45 commit 24d323d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/msf/core/post/hardware/automotive/uds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def response_hash_to_data_array(id, hash, start_offset = 5)
end
left2combine = hash["Packets"].size
counter = 0
while left2combine.positive? && (bad_count < (hash["Packets"].size * 2))
while left2combine > 0 && (bad_count < (hash["Packets"].size * 2))
# print_line("DEBUG Current status combine=#{left2combine} data=#{data.inspect}")
hash["Packets"].each do |pkt|
if (pkt.key? "ID") && pkt["ID"].hex == id.hex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def cmd_testerpresent(*args)
return
end
if id.blank? && !stop
if self.tpjobs.size.positive?
if self.tpjobs.size > 0
print_line("TesterPresent is currently active")
self.tpjobs.each_index do |jid|
if self.tpjobs[jid]
Expand Down
12 changes: 6 additions & 6 deletions lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def cmd_info(*args)
if mod
print_line(::Msf::Serializer::ReadableText.dump_module(mod))
mod_opt = ::Msf::Serializer::ReadableText.dump_options(mod, ' ')
print_line("\nModule options (#{mod.fullname}):\n\n#{mod_opt}") if mod_opt && mod_opt.length.positive?
print_line("\nModule options (#{mod.fullname}):\n\n#{mod_opt}") if mod_opt && mod_opt.length > 0
end
end

Expand All @@ -204,7 +204,7 @@ def cmd_status_help
# Get the HW bridge devices status
#
def cmd_status(*args)
if args.length.positive?
if args.length > 0
cmd_status_help
return true
end
Expand Down Expand Up @@ -235,7 +235,7 @@ def cmd_specialty_help
# Get the Hardware specialty
#
def cmd_specialty(*args)
if args.length.positive?
if args.length > 0
cmd_specialty_help
return true
end
Expand All @@ -251,7 +251,7 @@ def cmd_reset_help
# Performs a device reset or factory reset
#
def cmd_reset(*args)
if args.length.positive?
if args.length > 0
cmd_reset_help
return
end
Expand All @@ -268,7 +268,7 @@ def cmd_reboot_help
# Perform a device reboot
#
def cmd_reboot(*args)
if args.length.positive?
if args.length > 0
cmd_reboot_help
return
end
Expand All @@ -286,7 +286,7 @@ def cmd_load_custom_methods_help
# Loads custom methods if any exist
#
def cmd_load_custom_methods(*args)
if args.length.positive?
if args.length > 0
cmd_load_custom_methods_help
return true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def cmd_supported_idx
return
end
indexes = indexes['indexes']
unless indexes.size.positive?
unless indexes.size > 0
print_line('none')
return
end
Expand Down Expand Up @@ -535,7 +535,7 @@ def cmd_lowball_help

def cmd_lowball(*args)
self.idx ||= 0
if args.length.positive?
if args.length > 0
cmd_lowball_help
return
end
Expand All @@ -552,7 +552,7 @@ def cmd_maxpower_help
#
def cmd_maxpower(*args)
self.idx ||= 0
if args.length.positive?
if args.length > 0
cmd_maxpower_help
return
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def cmd_supported_devices
return
end
devices = devices["devices"]
unless devices.size.positive?
unless devices.size > 0
print_line("none")
return
end
Expand Down
4 changes: 2 additions & 2 deletions plugins/aggregator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def cmd_aggregator_save(*args)

group = "default"

if (@host && @host.length.positive?) && (@port && @port.length.positive? && @port.to_i > 0)
if (@host && @host.length > 0) && (@port && @port.length > 0 && @port.to_i > 0)
config = { "#{group}" => { 'server' => @host, 'port' => @port } }
::File.open("#{Aggregator_yaml}", "wb") { |f| f.puts YAML.dump(config) }
print_good("#{Aggregator_yaml} created.")
Expand Down Expand Up @@ -376,7 +376,7 @@ def cmd_aggregator_disconnect(*_args)

def aggregator_login

if !((@host && @host.length.positive?) && (@port && @port.length.positive? && @port.to_i > 0))
if !((@host && @host.length > 0) && (@port && @port.length > 0 && @port.to_i > 0))
usage_connect
return
end
Expand Down

0 comments on commit 24d323d

Please sign in to comment.