Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
fix #51
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiChou committed Jul 3, 2019
1 parent d9aa505 commit 71836c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
8 changes: 2 additions & 6 deletions lib/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ class Handler {

async getAgent(name) {
const prefix = path.join(__dirname, '..', 'agent', `${name}.bundle`)
if (process.env.NODE_ENV === 'development') {
const source = await readFile(`${prefix}.js`, 'utf8')
return this.session.createScript(source)
}
const bytes = await readFile(`${prefix}.bin`)
return this.session.createScriptFromBytes(bytes)
const source = await readFile(`${prefix}.js`, 'utf8')
return this.session.createScript(source)
}
}

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"lib/",
"bin/",
"scripts/post-install.js",
"agent/*.bundle.js",
"agent/*.bundle.bin"
"agent/*.bundle.js"
],
"author": "CodeColorist",
"license": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions scripts/lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ const compiler = require('frida-compile')
const TAG_FRIDA = '[Frida]'.yellow
const tasks = [{
src: 'agent/app/index.js',
dest: 'agent/app.bundle',
dest: 'agent/app.bundle.js',
}]


exports.run = function(watch) {
const opt = {
bytecode: !watch,
bytecode: false,
compress: false,
babelify: true,
sourcemap: watch,
Expand All @@ -18,15 +18,15 @@ exports.run = function(watch) {
}

if (watch) {
tasks.forEach(task => compiler.watch(task.src, `${task.dest}.js`, opt)
tasks.forEach(task => compiler.watch(task.src, task.dest, opt)
.on('compile', (details) => {
const count = details.files.length
const { duration } = details
console.log(TAG_FRIDA, `compiled ${count} file(s) in ${duration} ms`)
}))
} else {
Promise
.all(tasks.map(task => compiler.build(task.src, `${task.dest}.bin`, opt)))
.all(tasks.map(task => compiler.build(task.src, task.dest, opt)))
.catch(err => console.error(err))
}
}

0 comments on commit 71836c0

Please sign in to comment.