Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement /z in r2frida #92

Closed
trufae opened this issue Jun 6, 2018 · 2 comments
Closed

Implement /z in r2frida #92

trufae opened this issue Jun 6, 2018 · 2 comments

Comments

@trufae
Copy link
Member

trufae commented Jun 6, 2018

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;
}
@trufae
Copy link
Member Author

trufae commented Nov 27, 2023

cc @as0ler

@trufae
Copy link
Member Author

trufae commented Feb 4, 2024

implemented in cf10a0a

@trufae trufae closed this as completed Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant