Skip to content

Instantly share code, notes, and snippets.

@dweinstein
Last active October 9, 2016 15:36
Show Gist options
  • Save dweinstein/ece2110f51bcdf9a331d98c0bb1ca2cd to your computer and use it in GitHub Desktop.
Save dweinstein/ece2110f51bcdf9a331d98c0bb1ca2cd to your computer and use it in GitHub Desktop.

Revisions

  1. dweinstein revised this gist Oct 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0README.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    The idea here is to organize multiple agent scripts into modules that can be combined into an aggregated agent.

    frida agents will live under e.g., an `./lib/agents` directory.
    frida agents generally live under e.g., an `./lib/agents` directory in a top level project.

    # TODO

  2. dweinstein revised this gist Oct 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion agent2.js
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,6 @@ function enable (opts) {
    }

    /// only enable if we're using Frida version 8.0.0...
    function test () {
    function test (opts) {
    return Frida.version === '8.0.0'
    }
  3. dweinstein revised this gist Oct 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion agent1.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    module.exports = {
    enable: enable,
    test: test, // tests for whether our agent should be enabled
    description: 'This script will dump the methods of the class name passe in'
    description: 'This script will dump the methods of the class name passed in'
    }

    function enable (opts) {
  4. dweinstein revised this gist Oct 9, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 0README.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    The idea here is to organize multiple agent scripts into modules that can be combined into an aggregated agent.

    frida agents will live under e.g., an `./lib/agents` directory.

    # TODO

    For each agent script we need a top level runner and then we use [`frida-compile`](https://github.com/frida/frida-compile) to build into a single agent script that we can load.
  5. dweinstein revised this gist Oct 9, 2016. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion agent1.js
    Original file line number Diff line number Diff line change
    @@ -17,5 +17,5 @@ function enable (opts) {

    /// the test will be called to make sure we should enable the agent.
    function test (opts) {
    return ObjC.available && typeof opts.agent1.className !== 'undefined';
    return ObjC.available && typeof opts.agent1.className !== 'undefined'
    }
    2 changes: 1 addition & 1 deletion agent2.js
    Original file line number Diff line number Diff line change
    @@ -14,5 +14,5 @@ function enable (opts) {

    /// only enable if we're using Frida version 8.0.0...
    function test () {
    return Frida.version === '8.0.0';
    return Frida.version === '8.0.0'
    }
  6. dweinstein revised this gist Oct 9, 2016. No changes.
  7. dweinstein revised this gist Oct 9, 2016. 3 changed files with 16 additions and 6 deletions.
    6 changes: 5 additions & 1 deletion 0README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    # SUMMARY

    The idea here is to organize multiple agent scripts into modules that can be combined into an aggregated agent.
    The idea here is to organize multiple agent scripts into modules that can be combined into an aggregated agent.

    # TODO

    For each agent script we need a top level runner and then we use [`frida-compile`](https://github.com/frida/frida-compile) to build into a single agent script that we can load.
    15 changes: 10 additions & 5 deletions agent1.js
    Original file line number Diff line number Diff line change
    @@ -3,14 +3,19 @@
    module.exports = {
    enable: enable,
    test: test, // tests for whether our agent should be enabled
    description: 'description here'
    description: 'This script will dump the methods of the class name passe in'
    }

    function enable (opts) {
    if (option
    // pass the className via an option to the agent
    // in this case we assume opts holds the options for all agent scripts rather
    // than just this specific script this is a design decision that can be tweaked.
    if (opts.agent1.className) {
    console.log(ObjC.classes[opts.agent1.className].$methods)
    }
    }

    function test () {
    // perform any tests to see if this module should be enabled here
    return ObjC.available;
    /// the test will be called to make sure we should enable the agent.
    function test (opts) {
    return ObjC.available && typeof opts.agent1.className !== 'undefined';
    }
    1 change: 1 addition & 0 deletions agent2.js
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ function enable (opts) {
    }
    }

    /// only enable if we're using Frida version 8.0.0...
    function test () {
    return Frida.version === '8.0.0';
    }
  8. dweinstein created this gist Oct 9, 2016.
    3 changes: 3 additions & 0 deletions 0README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # SUMMARY

    The idea here is to organize multiple agent scripts into modules that can be combined into an aggregated agent.
    16 changes: 16 additions & 0 deletions agent1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    'use strict'

    module.exports = {
    enable: enable,
    test: test, // tests for whether our agent should be enabled
    description: 'description here'
    }

    function enable (opts) {
    if (option
    }

    function test () {
    // perform any tests to see if this module should be enabled here
    return ObjC.available;
    }
    17 changes: 17 additions & 0 deletions agent2.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    'use strict'

    module.exports = {
    enable: enable,
    test: test, // tests for whether our agent should be enabled
    description: 'description here'
    }

    function enable (opts) {
    if (opts.thing) {
    // do something different here
    }
    }

    function test () {
    return Frida.version === '8.0.0';
    }
    6 changes: 6 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    module.exports = {
    agents: [
    require('./agent1.js'),
    require('./agent2.js')
    ]
    }