From 24d323d4ed75ea1c8a7588e45b47c9a24492e2c5 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 2 Aug 2017 12:47:34 -0500 Subject: [PATCH] remove more instances of positive? --- lib/msf/core/post/hardware/automotive/uds.rb | 2 +- .../ui/console/command_dispatcher/automotive.rb | 2 +- .../hwbridge/ui/console/command_dispatcher/core.rb | 12 ++++++------ .../ui/console/command_dispatcher/rftransceiver.rb | 6 +++--- .../hwbridge/ui/console/command_dispatcher/zigbee.rb | 2 +- plugins/aggregator.rb | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/msf/core/post/hardware/automotive/uds.rb b/lib/msf/core/post/hardware/automotive/uds.rb index 5dca25a51c..2a67b78736 100644 --- a/lib/msf/core/post/hardware/automotive/uds.rb +++ b/lib/msf/core/post/hardware/automotive/uds.rb @@ -33,7 +33,7 @@ module UDS 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 diff --git a/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb b/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb index 5f2b0928b2..6d3a3e0528 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb @@ -269,7 +269,7 @@ class Console::CommandDispatcher::Automotive 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] diff --git a/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb b/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb index b0c8a943b6..b514a8902a 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb @@ -185,7 +185,7 @@ class Console::CommandDispatcher::Core 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 @@ -204,7 +204,7 @@ class Console::CommandDispatcher::Core # Get the HW bridge devices status # def cmd_status(*args) - if args.length.positive? + if args.length > 0 cmd_status_help return true end @@ -235,7 +235,7 @@ class Console::CommandDispatcher::Core # Get the Hardware specialty # def cmd_specialty(*args) - if args.length.positive? + if args.length > 0 cmd_specialty_help return true end @@ -251,7 +251,7 @@ class Console::CommandDispatcher::Core # Performs a device reset or factory reset # def cmd_reset(*args) - if args.length.positive? + if args.length > 0 cmd_reset_help return end @@ -268,7 +268,7 @@ class Console::CommandDispatcher::Core # Perform a device reboot # def cmd_reboot(*args) - if args.length.positive? + if args.length > 0 cmd_reboot_help return end @@ -286,7 +286,7 @@ class Console::CommandDispatcher::Core # 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 diff --git a/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb b/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb index 0e3de354f4..53449512ca 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb @@ -49,7 +49,7 @@ class Console::CommandDispatcher::RFtransceiver return end indexes = indexes['indexes'] - unless indexes.size.positive? + unless indexes.size > 0 print_line('none') return end @@ -535,7 +535,7 @@ class Console::CommandDispatcher::RFtransceiver def cmd_lowball(*args) self.idx ||= 0 - if args.length.positive? + if args.length > 0 cmd_lowball_help return end @@ -552,7 +552,7 @@ class Console::CommandDispatcher::RFtransceiver # def cmd_maxpower(*args) self.idx ||= 0 - if args.length.positive? + if args.length > 0 cmd_maxpower_help return end diff --git a/lib/rex/post/hwbridge/ui/console/command_dispatcher/zigbee.rb b/lib/rex/post/hwbridge/ui/console/command_dispatcher/zigbee.rb index 21cd650638..6493949bc1 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/zigbee.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/zigbee.rb @@ -44,7 +44,7 @@ class Console::CommandDispatcher::Zigbee return end devices = devices["devices"] - unless devices.size.positive? + unless devices.size > 0 print_line("none") return end diff --git a/plugins/aggregator.rb b/plugins/aggregator.rb index 9900ef806a..4822c8271e 100644 --- a/plugins/aggregator.rb +++ b/plugins/aggregator.rb @@ -124,7 +124,7 @@ module Msf 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.") @@ -376,7 +376,7 @@ module Msf 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