Skip to content

Instantly share code, notes, and snippets.

@med0x2e
Last active September 18, 2021 19:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save med0x2e/a0e204c79808da841c809d6464b12094 to your computer and use it in GitHub Desktop.
Save med0x2e/a0e204c79808da841c809d6464b12094 to your computer and use it in GitHub Desktop.
Steps to run GadgetToJScript on linux (wine)
Steps:
1- apt-get install mono-complete
2- apt-get install wine winetricks -y
3- winetricks dotnet35
4- winetricks dotnet48
5- dpkg --add-architecture i386 && apt-get update && apt-get install wine32
6- rm -Rf ~/.wine
7- WINEPREFIX=~/.wine32 WINEARCH=win32 wineboot
8- wine GadgetToJScript.NET3.5.exe -r -c helloworld.cs -d System.Windows.Forms.dll -w hta -o hello
@joeleonjr
Copy link

This is super helpful! Was there a specific distro/version that you ran these commands on that worked?

@med0x2e
Copy link
Author

med0x2e commented Mar 11, 2021

Debian 5.xx, tested it on Kali Linux (v2020).

@ChrisTruncer
Copy link

Hey, I wanted to chime in on this, I haven't been able to get these steps to work. I followed them exactly as you posted, but it throws an error and was curious if you've tested the steps on a clean kali system. I wrote a hello world file that just uses Console.WriteLine so it shouldn't need any reference passed in (which is why it isn't in the command line). Error shown is...

wine GadgetToJScript.NET3.5.exe -r -c helloworld.cs -w hta -o hello 
0009:err:module:__wine_process_init L"C:\\windows\\system32\\GadgetToJScript.NET3.5.exe" not found

trying to use mono also has the same error

mono GadgetToJScript.NET3.5.exe -r -c helloworld.cs -w hta -o hello
Cannot open assembly 'GadgetToJScript.NET3.5.exe': No such file or directory.

Was curious if you had tested this lately. Thanks for your help!

@med0x2e
Copy link
Author

med0x2e commented Apr 16, 2021

Couldn't reproduce the same error from my side, I followed the same steps described above, on "SMP Debian 5.7.6-1kali2 (2020-07-01) x86_64 GNU/Linux". the first error you got is usually indicative of something wrong with wine configuration. may be running a random executable should confirm that. i used the same binaries located in the G2JS release. will create a docker image and share it when i get a chance to.

I wasn't able to get it to work with mono, certain dependencies are implemented in a slightly different way on mono. so i'm afraid it is not compatible with mono for now, (need to figure out an alternative of IDictionnary -> "AggregateDictionary" in the serialization gadget).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment