Skip to content

Commit

Permalink
(fix) Android --uid flag fix. Fix frida-fs types.
Browse files Browse the repository at this point in the history
  • Loading branch information
IPMegladon committed Sep 9, 2024
1 parent a85a068 commit 77bc2fa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions agent/src/ios/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const info = (): IBinaryModuleDictionary => {

const imports: Set<string> = new Set(a.enumerateImports().map((i) => i.name));
const fb = iosfilesystem.readFile(a.path);
if (typeof(fb) == 'string') {
return;
}

try {
const exe = macho.parse(fb);
Expand Down
2 changes: 1 addition & 1 deletion agent/src/rpc/ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const ios = {
// ios filesystem
iosFileCwd: (): string => iosfilesystem.pwd(),
iosFileDelete: (path: string): boolean => iosfilesystem.deleteFile(path),
iosFileDownload: (path: string): Buffer => iosfilesystem.readFile(path),
iosFileDownload: (path: string): string | Buffer => iosfilesystem.readFile(path),
iosFileExists: (path: string): boolean => iosfilesystem.exists(path),
iosFileLs: (path: string): IIosFileSystem => iosfilesystem.ls(path),
iosFilePathIsFile: (path: string): boolean => iosfilesystem.pathIsFile(path),
Expand Down
5 changes: 4 additions & 1 deletion objection/utils/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def set_target_pid(self):

elif self.config.spawn:
if self.config.uid is not None:
if self.device.query_system_parameters()['os']['id'] != 'android':
raise Exception('--uid flag can only be used on Android.')
self.pid = self.device.spawn(self.config.name, uid=int(self.config.uid))
else:
self.pid = self.device.spawn(self.config.name)
Expand Down Expand Up @@ -245,9 +247,10 @@ def attach(self):
raise Exception('A PID needs to be set before attach()')

if self.config.uid is None:
debug_print(f'Attaching to PID: {self.pid}')
self.session = self.device.attach(self.pid)
else:
self.session = self.device.attach(self.pid, uid=self.config.uid)
self.session = self.device.attach(self.pid)

self.session.on('detached', self.handlers.session_on_detached)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ requests
Flask>=3.0.0
Pygments>=2.0.0
litecli>=1.3.0
setuptools>=70.0.0

0 comments on commit 77bc2fa

Please sign in to comment.