Skip to main content
Glama

Frida MCP Server

by nonsleepr
scripts.ts2.63 kB
/** * JavaScript script templates for Frida instrumentation * * These templates use Frida's JavaScript API to perform various * instrumentation tasks in target processes. */ /** * Template for getting main module information */ export const SCRIPT_GET_MODULE_PATH = ` var mainModule = Process.enumerateModules()[0]; send({ name: mainModule.name, path: mainModule.path, base: mainModule.base.toString(), size: mainModule.size }); `; /** * Template wrapper for executing JavaScript code with console.log capture * The {code} placeholder will be replaced with actual JavaScript code */ export const SCRIPT_EXECUTE_WRAPPER = ` (function() { var initialLogs = []; var originalLog = console.log; // Intercept console.log to capture output console.log = function() { var args = Array.prototype.slice.call(arguments); var logMsg = args.map(function(arg) { return typeof arg === 'object' ? JSON.stringify(arg) : String(arg); }).join(' '); initialLogs.push(logMsg); originalLog.apply(console, arguments); }; var scriptResult; var scriptError; try { {code} } catch (e) { scriptError = { message: e.toString(), stack: e.stack }; } // Restore console.log console.log = originalLog; // Send execution receipt back to TypeScript send({ type: 'execution_receipt', result: scriptError ? undefined : (scriptResult !== undefined ? scriptResult.toString() : 'undefined'), error: scriptError, initial_logs: initialLogs }); })(); `; /** * Template for reading files in chunks * The {path} placeholder will be replaced with the file path */ export const SCRIPT_READ_FILE_CHUNKS = ` var filePath = {path}; var chunkSize = 1024 * 1024; // 1MB chunks try { var file = new File(filePath, 'rb'); var totalSize = 0; var chunkIndex = 0; while (true) { var chunk = file.readBytes(chunkSize); if (chunk.byteLength === 0) break; // Send chunk with raw binary data send({ type: 'chunk', index: chunkIndex, size: chunk.byteLength }, chunk); totalSize += chunk.byteLength; chunkIndex++; } file.close(); send({ type: 'complete', status: 'success', totalSize: totalSize, chunkCount: chunkIndex }); } catch (e) { send({ type: 'error', status: 'error', error: e.toString(), message: 'Failed to read file: ' + e.message }); } `;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nonsleepr/frida-mcp.ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server