Giter Club home page Giter Club logo

frida-ex-nativefunction's People

Contributors

freehuntx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

frida-ex-nativefunction's Issues

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'

I am getting an error when compiling using frida-compile

agent.js looks like this

const ExNativeFunction = require('frida-ex-nativefunction');

const openAddr = Module.findExportByName('libc.so', 'open');
const open = new ExNativeFunction(openAddr, 'int', ['pointer', 'int']);

console.log(open.address); // The provided openAddr
console.log(open.retType); // The provided return type
console.log(open.argTypes); // The provided argument types
console.log(open.abi); // The provided abi

// Shorthand for Interceptor.attach
const listener = open.intercept({
  onEnter: function (arg) {
    console.log(args);
  },
  onLeave: function () {},
});
listener.detach(); // You can use it like usual

// Shorthand for Interceptor.replace
open.replace((pathPtr, flags) => {
  return open(pathPtr, flags);
});

Now when i run frida-compile agent.js -o _agent.js, it throws an error regarding the imports

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (27:0) while parsing C:\Users\Areg\Downloads\New folder (4)\node_modules\frida-ex-nativefunction\index.js while parsing file: C:\Users\Areg\Downloads\New folder (4)\node_modules\frida-ex-nativefunction\index.js
    at DestroyableTransform.end [as _flush] (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\insert-module-globals\index.js:114:21)
    at DestroyableTransform.prefinish (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\readable-stream\lib\_stream_transform.js:138:10)
    at DestroyableTransform.emit (events.js:315:20)
    at prefinish (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\readable-stream\lib\_stream_writable.js:619:14)
    at finishMaybe (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\readable-stream\lib\_stream_writable.js:627:5)
    at endWritable (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\readable-stream\lib\_stream_writable.js:638:3)
    at DestroyableTransform.Writable.end (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\readable-stream\lib\_stream_writable.js:594:41)
    at DestroyableTransform.onend (C:\Users\Areg\AppData\Roaming\npm\node_modules\frida-compile\node_modules\readable-stream\lib\_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:421:28)
    at DestroyableTransform.emit (events.js:327:22) {
  type: 'syntax',
  filename: 'C:\\Users\\Areg\\Downloads\\New folder (4)\\node_modules\\frida-ex-nativefunction\\index.js',
  stream: Labeled {
    _readableState: ReadableState {
      objectMode: true,
      highWaterMark: 16,
      buffer: BufferList { length: 0 },
      length: 0,
      pipes: [Labeled],
      pipesCount: 1,
      flowing: true,
      ended: false,
      endEmitted: false,
      reading: true,
      sync: false,
      needReadable: true,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrain: 0,
      readingMore: false,
      decoder: null,
      encoding: null
    },
    readable: true,
    _events: [Object: null prototype] {
      end: [Array],
      error: [Function (anonymous)],
      data: [Function: ondata],
      _mutate: [Function]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    _writableState: WritableState {
      objectMode: true,
      highWaterMark: 16,
      finalCalled: false,
      needDrain: false,
      ending: true,
      ended: true,
      finished: true,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function (anonymous)],
      writecb: null,
      writelen: 0,
      bufferedRequest: null,
      lastBufferedRequest: null,
      pendingcb: 0,
      prefinished: true,
      errorEmitted: false,
      bufferedRequestCount: 0,
      corkedRequestsFree: [CorkedRequest]
    },
    writable: false,
    allowHalfOpen: true,
    _options: { objectMode: true },
    _wrapOptions: { objectMode: true },
    _streams: [ [Deps], [Transform] ],
    length: 2,
    label: 'deps',
    [Symbol(kCapture)]: false
  },
  inputs: Set(21) {
    'C:\\Users\\Areg\\Downloads\\New folder (4)\\agent.js',
    'C:/Users/Areg/Downloads/New folder (4)/agent.js',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es6.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es5.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.core.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.collection.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.iterable.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.symbol.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.generator.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.promise.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.proxy.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.reflect.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.dom.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.dom.iterable.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.webworker.importscripts.d.ts',
    'C:/Users/Areg/AppData/Roaming/npm/node_modules/frida-compile/node_modules/typescript/lib/lib.scripthost.d.ts',
    'C:\\Users\\Areg\\Downloads\\New folder (4)\\package.json',
    'C:\\Users\\Areg\\Downloads\\New folder (4)\\node_modules\\frida-ex-nativefunction\\package.json',
    'C:\\Users\\Areg\\Downloads\\New folder (4)\\node_modules\\frida-ex-nativefunction\\index.js'
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.