From d9c989d2dafca9cd229f7de24bd3fb28e8717d53 Mon Sep 17 00:00:00 2001 From: Leon Jacobs Date: Fri, 7 Jun 2024 08:32:37 +0200 Subject: [PATCH] (fix) move to macho-ts and frida-screenshot ts --- agent/package-lock.json | 55 ++++++++++++++++------------------ agent/package.json | 3 +- agent/src/ios/binary.ts | 4 +-- agent/src/ios/userinterface.ts | 10 +++---- agent/src/rpc/ios.ts | 6 ++-- 5 files changed, 38 insertions(+), 40 deletions(-) diff --git a/agent/package-lock.json b/agent/package-lock.json index 9c92e04..e729702 100644 --- a/agent/package-lock.json +++ b/agent/package-lock.json @@ -12,7 +12,7 @@ "frida-java-bridge": "^6", "frida-objc-bridge": "^7", "frida-screenshot": "^5", - "macho": "^1" + "macho-ts": "^0.1.0" }, "devDependencies": { "@types/frida-gum": "^18", @@ -22,12 +22,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", - "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.24.2", + "@babel/highlight": "^7.24.7", "picocolors": "^1.0.0" }, "engines": { @@ -35,21 +35,21 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", - "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", - "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.24.5", + "@babel/helper-validator-identifier": "^7.24.7", "chalk": "^2.4.2", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" @@ -374,9 +374,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.33", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.33.tgz", - "integrity": "sha512-NR9+KrpSajr2qBVp/Yt5TU/rp+b5Mayi3+OlMlcg2cVCfRmcG5PWZ7S4+MG9PZ5gWBoc9Pd0BKSRViuBCRPu0A==", + "version": "18.19.34", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.34.tgz", + "integrity": "sha512-eXF4pfBNV5DAMKGbI02NnDtWrQ40hAN558/2vvS4gMpMIxaf6JmD7YjnZbq0Q9TDSSkKBamime8ewRoomHdt4g==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -519,11 +519,6 @@ "node": ">=0.3.1" } }, - "node_modules/endian-reader": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/endian-reader/-/endian-reader-0.1.0.tgz", - "integrity": "sha512-5e4iguVyduiJiqb+EFF7fJ2HBx38WQjlILgOOReIO73vCuZ4EwSwp7HmEzbL4jN8BdKAnH67eoeEF0JC5DUjow==" - }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -630,6 +625,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -749,12 +745,13 @@ "node": "*" } }, - "node_modules/macho": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/macho/-/macho-1.5.0.tgz", - "integrity": "sha512-OQIH52wxSFeK7rFGoTnyNdcfWAYTTTBcT9IRWjxutOdj+opRk9dLR1mO0ifZKlPvCf/xWbCRK7Wk87nnrAEQ0w==", - "dependencies": { - "endian-reader": "^0.1.0" + "node_modules/macho-ts": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/macho-ts/-/macho-ts-0.1.0.tgz", + "integrity": "sha512-PuG4ng7EEDL139C56nl3OnYWQH5K92HhzaSkpSEz7M/iXwuru//tHnRiya2V0bsG69O55FhjtXbiFf51ronPyQ==", + "engines": { + "node": ">=16", + "npm": ">=7" } }, "node_modules/minimatch": { @@ -848,9 +845,9 @@ } }, "node_modules/rxjs/node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true, "optional": true }, diff --git a/agent/package.json b/agent/package.json index e692d06..11afc9f 100644 --- a/agent/package.json +++ b/agent/package.json @@ -3,6 +3,7 @@ "version": "0.0.0", "description": "Runtime Mobile Exploration", "private": true, + "type": "module", "main": "src/index.ts", "scripts": { "prepare": "npm run build", @@ -31,7 +32,7 @@ "frida-java-bridge": "^6", "frida-objc-bridge": "^7", "frida-screenshot": "^5", - "macho": "^1" + "macho-ts": "^0.1.0" }, "devDependencies": { "@types/frida-gum": "^18", diff --git a/agent/src/ios/binary.ts b/agent/src/ios/binary.ts index 39a2623..4939754 100644 --- a/agent/src/ios/binary.ts +++ b/agent/src/ios/binary.ts @@ -1,5 +1,5 @@ -// tslint:disable-next-line:no-var-requires -const macho = require("macho"); +import macho from "macho-ts"; + import * as iosfilesystem from "./filesystem.js"; import { IBinaryModuleDictionary } from "./lib/interfaces.js"; diff --git a/agent/src/ios/userinterface.ts b/agent/src/ios/userinterface.ts index ee3b032..a0929fc 100644 --- a/agent/src/ios/userinterface.ts +++ b/agent/src/ios/userinterface.ts @@ -1,14 +1,14 @@ // tslint:disable-next-line:no-var-requires -const sc = require("frida-screenshot"); +import screenshot from "frida-screenshot"; import { colors as c } from "../lib/color.js"; import { IJob } from "../lib/interfaces.js"; import * as jobs from "../lib/jobs.js"; -export const screenshot = (): any => { +export const take = (): any => { // heavy lifting thanks to frida-screenshot! // https://github.com/nowsecure/frida-screenshot - return sc(); + return screenshot(null); }; export const dump = (): string => { @@ -131,7 +131,7 @@ export const biometricsBypass = (): void => { if (policyJob.invocations) { policyJob.invocations.push(lacontext1); } else { - policyJob.invocations = [ lacontext1 ]; + policyJob.invocations = [lacontext1]; } jobs.add(policyJob); @@ -193,7 +193,7 @@ export const biometricsBypass = (): void => { if (accessControlJob.invocations) { accessControlJob.invocations.push(lacontext2); } else { - accessControlJob.invocations = [ lacontext2 ]; + accessControlJob.invocations = [lacontext2]; } jobs.add(accessControlJob); }; diff --git a/agent/src/rpc/ios.ts b/agent/src/rpc/ios.ts index cb5b491..47a8eb8 100644 --- a/agent/src/rpc/ios.ts +++ b/agent/src/rpc/ios.ts @@ -80,7 +80,7 @@ export const ios = { // ios user interface iosUiAlert: (message: string): void => userinterface.alert(message), iosUiBiometricsBypass: (): void => userinterface.biometricsBypass(), - iosUiScreenshot: (): any => userinterface.screenshot(), + iosUiScreenshot: (): any => userinterface.take(), iosUiWindowDump: (): string => userinterface.dump(), // ios ssl pinning @@ -97,8 +97,8 @@ export const ios = { iosKeychainAdd: (account: string, service: string, data: string): boolean => ioskeychain.add(account, service, data), iosKeychainRemove: (account: string, service: string): void => ioskeychain.remove(account, service), - iosKeychainUpdate: (account: string, service: string, newData: string): void => - ioskeychain.update(account, service, newData), + iosKeychainUpdate: (account: string, service: string, newData: string): void => + ioskeychain.update(account, service, newData), iosKeychainEmpty: (): void => ioskeychain.empty(), iosKeychainList: (smartDecode: boolean = false): IKeychainItem[] => ioskeychain.list(smartDecode), iosKeychainListRaw: (): void => ioskeychain.listRaw(),