Skip to content

Commit

Permalink
darwin: processes: add cdhash property
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Apr 4, 2024
1 parent 18f3866 commit ef8ff5f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/rpcclient/rpcclient/darwin/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

logger = logging.getLogger(__name__)

CDHASH_SIZE = 20
CHUNK_SIZE = 1024 * 64
APP_SUFFIX = '.app/'

Expand Down Expand Up @@ -732,6 +733,14 @@ def regions(self) -> List[Region]:

return result

@property
def cdhash(self) -> bytes:
with self._client.safe_malloc(CDHASH_SIZE) as cdhash:
# by reversing online-auth-agent
if 0 != self._client.symbols.csops(self.pid, 5, cdhash, CDHASH_SIZE):
raise BadReturnValueError(f'failed to get cdhash for {self.pid}')
return cdhash.peek(CDHASH_SIZE)

def get_process_symbol(self, address: int) -> ProcessSymbol:
return ProcessSymbol.create(address, self._client, self)

Expand Down

0 comments on commit ef8ff5f

Please sign in to comment.