From 186d9c403cf569696bb787950ede7ff8ec356c95 Mon Sep 17 00:00:00 2001 From: Niklas Higi Date: Mon, 18 Jan 2021 16:01:35 +0100 Subject: [PATCH] Make logging of `disableCertificatePinning` function less verbose --- src/tasks/disable-certificate-pinning.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tasks/disable-certificate-pinning.ts b/src/tasks/disable-certificate-pinning.ts index c4342cf..043651a 100644 --- a/src/tasks/disable-certificate-pinning.ts +++ b/src/tasks/disable-certificate-pinning.ts @@ -41,8 +41,6 @@ export default async function disableCertificatePinning( task: ListrTaskWrapper, ) { return observeAsync(async next => { - next('Finding smali files...') - // Convert Windows path (using backslashes) to POSIX path (using slashes) const directoryPathPosix = directoryPath .split(path.sep) @@ -51,12 +49,11 @@ export default async function disableCertificatePinning( let pinningFound = false + next('Scanning Smali files...') for await (const filePathChunk of globby.stream(globPattern)) { // Required because Node.js streams are not typed as generics const filePath = filePathChunk as string - next(`Scanning ${path.basename(filePath)}...`) - let originalContent = await fs.readFile(filePath, 'utf-8') // Don't scan classes that don't implement the interface @@ -104,6 +101,9 @@ export default async function disableCertificatePinning( if (originalContent !== patchedContent) { pinningFound = true + const relativePath = path.relative(directoryPath, filePath) + next(`Applied patch in "${relativePath}".`) + if (os.type() === 'Windows_NT') { // Replace LF with CRLF again patchedContent = patchedContent.replace(/\n/g, '\r\n')