Skip to content

Commit 498bc20

Browse files
authored
Merge pull request rapid7#20094 from bcoles/rubocop-modules-post-hardware
modules/post/hardware: Resolve RuboCop violations
2 parents ac9669d + 7ebe8f2 commit 498bc20

File tree

12 files changed

+91
-35
lines changed

12 files changed

+91
-35
lines changed

modules/post/hardware/automotive/can_flood.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ def initialize(info = {})
1616
'Author' => 'Pietro Biondi',
1717
'License' => MSF_LICENSE,
1818
'Platform' => 'hardware',
19-
'SessionTypes' => ['hwbridge']
19+
'SessionTypes' => ['hwbridge'],
20+
'Notes' => {
21+
'Stability' => [CRASH_SERVICE_DOWN],
22+
'SideEffects' => [PHYSICAL_EFFECTS],
23+
'Reliability' => []
24+
}
2025
)
2126
)
2227

modules/post/hardware/automotive/canprobe.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ def initialize(info = {})
1919
'License' => MSF_LICENSE,
2020
'Author' => ['Craig Smith'],
2121
'Platform' => ['hardware'],
22-
'SessionTypes' => ['hwbridge']
22+
'SessionTypes' => ['hwbridge'],
23+
'Notes' => {
24+
'Stability' => [CRASH_SERVICE_DOWN],
25+
'SideEffects' => [PHYSICAL_EFFECTS],
26+
'Reliability' => []
27+
}
2328
)
2429
)
2530
register_options([

modules/post/hardware/automotive/diagnostic_state.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(info = {})
99
update_info(
1010
info,
1111
'Name' => 'Diagnostic State',
12-
'Description' => ' This module will keep the vehicle in a diagnostic state on rounds by sending tester present packet',
12+
'Description' => 'This module will keep the vehicle in a diagnostic state on rounds by sending tester present packet.',
1313
'License' => MSF_LICENSE,
1414
'Author' => ['Jay Turla'],
1515
'Platform' => ['hardware'],

modules/post/hardware/automotive/ecu_hard_reset.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(info = {})
99
update_info(
1010
info,
1111
'Name' => 'ECU Hard Reset',
12-
'Description' => ' This module performs hard reset in the ECU Reset Service Identifier (0x11)',
12+
'Description' => 'This module performs hard reset in the ECU Reset Service Identifier (0x11).',
1313
'License' => MSF_LICENSE,
1414
'Author' => ['Jay Turla'],
1515
'Platform' => ['hardware'],

modules/post/hardware/automotive/getvinfo.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ def initialize(info = {})
1313
info,
1414
'Name' => 'Get the Vehicle Information Such as the VIN from the Target Module',
1515
'Description' => %q{
16-
Post Module to query DTCs, Some common engine info and Vehicle Info.
17-
It returns such things as engine speed, coolant temp, Diagnostic
18-
Trouble Codes as well as All info stored by Mode $09 Vehicle Info, VIN, etc
16+
This module queries DTCs, some common engine info, and vehicle information.
17+
18+
It returns such things as engine speed, coolant temp, Diagnostic Trouble
19+
Codes, as well as all info stored by Mode $09 Vehicle Info, VIN, etc.
1920
},
2021
'License' => MSF_LICENSE,
2122
'Author' => ['Craig Smith'],
2223
'Platform' => ['hardware'],
23-
'SessionTypes' => ['hwbridge']
24+
'SessionTypes' => ['hwbridge'],
25+
'Notes' => {
26+
'Stability' => [CRASH_SAFE],
27+
'SideEffects' => [],
28+
'Reliability' => []
29+
}
2430
)
2531
)
2632
register_options([

modules/post/hardware/automotive/identifymodules.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ def initialize(info = {})
1111
update_info(
1212
info,
1313
'Name' => 'Scan CAN Bus for Diagnostic Modules',
14-
'Description' => %q{ Post Module to scan the CAN bus for any modules that can respond to UDS DSC queries},
14+
'Description' => %q{Scan the CAN bus for any modules that can respond to UDS DSC queries.},
1515
'License' => MSF_LICENSE,
1616
'Author' => ['Craig Smith'],
1717
'Platform' => ['hardware'],
18-
'SessionTypes' => ['hwbridge']
18+
'SessionTypes' => ['hwbridge'],
19+
'Notes' => {
20+
'Stability' => [CRASH_SAFE],
21+
'SideEffects' => [],
22+
'Reliability' => []
23+
}
1924
)
2025
)
2126
register_options([

modules/post/hardware/automotive/malibu_overheat.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ def initialize(info = {})
1010
update_info(
1111
info,
1212
'Name' => 'Sample Module to Flood Temp Gauge on 2006 Malibu',
13-
'Description' => %q{ Simple sample temp flood for the 2006 Malibu},
13+
'Description' => %q{Simple sample temp flood for the 2006 Malibu.},
1414
'License' => MSF_LICENSE,
1515
'Author' => ['Craig Smith'],
1616
'Platform' => ['hardware'],
17-
'SessionTypes' => ['hwbridge']
17+
'SessionTypes' => ['hwbridge'],
18+
'Notes' => {
19+
'Stability' => [SERVICE_RESOURCE_LOSS],
20+
'SideEffects' => [SCREEN_EFFECTS],
21+
'Reliability' => []
22+
}
1823
)
1924
)
2025
register_options([

modules/post/hardware/automotive/mazda_ic_mover.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ def initialize(info = {})
1010
update_info(
1111
info,
1212
'Name' => 'Mazda 2 Instrument Cluster Accelorometer Mover',
13-
'Description' => %q{ This module moves the needle of the accelorometer and speedometer of the Mazda 2 instrument cluster},
13+
'Description' => %q{This module moves the needle of the accelorometer and speedometer of the Mazda 2 instrument cluster.},
1414
'License' => MSF_LICENSE,
1515
'Author' => ['Jay Turla'],
1616
'Platform' => ['hardware'],
17-
'SessionTypes' => ['hwbridge']
17+
'SessionTypes' => ['hwbridge'],
18+
'Notes' => {
19+
'Stability' => [SERVICE_RESOURCE_LOSS],
20+
'SideEffects' => [SCREEN_EFFECTS],
21+
'Reliability' => []
22+
}
1823
)
1924
)
2025
register_options([

modules/post/hardware/automotive/pdt.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ def initialize(info = {})
3434
[ 'URL', 'https://www.researchgate.net/publication/321183727_Security_Evaluation_of_an_Airbag-ECU_by_Reusing_Threat_Modeling_Artefacts' ]
3535
],
3636
'Platform' => ['hardware'],
37-
'SessionTypes' => ['hwbridge']
37+
'SessionTypes' => ['hwbridge'],
38+
'Notes' => {
39+
'Stability' => [CRASH_SAFE],
40+
'SideEffects' => [PHYSICAL_EFFECTS],
41+
'Reliability' => []
42+
}
3843
)
3944
)
4045
register_options([

modules/post/hardware/rftransceiver/rfpwnon.rb

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ def initialize(info = {})
1414
'Description' => %q{
1515
Post Module for HWBridge RFTranscievers. Brute forces AM OOK or raw
1616
binary signals. This is a port of the rfpwnon tool by Corey Harding.
17-
(https://github.com/exploitagency/github-rfpwnon/blob/master/rfpwnon.py)
1817
},
1918
'License' => MSF_LICENSE,
20-
'Author' => ['Craig Smith'],
19+
'Author' => [
20+
'Corey Harding', # rfpwnon
21+
'Craig Smith', # metasploit
22+
],
23+
'References' => [
24+
['URL', 'https://github.com/exploitagency/github-rfpwnon/blob/master/rfpwnon.py'],
25+
],
2126
'Platform' => ['hardware'],
22-
'SessionTypes' => ['hwbridge']
27+
'SessionTypes' => ['hwbridge'],
28+
'Notes' => {
29+
'Stability' => [CRASH_SAFE],
30+
'SideEffects' => [PHYSICAL_EFFECTS],
31+
'Reliability' => []
32+
}
2333
)
2434
)
2535
register_options([
@@ -40,7 +50,7 @@ def initialize(info = {})
4050
@brutechar = '01'
4151
end
4252

43-
# @param key [String] binary/trinary represntation
53+
# @param key [String] binary/trinary representation
4454
# @return [Array] ByteArray
4555
def convert_ook(key)
4656
pwm_str_key = ''
@@ -59,6 +69,7 @@ def convert_ook(key)
5969
return pwm_str_key.scan(/.{1,8}/).collect { |x| x.to_i(2).chr }
6070
end
6171

72+
# rubocop:disable Naming/MethodParameterName
6273
def debruijn_bytes(k, n)
6374
@a = [0]
6475
@sequence = []
@@ -80,16 +91,16 @@ def debruijn(t, p, k, n)
8091
end
8192
end
8293
end
94+
# rubocop:enable Naming/MethodParameterName
8395

8496
def run
85-
unless is_rf?
86-
print_error('Not an RF Transceiver')
87-
return
88-
end
97+
fail_with(Failure::BadConfig, 'Not an RF Transceiver') unless is_rf?
98+
8999
unless set_index(datastore['INDEX'])
90-
print_error("Couldn't set usb index to #{datastore['INDEX']}")
100+
print_error("Couldn't set USB index to #{datastore['INDEX']}")
91101
return
92102
end
103+
93104
if datastore['TRI']
94105
@zeropwm = '10001000'
95106
@onepwm = '11101110'
@@ -115,7 +126,6 @@ def run
115126

116127
startn = 0
117128
endy = 512
118-
brutepackettmp = ''
119129
addr = 512
120130
if datastore['TRI']
121131
endy = 128
@@ -125,6 +135,7 @@ def run
125135
endy = datastore['BINLENGTH']
126136
addr = 1
127137
end
138+
128139
# Transmit
129140
while startn < brutepacket.length
130141
(0..datastore['REPEAT'] - 1).each do |_i|
@@ -156,6 +167,7 @@ def run
156167
endy = endy + addr - datastore['BINLENGTH']
157168
end
158169
end
170+
159171
print_status('Done')
160172
set_mode('IDLE')
161173
end

0 commit comments

Comments
 (0)