GithubHelp home page GithubHelp logo

fuzzysecurity / fermion Goto Github PK

View Code? Open in Web Editor NEW
642.0 23.0 79.0 7.55 MB

Fermion, an electron wrapper for Frida & Monaco.

License: BSD 3-Clause "New" or "Revised" License

CSS 57.18% JavaScript 35.38% HTML 7.44%

fermion's Introduction

CI stars forks release frida-node frida-gum

Fermion

Fermion is an electron application that wraps frida-node and monaco-editor. It offers a fully integrated environment to prototype, test and refine Frida scripts through a single UI. With the integration of Monaco come all the features you would expect from Visual Studio Code: Linting, IntelliSense, keybindings, etc. In addition, Fermion has a TypeScript language definition for the Frida API so it is easy to write Frida scripts.

What's in a name: A fermion can be an elementary particle, such as the electron, or it can be a composite particle, such as the proton. Fermions include all quarks and leptons, as well as all composite particles made of an odd number of these, such as all baryons and many atoms and nuclei.

How to get Fermion?

Run Fermion from source

Download the repository and navigate to the Fermion folder in the terminal. Once there, set the following environment variables.

# Windows
set npm_config_runtime=electron
set npm_config_target=21.0.0

# Linux / OSX
export npm_config_runtime=electron
export npm_config_target=21.0.0

Afterwards install the packages required to run Fermion with:

npm install

Once complete, you can run Fermion by issuing:

npm start

Compile a release package

Complete the steps above and then issue the following command from the terminal:

# Windows
electron-packager . --icon .\src\images\fermion-ico.ico

# Linux
electron-packager . --icon ./src/images/fermion-ico.png

# OSX
electron-packager . --icon ./src/images/fermion-ico.icns

Releases

You can get the latest pre-built Fermion for x64 Windows and Linux from releases.

FAQ notes

Windows

  • Q: I need to inject a SYSTEM level process, how can I do that?
    • A: You used to be able to utilize tools like psexec to run Fermion as SYSTEM however since Electron v8 this causes Fermion to freeze. What you really need is for Fermion to run as Administrator and have SeDebugPrivilege privileges. As a workaround you can launch PowerShell as Administrator and use that to launch Fermion.

Linux

  • Q: I can't attach to a running process?
    • A: System restrictions may prevent you from attaching, normally you will see a message in Fermion to tell you what the problem is and how you can solve it. However, generally, you can run Fermion or the Frida Server as root or alternatively run the following command sudo sysctl kernel.yama.ptrace_scope=0.

General

  • Q: I want to build my own version of Fermion against a new version of Frida/Electron. How can I find out which prebuild’s exist currently?

    • A: You should have a look here, you can check the default build version in ELECTRON_TARGETS_DEFAULT and ELECTRON_TARGETS_FREEBSD respectively.
  • Q: I want to review/change/update the type definitions used in the Monaco editor, how can I do that?

    • A: This is now handled as part of the build process so your language definitions should always be up-to-date. If you want to edit the app language definitions manually, you can find them here node_modules/@types/frida-gum/index.d.ts.
  • Q: Why you no stable trace man (╯°□°)╯︵ ┻━┻

    • A: Call tracing is resource intensive. In most cases it will work fine but if you are tracing a hot pointer and/or the trace is generating graphs with thousands of nodes then you will likely find that the trace window will lag out while it is receiving data. Also, as with any kind of tracing, it can cause process instability / crashing / freezing.

About

You can see an example of Fermion at work below, in this case instrumenting kernel32!ReadFile.

Fermion

Fermion has auto-complete, linting and Frida API symbol support.

Help

Fermion can connect to a Frida server to debug remote applications using the device context menu. In many cases such as with USB debugging or when attaching to mobile applications through emulators like genymotion Fermion will automatically pick up the server as available. However, it is also possible to specify a remote server using an IP and Port combination.

Server

Fermion has built-in support for thread CALL tracing.

Trace

This may not do exactly what you expect it to. When you define either a pointer or module/Symbol combination the tracer will attach to that location and any time a thread executes at that place it will start tracing all CALL instructions that thread performs till it returns. This means that different executions can generate different graphs, it also means that you may not see everything a function is doing (e.g. if, inside the function, a different thread gets spawned).

SVG

Fermion converts these traces into a Graphviz SVG format using dot which you can then explore. This is a feature which I find useful on occasion when performing exploratory work (What does a function do? How complex is that execution?). That being said, this is a prototype feature which I built on top of Fermion and probably needs some more loving to be more production ready.

Fermion also has built-in documentation for Frida's JavaScript API. Like everyone else I don't always remember how everything works and having the docs in the app obviates the need to have a browser window open.

Docs

Notes

ChangeLog

For more details on version specific changes consult the changelog.

Call to action

If you integrate Fermion into your work-flow and find it useful I encourage you to make pull requests, submit bug reports and ask for features to improve the application. I'm not exactly a Node developer so I am sure people will find ways optimize and rework some of the components.

Roadmap

  • Implement a more complete device manager interface.
  • UI re-design.
  • Gauge the appetite for more native tools built on top of Fermion and add these.
  • Extend the device manager to take advantage of the new features integrated into Frida v15.0+.

Special thanks

I just want to give a few special thanks!

  • A huge thanks to Ole André V. Ravnås for all his work on Frida and having a lot of patience answering my pedestrian questions about Frida, NodeJS and Monaco!
  • A shout-out also to mattahan. I'm using a Buuf icon for the Windows package of Fermion. I'm sure we have all used some of his icons on NIX over the years.
  • Thanks to @MiscMisty, @lez0sec, @berkayyildi for contributing time/code to Fermion!

fermion's People

Contributors

fuzzysecurity avatar github-actions[bot] avatar nyamisty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fermion's Issues

Start a new process instead of just attaching to existing

Hi fuzzysec, it would be great if there was an option to start a new process too.
There are some functions which I need to hook just as the process starts. If I attach it to an existing process I am unable to catch those functions.

Some bugs and suggestions

Thanks for your hard work.Feedback some bugs or suggestions here:

  • The log format is confused when using 'send' keyword with 'hexdump' like 'send(hexdump(addr, {length: 200, ansi:true}))'.
  • 'Process List':

The icon doesn't seem to be accurate.
Sorting is not supported.
Child process information could not be displayed.
Recommended to close the 'Process List' window when 'Attach' button is clicked.

  • Recommended to support the drag-and-drop opening function.
  • Recommended to open the last js file automatically when opening the application.

More complete status messages

There should be feedback on success or failure for some actions like selecting a socket listener or injecting/detaching a proc. In some rare cases something doesn't work and you can only tell because you are still attached or not attached etc.

No Editor on Open [macOS]

Recently downloaded and was hyped ti give it a try, given it'll streamline a lot of my workflow. Unfortunately, when I open I just see this.
Screen Shot 2020-07-15 at 2 56 34 PM
I'm not sure if it's because it's not codesigned or what. I've tried running from electrum directly and there are no errors, yet the buttons don't work, etc.

Much regards and apologies for the inconvenience.

Does not support remote

The device cannot be recognized by Fermion through ./frida-server -l ip on the mobile phone

Process list issue

when i choose a mobile device, then click the Process List Button, it show that

Failed to execute 'deleteCell' on 'HTMLTableRowElement': The value provided (0) is outside the range [0, 0).

Remote device

Hello,

thank you for such great tool. Can you elaborate though how to connect to a remote device, please? I could not find any information anywhere about it, apart from changelog where it says this feature was added.

I have an iPhone connected to my MacOS. I can see it with frida-ls-devices and frida-ps -U, but still Fermion shows only a local device.

If I missed something obvious, please accept my apologies.

thanks

Process Start Arguments

It looks like there is an issue with complex arguments. I need to make a fix for this (probably some array join space shenanigans).

Does this work in Linux?

Using Ubuntu:

uname -a
Linux 7ASecurity 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

First try following official instructions:

export npm_config_runtime=electron
export npm_config_target=7.0.0
npm install

> [email protected] install /home/alert1/tools/Fermion-master/Fermion/node_modules/frida
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=7.0.0 runtime=electron arch=x64 libc= platform=linux)
gyp: binding.gyp not found (cwd: /home/alert1/tools/Fermion-master/Fermion/node_modules/frida) while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/alert1/.nvm/versions/node/v8.15.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 5.3.0-40-generic
gyp ERR! command "/home/alert1/.nvm/versions/node/v8.15.1/bin/node" "/home/alert1/.nvm/versions/node/v8.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/alert1/tools/Fermion-master/Fermion/node_modules/frida
gyp ERR! node -v v8.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/alert1/.npm/_logs/2020-02-26T06_12_07_307Z-debug.log

Second shot (another terminal, no exported variables):

rm -rf node_modules/
npm install

> [email protected] install /home/alert1/tools/Fermion-master/Fermion/node_modules/frida
> prebuild-install || node-gyp rebuild


> [email protected] postinstall /home/alert1/tools/Fermion-master/Fermion/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall /home/alert1/tools/Fermion-master/Fermion/node_modules/electron
> node install.js

added 140 packages from 128 contributors and audited 207 packages in 11.722s
found 0 vulnerabilities

npm start

> [email protected] start /home/alert1/tools/Fermion-master/Fermion
> electron .

Expected result: Fermion works

Real result: Fermion launches but no buttons work at all, cannot even close the app.

QOL Roadmap for v2.0

Roadmap of changes slated for v2.0.0

  • Code clutter clean-up caused by v1.8 development (Resolved v1.9.0)
  • Replace all instances of ipcMain/ipcRenderer with BroadcastChannel
  • Migrate to Electron v15.x (Resolved v1.9.0)
  • Update Frida to v-latest (Resolved v1.9.0)
  • Change trace table generation. The table should really be created and destroyed on demand.
  • Clicking Devtools button focuses border on Process List, forgot to remove that issue. (Resolved v1.9.0)
  • Add support for png format icons like on mobile systems (Resolved v1.8.1)
  • Add verbose output on attach/detach in case of arbitrary failure
  • Allow users to drag and drop a js file into the editor
  • Add scroll to the process listing (Resolved v1.9.0)
  • Make columns in the process listing sortable (Resolved v1.9.0)

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.