tools/apkembed.rb
def scrapeFilesForLauncherActivity()
	smali_files||=[]
	Dir.glob('output/original/smali*/**/*.smali') do |file|
	  checkFile=File.read(file)
	  if (checkFile.include?";->onCreate(Landroid/os/Bundle;)V")
		smali_files << file
		smalifile = file
		activitysmali = checkFile
	  end
	end
	i=0
	print "[*] Please choose from one of the following:\n"
	smali_files.each{|s_file|
		print "[+] Hook point ",i,": ",s_file,"\n"
		i+=1
	}
	hook=-1
	while (hook < 0 || hook>i)
		print "\nHook: "
		hook = STDIN.gets.chomp.to_i
	end
	i=0
	smalifile=""
	activitysmali=""
	smali_files.each{|s_file|
		if (i==hook)
			checkFile=File.read(s_file)
			smalifile=s_file
			activitysmali = checkFile
			break
		end
		i+=1
	}
	return [smalifile,activitysmali]
end
# If XML parsing of the manifest fails, recursively search
# the smali code for the onCreate() hook and let the user
# pick the injection point

If XML parsing of the manifest fails, recursively search
the smali code for the onCreate() hook and let the user
pick the injection point
If XML parsing of the manifest fails recursively search the smali code for the onCreate () hook and let the user pick the injection point
def scrapeFilesForLauncherActivity()
	smali_files||=[]
	Dir.glob('output/original/smali*/**/*.smali') do |file|
	  checkFile=File.read(file)
	  if (checkFile.include?";->onCreate(Landroid/os/Bundle;)V")
		smali_files << file
		smalifile = file
		activitysmali = checkFile
	  end
	end
	i=0
	print "[*] Please choose from one of the following:\n"
	smali_files.each{|s_file|
		print "[+] Hook point ",i,": ",s_file,"\n"
		i+=1
	}
	hook=-1
	while (hook < 0 || hook>i)
		print "\nHook: "
		hook = STDIN.gets.chomp.to_i
	end
	i=0
	smalifile=""
	activitysmali=""
	smali_files.each{|s_file|
		if (i==hook)
			checkFile=File.read(s_file)
			smalifile=s_file
			activitysmali = checkFile
			break
		end
		i+=1
	}
	return [smalifile,activitysmali]
end
def scrapeFilesForLauncherActivity ( ) smali_files ||= [ ] Dir . glob ( 'output/original/smali*/**/*.smali' ) do | file | checkFile = File . read ( file ) if ( checkFile . include? ";->onCreate(Landroid/os/Bundle;)V" ) smali_files << file smalifile = file activitysmali = checkFile end end i = 0 print "[*] Please choose from one of the following:\n" smali_files . each { | s_file | print "[+] Hook point " , i , ": " , s_file , "\n" i += 1 } hook = - 1 while ( hook < 0 || hook > i ) print "\nHook: " hook = STDIN . gets . chomp . to_i end i = 0 smalifile = "" activitysmali = "" smali_files . each { | s_file | if ( i == hook ) checkFile = File . read ( s_file ) smalifile = s_file activitysmali = checkFile break end i += 1 } return [ smalifile , activitysmali ] end
If XML parsing of the manifest fails, recursively search
the smali code for the onCreate() hook and let the user
pick the injection point
If XML parsing of the manifest fails recursively search the smali code for the onCreate () hook and let the user pick the injection point