From d0b13544dd1cd9bb1f124bd68211955bd24d26e6 Mon Sep 17 00:00:00 2001 From: Pearce Barry Date: Wed, 17 May 2017 10:57:39 -0500 Subject: [PATCH] Agreed-upon feedback updates. --- .../extensions/automotive/uds_errors.rb | 4 ++-- .../console/command_dispatcher/automotive.rb | 20 +++++++++---------- .../ui/console/command_dispatcher/core.rb | 8 ++++---- .../command_dispatcher/rftransceiver.rb | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/rex/post/hwbridge/extensions/automotive/uds_errors.rb b/lib/rex/post/hwbridge/extensions/automotive/uds_errors.rb index 2f72dc751f..0215d5a20a 100644 --- a/lib/rex/post/hwbridge/extensions/automotive/uds_errors.rb +++ b/lib/rex/post/hwbridge/extensions/automotive/uds_errors.rb @@ -56,8 +56,8 @@ ERR_MNEMONIC = { 0x78 => "RCRRP", 0x7E => "SFNSIAS", 0x7F => "SNSIAS", - 0x81 => "RTH", - 0x82 => "RTL", + 0x81 => "RPMTH", + 0x82 => "RPMTL", 0x83 => "EIR", 0x84 => "EINR", 0x85 => "ERTTL", 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 b2a3a275c9..5f2b0928b2 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb @@ -219,7 +219,7 @@ class Console::CommandDispatcher::Automotive bytes = data.scan(/../) # Break up data string into 2 char (byte) chunks if bytes.size > 8 print_error("Data section can only contain a max of 8 bytes (for now)") - return result + return end opt = {} opt['TIMEOUT'] = timeout unless timeout.nil? @@ -281,7 +281,15 @@ class Console::CommandDispatcher::Automotive end return end - unless stop + if stop + if self.tpjobs[stopid] + self.tpjobs[stopid].kill + self.tpjobs[stopid] = nil + print_status("Stopped TesterPresent #{stopid}") + else + print_error("TesterPresent #{stopid} was not running") + end + else jid = self.tpjob_id print_status("Starting TesterPresent sender (#{self.tpjob_id})") self.tpjob_id += 1 @@ -300,14 +308,6 @@ class Console::CommandDispatcher::Automotive self.tpjobs[myjid] = nil print_status("TesterPreset #{myjid} has stopped (#{::Thread.current[:args].inspect})") end - else - if self.tpjobs[stopid] - self.tpjobs[stopid].kill - self.tpjobs[stopid] = nil - print_status("Stopped TesterPresent #{stopid}") - else - print_error("TesterPresent #{stopid} was not running") - end end end 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 c777f28080..b0c8a943b6 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb @@ -219,10 +219,10 @@ class Console::CommandDispatcher::Core print_status("Device: #{status['device_name']}") if status.key? 'device_name' print_status("FW Version: #{status['fw_version']}") if status.key? 'fw_version' print_status("HW Version: #{status['hw_version']}") if status.key? 'hw_version' - print_status("Uptime: #{stats["uptime"]} seconds") if stats.key? "uptime" - print_status("Packets Sent: #{stats["packet_stats"]}") if stats.key? "packet_stats" - print_status("Last packet Sent: #{Time.at(stats["last_request"])}") if stats.key? "last_request" - print_status("Voltage: #{stats["voltage"]}") if stats.key? "voltage" and not stats["voltage"] == "not supported" + print_status("Uptime: #{stats['uptime']} seconds") if stats.key? 'uptime' + print_status("Packets Sent: #{stats['packet_stats']}") if stats.key? 'packet_stats' + print_status("Last packet Sent: #{Time.at(stats['last_request'])}") if stats.key? 'last_request' + print_status("Voltage: #{stats['voltage']}") if stats.key? 'voltage' and not stats['voltage'] == 'not supported' end def cmd_specialty_help 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 e572070611..f2f3b4ec26 100644 --- a/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb +++ b/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb @@ -290,7 +290,7 @@ class Console::CommandDispatcher::RFtransceiver arg['blocksize'] = blocksize unless blocksize == -1 arg['timeout'] = timeout unless timeout == -1 r = client.rftransceiver.rfrecv(idx, arg) - if r.key?('data') && r.has_key?('timestamp') + if r.key?('data') && r.key?('timestamp') print_line(" #{r['timestamp']}: #{r['data'].inspect}") else print_line("Error")