AI prompts
base on Hide your P/Invoke signatures through other people's signed assemblies # Parasite-Invoke
Hide your P/Invoke signatures through other people's signed assemblies!
## Usage
![изображение](https://github.com/MzHmO/Parasite-Invoke/assets/92790655/7932c49f-232e-4184-8059-d107f3470f2e)
```shell
[PARAMETER MANDATORY]
"--path <PATH>", "The start directory to list .NET assemblies from."
[OPTIONAL PARAMS]
"-r|--recurse", "Recursively discover assemblies"
"--method <METHOD>", "Name of the PInvoke method to find"
```
The tool accepts one mandatory parameter, it is path. If you simply specify a `--path` (For ex, `--path C:\`), the tool will find all .NET assemblies on that path and output the P/Invoke signatures used in them, which you can use in your code to hide the use of P/Invoke (see `Example` below). To perform a recursive search for assemblies, add the `-r` parameter.
```shell
.\ParasiteInvoke.exe --path C:\ -r
```
![изображение](https://github.com/MzHmO/Parasite-Invoke/assets/92790655/74bc4b69-cc38-493a-8ac2-1132f597e9b1)
But most likely you will be interested in hiding a particular PInvoke method. That's why I created the `--method` argument. You can use it to find .NET builds that have this method signature.
```shell
.\ParasiteInvoke.exe --path C:\ -r --method VirtualAlloc
```
![изображение](https://github.com/MzHmO/Parasite-Invoke/assets/92790655/0a44ddda-790e-4686-b39b-598cf101201f)
Let's go to an example
## Example (u should go here)
Suppose you want to hide the use of the `VirtualAlloc()` function. You run my tool and receive the following output:
```shell
.\ParasiteInvoke.exe --path C:\ -r --method VirtualAlloc
```
![изображение](https://github.com/MzHmO/Parasite-Invoke/assets/92790655/09264552-c58b-4fee-a4d6-ee6ecb7f8b46)
You should just copy the signature into your code, then add arguments to call the method and quietly PARASITE on the PInvoke signature from someone else's (often signed) .NET assembly.
```cs
using System;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Template
{
class Program
{
static void Main()
{
Assembly asm = Assembly.LoadFrom(@"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\UIAutomationClientsideProviders.dll");
Type t = asm.GetType("MS.Win32.UnsafeNativeMethods", true);
var methodInfo = t.GetMethod("VirtualAlloc", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
IntPtr result = (System.IntPtr)methodInfo.Invoke(null, new object[] { IntPtr.Zero, new UIntPtr(10), 0x3000, 0x40 } );
Marshal.Copy(new byte[] { 1, 2, 3 }, 0, result, 3);
Console.WriteLine(result);
return;
}
}
}
```
![изображение](https://github.com/MzHmO/Parasite-Invoke/assets/92790655/9c9b2cca-0b35-4df2-821f-f12aa7d68163)
Successfully invoke the function:
![изображение](https://github.com/MzHmO/Parasite-Invoke/assets/92790655/7a8c04c2-3239-464f-9f62-17507fc8fe7d)
## Example output
### Discover all .NET assemblies from C:\Windows\System32 directory with PInvoke Signatures
https://pastebin.com/9JyjcMAH
### Discover all .NET assemblies from C:\ with PInvoke signature of VirtualAlloc Method
https://pastebin.com/iBeTbXCw
", Assign "at most 3 tags" to the expected json: {"id":"8453","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"