Skip to content

Commit a513f40

Browse files
committed
fixing bugs
1 parent ead7b35 commit a513f40

File tree

3 files changed

+66
-66
lines changed

3 files changed

+66
-66
lines changed

lib/msf/base/sessions/meterpreter_java.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def initialize(rstream, opts={})
2222
self.platform = 'java/java'
2323
self.binary_suffix = 'jar'
2424
end
25-
def load_android()
25+
def load_android
2626
self.platform = 'java/android'
2727
console.disable_output = true
2828
console.run_single('load android')

lib/rex/post/meterpreter/extensions/android/tlv.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ module Android
3333

3434
TLV_TYPE_SHUTDOWN_TIMER = TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 9020)
3535

36-
end;
37-
end;
38-
end;
39-
end;
36+
end
37+
end
38+
end
39+
end
4040
end

lib/rex/post/meterpreter/ui/console/command_dispatcher/android.rb

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ def cmd_device_shutdown(*args)
5454
device_shutdown_opts = Rex::Parser::Arguments.new(
5555
'-h' => [ false, 'Help Banner' ],
5656
'-t' => [ false, 'Shutdown after n seconds']
57-
)
57+
)
5858

59-
device_shutdown_opts.parse( args ) { | opt, idx, val |
59+
device_shutdown_opts.parse(args) { | opt, idx, val |
6060
case opt
6161
when '-h'
62-
print_line('Usage: device_shutdown [options]\n' )
63-
print_line('Shutdown device.' )
64-
print_line( device_shutdown_opts.usage )
62+
print_line('Usage: device_shutdown [options]\n')
63+
print_line('Shutdown device.')
64+
print_line(device_shutdown_opts.usage)
6565
return
6666
when '-t'
6767
seconds = val.to_i
@@ -83,14 +83,14 @@ def cmd_dump_sms(*args)
8383
dump_sms_opts = Rex::Parser::Arguments.new(
8484
'-h' => [ false, 'Help Banner' ],
8585
'-o' => [ false, 'Output path for sms list']
86-
)
86+
)
8787

88-
dump_sms_opts.parse( args ) { | opt, idx, val |
88+
dump_sms_opts.parse(args) { | opt, idx, val |
8989
case opt
9090
when '-h'
91-
print_line('Usage: dump_sms [options]\n' )
92-
print_line('Get sms messages.' )
93-
print_line( dump_sms_opts.usage )
91+
print_line('Usage: dump_sms [options]\n')
92+
print_line('Get sms messages.')
93+
print_line(dump_sms_opts.usage)
9494
return
9595
when '-o'
9696
path = val
@@ -105,7 +105,7 @@ def cmd_dump_sms(*args)
105105
begin
106106
info = client.sys.config.sysinfo
107107

108-
::File.open( path, 'wb' ) do |fd|
108+
::File.open(path, 'wb') do |fd|
109109

110110
fd.write('\n=====================\n')
111111
fd.write('[+] Sms messages dump\n')
@@ -149,24 +149,24 @@ def cmd_dump_sms(*args)
149149
time = Time.at(time)
150150

151151
fd.write("Date\t: #{time.strftime('%Y-%m-%d %H:%M:%S')}\n")
152-
fd.write('Address\t: #{a['address']}\n')
152+
fd.write("Address\t: #{a['address']}\n")
153153
fd.write('Status\t: #{status}\n')
154-
fd.write('Message\t: #{a['body']}\n\n')
154+
fd.write("Message\t: #{a['body']}\n\n")
155155
}
156156
end
157157

158-
path = ::File.expand_path( path )
158+
path = ::File.expand_path(path)
159159

160-
print_status('Sms #{smsList.count == 1? 'message': 'messages'} saved to: #{path}' )
161-
Rex::Compat.open_file( path )
160+
print_status("Sms #{smsList.count == 1? 'message': 'messages'} saved to: #{path}")
161+
Rex::Compat.open_file(path)
162162

163163
return true
164164
rescue
165165
print_error('Error getting messages')
166166
return false
167167
end
168168
else
169-
print_status('No sms messages were found!' )
169+
print_status('No sms messages were found!')
170170
return false
171171
end
172172
end
@@ -180,14 +180,14 @@ def cmd_dump_contacts(*args)
180180
'-h' => [ false, 'Help Banner' ],
181181
'-o' => [ false, 'Output path for contacts list']
182182

183-
)
183+
)
184184

185-
dump_contacts_opts.parse( args ) { | opt, idx, val |
185+
dump_contacts_opts.parse(args) { | opt, idx, val |
186186
case opt
187187
when '-h'
188-
print_line('Usage: dump_contacts [options]\n' )
189-
print_line('Get contacts list.' )
190-
print_line( dump_contacts_opts.usage )
188+
print_line('Usage: dump_contacts [options]\n')
189+
print_line('Get contacts list.')
190+
print_line(dump_contacts_opts.usage)
191191
return
192192
when '-o'
193193
path = val
@@ -198,26 +198,26 @@ def cmd_dump_contacts(*args)
198198
contactList = client.android.dump_contacts
199199

200200
if contactList.count > 0
201-
print_status('Fetching #{contactList.count} #{contactList.count == 1? 'contact': 'contacts'} into list' )
201+
print_status("Fetching #{contactList.count} #{contactList.count == 1? 'contact': 'contacts'} into list")
202202
begin
203203
info = client.sys.config.sysinfo
204204

205-
::File.open( path, 'wb' ) do |fd|
205+
::File.open(path, 'wb') do |fd|
206206

207207
fd.write('\n======================\n')
208208
fd.write('[+] Contacts list dump\n')
209209
fd.write('======================\n\n')
210210

211211
time = Time.new
212212
fd.write('Date: #{time.inspect}\n')
213-
fd.write('OS: #{info['OS']}\n')
213+
fd.write("OS: #{info['OS']}\n")
214214
fd.write('Remote IP: #{client.sock.peerhost}\n')
215215
fd.write('Remote Port: #{client.sock.peerport}\n\n')
216216

217217
contactList.each_with_index { |c, index|
218218

219219
fd.write('##{(index.to_i + 1).to_s()}\n')
220-
fd.write('Name\t: #{c['name']}\n')
220+
fd.write("Name\t: #{c['name']}\n")
221221

222222
if c['number'].count > 0
223223
(c['number']).each { |n|
@@ -235,17 +235,17 @@ def cmd_dump_contacts(*args)
235235
}
236236
end
237237

238-
path = ::File.expand_path( path )
239-
print_status('Contacts list saved to: #{path}' )
240-
Rex::Compat.open_file( path )
238+
path = ::File.expand_path(path)
239+
print_status('Contacts list saved to: #{path}')
240+
Rex::Compat.open_file(path)
241241

242242
return true
243243
rescue
244244
print_error('Error getting contacts list')
245245
return false
246246
end
247247
else
248-
print_status('No contacts were found!' )
248+
print_status('No contacts were found!')
249249
return false
250250
end
251251
end
@@ -258,14 +258,14 @@ def cmd_geolocate(*args)
258258
'-h' => [ false, 'Help Banner' ],
259259
'-g' => [ false, 'Generate map using google-maps']
260260

261-
)
261+
)
262262

263-
geolocate_opts.parse( args ) { | opt, idx, val |
263+
geolocate_opts.parse(args) { | opt, idx, val |
264264
case opt
265265
when '-h'
266-
print_line('Usage: geolocate [options]\n' )
267-
print_line('Get current location using geolocation.' )
268-
print_line( geolocate_opts.usage )
266+
print_line('Usage: geolocate [options]\n')
267+
print_line('Get current location using geolocation.')
268+
print_line(geolocate_opts.usage)
269269
return
270270
when '-g'
271271
generate_map = true
@@ -275,13 +275,13 @@ def cmd_geolocate(*args)
275275
geo = client.android.geolocate
276276

277277
print_status('Current Location:\n')
278-
print_line('\tLatitude : #{geo[0]['lat']}')
279-
print_line('\tLongitude : #{geo[0]['long']}\n')
280-
print_line('To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{geo[0]['lat']},#{geo[0]['long']}&sensor=true\n')
278+
print_line("\tLatitude : #{geo[0]['lat']}")
279+
print_line("\tLongitude : #{geo[0]['long']}\n")
280+
print_line("To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{geo[0]['lat']},#{geo[0]['long']}&sensor=true\n")
281281

282282

283283
if generate_map
284-
link = 'https://maps.google.com/maps?q=#{geo[0]['lat']},#{geo[0]['long']}'
284+
link = "https://maps.google.com/maps?q=#{geo[0]['lat']},#{geo[0]['long']}"
285285
print_status('Generated map on google-maps:')
286286
print_status('#{link}')
287287
Rex::Compat.open_browser(link)
@@ -297,14 +297,14 @@ def cmd_dump_calllog(*args)
297297
'-h' => [ false, 'Help Banner' ],
298298
'-o' => [ false, 'Output path for call log']
299299

300-
)
300+
)
301301

302-
dump_calllog_opts.parse( args ) { | opt, idx, val |
302+
dump_calllog_opts.parse(args) { | opt, idx, val |
303303
case opt
304304
when '-h'
305-
print_line('Usage: dump_calllog [options]\n' )
306-
print_line('Get call log.' )
307-
print_line( dump_calllog_opts.usage )
305+
print_line('Usage: dump_calllog [options]\n')
306+
print_line('Get call log.')
307+
print_line(dump_calllog_opts.usage)
308308
return
309309
when '-o'
310310
path = val
@@ -314,45 +314,45 @@ def cmd_dump_calllog(*args)
314314
log = client.android.dump_calllog
315315

316316
if log.count > 0
317-
print_status('Fetching #{log.count} #{log.count == 1? 'entry': 'entries'}' )
317+
print_status("Fetching #{log.count} #{log.count == 1? 'entry': 'entries'}")
318318
begin
319319
info = client.sys.config.sysinfo
320320

321-
::File.open( path, 'wb' ) do |fd|
321+
::File.open(path, 'wb') do |fd|
322322

323323
fd.write('\n=================\n')
324324
fd.write('[+] Call log dump\n')
325325
fd.write('=================\n\n')
326326

327327
time = Time.new
328328
fd.write('Date: #{time.inspect}\n')
329-
fd.write('OS: #{info['OS']}\n')
329+
fd.write("OS: #{info['OS']}\n")
330330
fd.write('Remote IP: #{client.sock.peerhost}\n')
331331
fd.write('Remote Port: #{client.sock.peerport}\n\n')
332332

333333
log.each_with_index { |a, index|
334334

335335
fd.write('##{(index.to_i + 1).to_s()}\n')
336336

337-
fd.write('Number\t: #{a['number']}\n')
338-
fd.write('Name\t: #{a['name']}\n')
339-
fd.write('Date\t: #{a['date']}\n')
340-
fd.write('Type\t: #{a['type']}\n')
341-
fd.write('Duration: #{a['duration']}\n\n')
337+
fd.write("Number\t: #{a['number']}\n")
338+
fd.write("Name\t: #{a['name']}\n")
339+
fd.write("Date\t: #{a['date']}\n")
340+
fd.write("Type\t: #{a['type']}\n")
341+
fd.write("Duration: #{a['duration']}\n\n")
342342
}
343343
end
344344

345-
path = ::File.expand_path( path )
346-
print_status('Call log saved to: #{path}' )
347-
Rex::Compat.open_file( path )
345+
path = ::File.expand_path(path)
346+
print_status('Call log saved to: #{path}')
347+
Rex::Compat.open_file(path)
348348

349349
return true
350350
rescue
351351
print_error('Error getting call log')
352352
return false
353353
end
354354
else
355-
print_status('No call log entries were found!' )
355+
print_status('No call log entries were found!')
356356
return false
357357
end
358358
end
@@ -362,14 +362,14 @@ def cmd_check_root(*args)
362362

363363
check_root_opts = Rex::Parser::Arguments.new(
364364
'-h' => [ false, 'Help Banner' ]
365-
)
365+
)
366366

367-
check_root_opts.parse( args ) { | opt, idx, val |
367+
check_root_opts.parse(args) { | opt, idx, val |
368368
case opt
369369
when '-h'
370-
print_line('Usage: check_root [options]\n' )
371-
print_line('Check if device is rooted.' )
372-
print_line( check_root_opts.usage )
370+
print_line('Usage: check_root [options]\n')
371+
print_line('Check if device is rooted.')
372+
print_line(check_root_opts.usage)
373373
return
374374
end
375375
}

0 commit comments

Comments
 (0)