diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9d43a27..30341f5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -93,4 +93,11 @@ * Disable contextIsolation for window communications * Bugfix for https://github.com/FuzzySecurity/Fermion/issues/12 * Four new themes: Amy, Oceanic Next, Tomorrow Night Blue, Vibrant Ink -* More minor UI colour changes. I'm still thinking of a full re-design for v2. \ No newline at end of file +* More minor UI colour changes. I'm still thinking of a full re-design for v2. + +-= Fermion v1.7 =- + +* Pre-built release updated to Frida v15.1.1 +* Updated language bindings +* Better process information User/PID/PPID. On devices where "parameters.icons" have a type of RGBA they are drawn to a canvas inline. In my testing Ubuntu did not have icons in which case they are not drawn. The release notes for v15 say that some devices like IOS/Android now return a PNG byte array, currently those are not drawn either, PR's welcome. +* The main UI now has a button which retrieves Device information as per the new specs in the v15 release notes. \ No newline at end of file diff --git a/Fermion/assets/img/version.png b/Fermion/assets/img/version.png index 7029c54..de9054b 100644 Binary files a/Fermion/assets/img/version.png and b/Fermion/assets/img/version.png differ diff --git a/Fermion/assets/lang/frida.d.ts b/Fermion/assets/lang/frida.d.ts index 946043b..5942fe5 100644 --- a/Fermion/assets/lang/frida.d.ts +++ b/Fermion/assets/lang/frida.d.ts @@ -1,9 +1,9 @@ -// Type definitions for non-npm package frida-gum 17.0 +// Type definitions for non-npm package frida-gum 17.1 // Project: https://github.com/frida/frida // Definitions by: Ole André Vadla Ravnås // Francesco Tamagni // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Minimum TypeScript Version: 3.5 +// Minimum TypeScript Version: 4.1 /** * Returns a hexdump of the provided ArrayBuffer or NativePointerValue target. @@ -1604,46 +1604,81 @@ declare const NativeFunction: NativeFunctionConstructor; interface NativeFunctionConstructor { - new(address: NativePointerValue, retType: NativeType, argTypes: NativeType[], abiOrOptions?: NativeABI | NativeFunctionOptions): NativeFunction; - readonly prototype: NativeFunction; + new ( + address: NativePointerValue, + retType: RetType, + argTypes: ArgTypes, + abiOrOptions?: NativeABI | NativeFunctionOptions, + ): NativeFunction< + GetNativeFunctionReturnValue, + ResolveVariadic, unknown[]>> + >; + readonly prototype: NativeFunction; } - interface NativeFunction extends NativePointer { - (...args: NativeArgumentValue[]): NativeReturnValue; - apply(thisArg: NativePointerValue | null | undefined, args: NativeArgumentValue[]): NativeReturnValue; - call(thisArg?: NativePointerValue | null, ...args: NativeArgumentValue[]): NativeReturnValue; + interface NativeFunction + extends NativePointer { + (...args: ArgTypes): RetType; + apply(thisArg: NativePointerValue | null | undefined, args: ArgTypes): RetType; + call(thisArg?: NativePointerValue | null, ...args: ArgTypes): RetType; } declare const SystemFunction: SystemFunctionConstructor; interface SystemFunctionConstructor { - new(address: NativePointerValue, retType: NativeType, argTypes: NativeType[], abiOrOptions?: NativeABI | NativeFunctionOptions): SystemFunction; - readonly prototype: SystemFunction; - } - - interface SystemFunction extends NativePointer { - (...args: NativeArgumentValue[]): SystemFunctionResult; - apply(thisArg: NativePointerValue | null | undefined, args: NativeArgumentValue[]): SystemFunctionResult; - call(thisArg?: NativePointerValue | null, ...args: NativeArgumentValue[]): SystemFunctionResult; - } - - type SystemFunctionResult = WindowsSystemFunctionResult | UnixSystemFunctionResult; + new ( + address: NativePointerValue, + retType: RetType, + argTypes: ArgTypes, + abiOrOptions?: NativeABI | NativeFunctionOptions, + ): SystemFunction< + GetNativeFunctionReturnValue, + ResolveVariadic, unknown[]>> + >; + readonly prototype: SystemFunction; + } + + interface SystemFunction + extends NativePointer { + (...args: ArgTypes): SystemFunctionResult; + apply(thisArg: NativePointerValue | null | undefined, args: ArgTypes): SystemFunctionResult; + call(thisArg?: NativePointerValue | null, ...args: ArgTypes): SystemFunctionResult; + } + + type SystemFunctionResult = + | WindowsSystemFunctionResult + | UnixSystemFunctionResult + ; - interface WindowsSystemFunctionResult { - value: NativeReturnValue; + interface WindowsSystemFunctionResult { + value: Value; lastError: number; } - interface UnixSystemFunctionResult { - value: NativeReturnValue; + interface UnixSystemFunctionResult { + value: Value; errno: number; } - declare class NativeCallback extends NativePointer { - constructor(func: NativeCallbackImplementation, retType: NativeType, argTypes: NativeType[], abi?: NativeABI); + declare class NativeCallback< + RetType extends NativeCallbackReturnType, + ArgTypes extends NativeCallbackArgumentType[] | [], + > extends NativePointer { + constructor( + func: NativeCallbackImplementation< + GetNativeCallbackReturnValue, + Extract, unknown[]> + >, + retType: RetType, + argTypes: ArgTypes, + abi?: NativeABI, + ); } - type NativeCallbackImplementation = (this: CallbackContext | InvocationContext, ...params: any[]) => any; + type NativeCallbackImplementation< + RetType extends NativeCallbackReturnValue, + ArgTypes extends NativeCallbackArgumentValue[] | [], + > = (this: CallbackContext | InvocationContext, ...args: ArgTypes) => RetType; interface CallbackContext { /** @@ -1659,11 +1694,125 @@ context: CpuContext; } - type NativeArgumentValue = NativePointerValue | UInt64 | Int64 | number | boolean | any[]; - - type NativeReturnValue = NativePointer | UInt64 | Int64 | number | boolean | any[]; - - type NativeType = string | any[]; + type Variadic = "..."; + + type ResolveVariadic = List extends [Variadic, ...infer Tail] + ? [...Array] + : List extends [infer Head, ...infer Tail] + ? [Head, ...ResolveVariadic] + : []; + + type RecursiveValuesOf = T[keyof T] | Array>; + + type RecursiveKeysOf = keyof T | Array> | []; + + type GetValue = Type[] extends T + ? Value + : T extends keyof Map + ? Map[T] + : { [P in keyof T]: T[P] extends Type ? GetValue : never }; + + // tslint:disable-next-line:interface-over-type-literal + type BaseNativeTypeMap = { + int: number; + uint: number; + long: number; + ulong: number; + char: number; + uchar: number; + float: number; + double: number; + int8: number; + uint8: number; + int16: number; + uint16: number; + int32: number; + uint32: number; + bool: number; + }; + + type NativeFunctionArgumentTypeMap = BaseNativeTypeMap & { + void: undefined; + pointer: NativePointerValue; + size_t: number | UInt64; + ssize_t: number | Int64; + int64: number | Int64; + uint64: number | UInt64; + "...": Variadic; + }; + + type NativeFunctionArgumentValue = RecursiveValuesOf; + + type NativeFunctionArgumentType = RecursiveKeysOf; + + type GetNativeFunctionArgumentValue = GetValue< + NativeFunctionArgumentTypeMap, + NativeFunctionArgumentValue, + NativeFunctionArgumentType, + T + >; + + type NativeFunctionReturnTypeMap = BaseNativeTypeMap & { + // tslint:disable-next-line:void-return + void: void; + pointer: NativePointer; + size_t: UInt64; + ssize_t: Int64; + int64: Int64; + uint64: UInt64; + }; + + type NativeFunctionReturnValue = RecursiveValuesOf; + + type NativeFunctionReturnType = RecursiveKeysOf; + + type GetNativeFunctionReturnValue = GetValue< + NativeFunctionReturnTypeMap, + NativeFunctionReturnValue, + NativeFunctionReturnType, + T + >; + + type NativeCallbackArgumentTypeMap = BaseNativeTypeMap & { + void: undefined; + pointer: NativePointer; + size_t: UInt64; + ssize_t: Int64; + int64: Int64; + uint64: UInt64; + }; + + type NativeCallbackArgumentValue = RecursiveValuesOf; + + type NativeCallbackArgumentType = RecursiveKeysOf; + + type GetNativeCallbackArgumentValue = GetValue< + NativeCallbackArgumentTypeMap, + NativeCallbackArgumentValue, + NativeCallbackArgumentType, + T + >; + + type NativeCallbackReturnTypeMap = BaseNativeTypeMap & { + // tslint:disable-next-line:void-return + void: void; + pointer: NativePointerValue; + size_t: number | UInt64; + ssize_t: number | Int64; + int64: number | Int64; + uint64: number | UInt64; + }; + + type NativeCallbackReturnValue = RecursiveValuesOf; + + type NativeCallbackReturnType = RecursiveKeysOf; + + type GetNativeCallbackReturnValue = GetValue< + NativeCallbackReturnTypeMap, + NativeCallbackReturnValue, + NativeCallbackReturnType, + T + >; type NativeABI = | "default" @@ -3065,27 +3214,27 @@ * through the constructor's second argument. */ declare class CModule { - /** - * Creates a new C module from the provided `code`. - * - * @param code C source code to compile, or a precompiled shared library. - * @param symbols Symbols to expose to the C module. Declare them as `extern`. - * This may for example be one or more memory blocks allocated using - * `Memory.alloc()`, and/or `NativeCallback` values for receiving - * callbacks from the C module. - * @param options Options for customizing the construction. - */ - constructor(code: string | ArrayBuffer, symbols?: CSymbols, options?: CModuleOptions); + /** + * Creates a new C module from the provided `code`. + * + * @param code C source code to compile, or a precompiled shared library. + * @param symbols Symbols to expose to the C module. Declare them as `extern`. + * This may for example be one or more memory blocks allocated using + * `Memory.alloc()`, and/or `NativeCallback` values for receiving + * callbacks from the C module. + * @param options Options for customizing the construction. + */ + constructor(code: string | ArrayBuffer, symbols?: CSymbols, options?: CModuleOptions); - /** - * Eagerly unmaps the module from memory. Useful for short-lived modules - * when waiting for a future garbage collection isn't desirable. - */ - dispose(): void; + /** + * Eagerly unmaps the module from memory. Useful for short-lived modules + * when waiting for a future garbage collection isn't desirable. + */ + dispose(): void; - readonly [name: string]: any; + readonly [name: string]: any; - static builtins: CModuleBuiltins; + static builtins: CModuleBuiltins; } interface CModuleOptions { @@ -3918,7 +4067,7 @@ * @param method Method to implement. * @param fn Implementation. */ - function implement(method: ObjectMethod, fn: AnyFunction): NativeCallback; + function implement(method: ObjectMethod, fn: AnyFunction): NativeCallback; /** * Creates a new class designed to act as a proxy for a target object. diff --git a/Fermion/core.js b/Fermion/core.js index 1b3f7d1..6a25e20 100644 --- a/Fermion/core.js +++ b/Fermion/core.js @@ -8,7 +8,7 @@ function createWindow() { bWin = new BrowserWindow({ contextIsolation: false, width: 1000, - height: 900, + height: 930, frame: false, show: false, backgroundColor: '#464646', diff --git a/Fermion/package.json b/Fermion/package.json index bc664cb..157cb6c 100644 --- a/Fermion/package.json +++ b/Fermion/package.json @@ -1,6 +1,6 @@ { "name": "fermion", - "version": "1.6.0", + "version": "1.7.0", "description": "Fermion is a stand-alone Frida electron tool.", "main": "core.js", "scripts": { @@ -11,7 +11,7 @@ "license": "BSD-3-Clause", "dependencies": { "electron": "13.1.6", - "frida": "15.0.2", + "frida": "15.1.1", "jquery": "^3.4.1", "monaco-editor": "0.17.0", "mutex-promise": "0.1.0" diff --git a/Fermion/src/frida.html b/Fermion/src/frida.html index 6c01ef1..6d92bec 100644 --- a/Fermion/src/frida.html +++ b/Fermion/src/frida.html @@ -33,7 +33,10 @@
  • - + +
  • +
  • +

@@ -218,7 +221,7 @@ var editor = monaco.editor.create(document.getElementById('container'), { value: [ '//-------------------------------------------//', - '// Fermion v1.6 //', + '// Fermion v1.7 //', '// ~b33f //', '//-------------------------------------------//', '', @@ -264,8 +267,8 @@