Skip to content

Instantly share code, notes, and snippets.

@riverar

riverar/agent.js

Last active Jul 9, 2019
Embed
What would you like to do?
Frida agent, using Xamarin Mono APIs to access a static field and dump its value
import { MonoApiHelper, MonoApi } from 'frida-mono-api'
const domain = MonoApi.mono_get_root_domain()
// Get a handle to the SeeingAI.Core assembly
let coreAssembly = MonoApi.mono_assembly_load_with_partial_name(Memory.allocUtf8String("SeeingAI.Core"), NULL)
let coreImage = MonoApi.mono_assembly_get_image(coreAssembly)
// Retrieve class metadata
let helperClass = MonoApiHelper.ClassFromName(coreImage, "SeeingAI.Network.SignatureHelper")
// Retrieve field metadata and value
let secretField = MonoApiHelper.ClassGetFieldFromName(helperClass, "Secret")
let secretValue = MonoApiHelper.FieldGetValueObject(secretField, NULL, domain)
// Dump array to screen
var secretValueLength = MonoApi.mono_array_length(secretValue)
console.log(hexdump(MonoApi.mono_array_addr_with_size(secretValue, 1, 0), { length: secretValueLength }))
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.