Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nowsecure/frida-remote-stream
Create an outbound stream over a message transport.
https://github.com/nowsecure/frida-remote-stream
Last synced: 3 months ago
JSON representation
Create an outbound stream over a message transport.
- Host: GitHub
- URL: https://github.com/nowsecure/frida-remote-stream
- Owner: nowsecure
- License: mit
- Created: 2016-06-07T13:48:35.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-01-22T21:26:18.000Z (10 months ago)
- Last Synced: 2024-04-23T17:52:29.069Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 17
- Watchers: 8
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-frida - frida-remote-stream - Create an outbound stream over a message transport. (Libraries)
README
# frida-remote-stream
Create an outbound stream over a message transport.
## Example
### Read from agent, write to host
In your agent.js:
```js
const fs = require('frida-fs');
const RemoteStreamController = require('frida-remote-stream');const controller = new RemoteStreamController();
controller.events.on('send', packet => {
send({
name: '+stream',
payload: packet.stanza
}, packet.data);
});
function onStreamMessage(message, data) {
controller.receive({ stanza: message.payload, data });recv('+stream', onStreamMessage);
}
recv('+stream', onStreamMessage);fs.createReadStream('/very/large/file').pipe(controller.open('filedump', { meta: 'data' }));
```In your application:
```js
const fs = require('fs');
const RemoteStreamController = require('frida-remote-stream');const controller = new RemoteStreamController();
controller.events.on('send', packet => {
script.post({
type: '+stream',
payload: packet.stanza
}, packet.data);
});
script.message.connect((message, data) => {
if (message.type === 'send') {
const stanza = message.payload;
switch (stanza.name) {
case '+stream':
controller.receive({ stanza: stanza.payload, data });
break;
}
}
});controller.events.on('stream', stream => {
// stream.details.meta === 'data'stream.pipe(fs.createWriteStream('/tmp/interesting-file'));
});
```### Read from host, write to agent
In your agent.js:
```js
const fs = require('frida-fs');
const RemoteStreamController = require('frida-remote-stream');const streams = new RemoteStreamController();
streams.on('send', (stanza, data) => {
send({
name: '+stream',
payload: stanza
}, data ? data.buffer : null);
});
function onStreamMessage(message, data) {
streams.receive(message.payload, data ? new Buffer(data) : null);recv('+stream', onStreamMessage);
}
recv('+stream', onStreamMessage);streams.on('stream', stream => {
stream.pipe(fs.createWriteStream('/very/large/file'));
});
```In your application:
```js
const fs = require('fs');
const RemoteStreamController = require('frida-remote-stream');const streams = new RemoteStreamController();
streams.on('send', (stanza, data) => {
script.post({
type: '+stream',
payload: stanza
}, data);
});
script.events.listen('message', (message, data) => {
if (message.type === 'send') {
const stanza = message.payload;
switch (stanza.name) {
case '+stream':
streams.receive(stanza.payload, data);
break;
}
}
});fs.createReadStream('/tmp/interesting-file').pipe(streams.open('filedump', { meta: 'data' }));
```