Skip to content

Commit

Permalink
Honor :e hook options from traces coming from plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Apr 12, 2024
1 parent 397fcd5 commit d659052
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/agent/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,29 @@ export function traceEmit(msg: string) {
r2frida.logs = logs;
}

export function traceLog(msg: string) {
function objtrim(msg: any, field: string) : string {
try {
const obj = JSON.parse(msg);
delete obj[field];
msg = JSON.stringify(obj);
} catch (e) {
try {
delete msg[field];
} catch (e2) {
}
}
return msg;
}

export function traceLog(msg: any|string) {
if (!config.getBoolean('hook.time')) {
msg = objtrim(msg, 'ts');
}
if (!config.getBoolean('hook.backtrace')) {
msg = objtrim(msg, 'backtrace');
}
msg = objtrim(msg, 'scope');
msg = objtrim(msg, 'type');
if (config.getBoolean('hook.verbose')) {
send(wrapStanza('log', {
message: msg
Expand Down

0 comments on commit d659052

Please sign in to comment.