PH ACK
Ph! Ack! (written as ph-ack, PhAck, PH ACK, or any other way which highlights the break between ph and ack) is a really small package to debug process memory via Node.js.
Installation
Unfortunately, due to NPM's "typosquatting" prevention rules, ph-ack
currently cannot be published as an NPM package, so it at @glander/ph-ack
.
Just install it like any package, like
npm i @glander/ph-ack
or
yarn install @glander/ph-ack
Typescript declarations are bundled.
Usage
There is one exported function which should be really used: createPhAck
(takes 1 parameter - the PID (as a number)), which returns an instance of the PhAck
class.
Example
import { createPhAck } from "ph-ack"
const pa = await createPhAck(12345)
pa.freeze()
// Replace 12 with 24 at address 0x12345
if ((await pa.peekUint8(0x12345)) === 12) await pa.pokeUint8(0x12345, 24)
// Check if the int32 at address 0x678ab is endian-symmetric
if ((await pa.peekInt32(0x678ab)) === (await pa.peekInt32(0x678ab, true)))
console.log("The value is bit-symmetric!")
pa.unfreeze()
Documentation
createPhAck
Parameters:
-
pid
(number
) - The PID of the process to hack
Returns an instance of the PhAck
class.
PhAck
Methods
Method name | Parameters | Usage |
---|---|---|
peekUint8 peekUint16 peekUint32 peekUint64 and int alternatives |
- address (number ) - The address of the number to see- bigEndian (boolean ) - If to read the number in the Big Endian order or notReturns Promise<number> (Promise<bigint> for 64-bit numbers) |
Reads a number from the specified address. |
pokeUint8 pokeUint16 pokeUint32 pokeUint64 and int alternatives |
- address (number ) - The address of the number to write to- val (number (bigint for 64-bit numbers)) - The number to write to the process memory- bigEndian (boolean ) - If to write the number in the Big Endian order or notReturns Promise<void>
|
Writes a number to the specified address. |
freeze unfreeze
|
No parameters. Returns Promise<void>
|
Pauses and resumes processes, used when it is needed to read multiple related values. |