Closed trufae closed 8 months ago
Use this code in agent-side to grab strings from data buffers:
function isPrintable (ch) { return (ch >= 32 && ch <= 126); } function parseOptions (options) { const opts = { minLength: 15, disabled: false }; if (typeof options === 'object') { if (options.enabled === false) { opts.disabled = true; } for (let key of Object.keys(options)) { opts[key] = options[key]; } } return opts; } function parseStrings (data, options) { const opt = parseOptions(options); const strs = []; let str = ''; data.forEach(ch => { if (isPrintable(ch)) { str += String.fromCharCode(ch); } else { if (str.length > opt.minLength) { strs.push(str); str = ''; } } }); return strs; }
cc @as0ler
implemented in cf10a0aabd5a5a6106231aad127dd5fa3b2e9d11
Use this code in agent-side to grab strings from data buffers: