Skip to content

Instantly share code, notes, and snippets.

@oleavr oleavr/load-cycript.js

Last active Feb 18, 2019
What would you like to do?
Frida script to load Cycript into an arbitrary process (workaround for sandboxing issues)
'use strict';
* Usage:
* $ frida -U -n Twitter -l load-cycript.js
var PORT = 27060;
var CYListenServer = new NativeFunction(Module.findExportByName('libcycript.dylib', 'CYListenServer'), 'void', ['int16']);
'Cycript listening on port ' + PORT,
'SSH to the device and run:',
' $ cycript -r' + PORT,
'You may now detach Frida.',
function dlopen(library) {
var _dlopen = new NativeFunction(Module.findExportByName(null, 'dlopen'), 'pointer', ['pointer', 'int']);
var RTLD_GLOBAL = 0x8;
var RTLD_LAZY = 0x1;
var path = Memory.allocUtf8String(library);
var handle = _dlopen(path, RTLD_GLOBAL | RTLD_LAZY);
if (handle.isNull())
throw new Error('Failed to load ' + library);
return handle;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.