Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed Jun 29, 2018
0 parents commit 8c882ab
Show file tree
Hide file tree
Showing 6 changed files with 3,606 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/_agent.js
/node_modules
32 changes: 32 additions & 0 deletions agent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { log } from "./logger";

rpc.exports = {
async init(stage: string, parameters: any) {
try {
log("[init]");

log("Let's see");
const socket = await Socket.connect({
family: "ipv4",
host: "127.0.0.1",
port: 1337
});
log("Connected");
await socket.output.writeAll(encode("Hello"));
log("Bye");
} catch (e) {
log("Oops: " + e.stack);
}
},
dispose() {
console.log("[dispose]");
}
};

type DuktapeBuffer = any;
declare const TextEncoder: any;
const encoder = new TextEncoder();

function encode(str: string): DuktapeBuffer {
return encoder.encode(str);
}
21 changes: 21 additions & 0 deletions agent/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

enum LogPriority {
Verbose = 2,
Debug = 3,
Info = 4,
Warn = 5,
Error = 6,
Fatal = 7
};

const androidLogWrite: any = new NativeFunction(
Module.findExportByName("liblog.so", "__android_log_write"),

This comment has been minimized.

Copy link
@poon776
"int",
["int", "pointer", "pointer"]);

const logTagBuf = Memory.allocUtf8String("frida");

export function log(message: string): void {
const messageBuf = Memory.allocUtf8String(message);
androidLogWrite(LogPriority.Info, logTagBuf, messageBuf);
}
Loading

1 comment on commit 8c882ab

@poon776
Copy link

@poon776 poon776 commented on 8c882ab Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.