- MSVC Compiler Options ``` /nologo - Suppresses display of the copyright banner when the compiler starts up. /Ox - Code optimization - a subset of /O2 option (creates fast code) that doesn't include /GF (string pooling) or /Gy (function-level linking). /MT - Compiles to a multithreaded executable file, by using LIBCMT.lib (statically linking C runtime library). /W0 - Suppresses all warnings. /GS- - Disables buffer security. /D - Defines a constant (equivalent to #define directive at the beginning of a source code file). Helpful for enabling/disabling parts of the code during development and switching into a production phase. /Tc - Specifies a C source file. All code is treated as C code (instead of C++). /link - Passes the specified options to the linker. /OUT - Specifies the output file name. /SUBSYSTEM - Tells the operating system how to run the .exe file, ex. CONSOLE (console app), WINDOWS (GUI app), etc. /MACHINE - Specifies the target platform, ex. x86, x64, ARM, etc. /DLL - Builds a DLL. ``` - Compile windows assembly with nasm - `nasm -f "format" "code.asm" -o output_file.format` - `nasm -f bin eternalblue_kshellcode_x64.asm -o ./sc_x64_kernel.bin` - Compile as windows exe with ming - % compile 64bit windows code - `x86_64-w64-mingw32-` ("tab,tab,tab", to view all installed compilers") - % compile 32bit windows code - `i686-w64-mingw32-` ("tab,tab,tab", to view all installed compilers") - % examples of compiling C/C++ code on linux for windows - `x86_64-w64-mingw32-gcc hello_world.c -o hi.exe` - `x86_64-w64-mingw32-g++ hello_world.pp -o hi.exe` - Compile with mono - % compiling cs (C-Sharp) code into a static.exe file - `mono-csc compile_me.cs` - % compile with mcs ("for versions of mono-devel that doesn't come with csc") - `dmcs compile_me.cs ("old-not-supported-verion")` - `mcs compile_me.cs` - Run/test compiled EXE with mono-devel - `mono runme.exe` - Compile Visual Studio projects on Linux - Installing .NET - `sudo snap search dotnet` - `sudo snap install ` - for some applications you may have to install ("COMPLETE .NET") vs .Net Core with snap - https://dotnet.microsoft.com/download - `sudo dpkg -i dotnet_installer.deb` - Create new project - `dotnet new console` - Create solution project - `cd ./path/to/vs/project` - `dotnet new