Jump to content

More cross compile Bunny love


PoSHMagiC0de

Recommended Posts

So, somewhere on here I posted an example that you can compile GoLang to arm native for the bashbunny.  What that means is if you want to create an advanced payload component without using ruby, bash or python then you can.  If you wanted to use go to create a web api to deliver payloads via network then there you go.

Welp, been playing around and updated to .Net Core 3.0.  It includes a feature to cross compile to a single binary and the binary is native to the arch you compiled it for.  Like with GoLang, the binary is bigger than a C binary but it gives you C# people an extra option.

If you don't know .Net Core and want to try this then go get used to .Net Core first.

For those who have been using it, update to .Net Core 3.0.  The magic is in your csproj file.  Below is an example excerpt from simple "Hello World" default app.

First, here is a link to MS page listing runtimeidentifiers.

https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

 

Here is the csproj file from default hello world that I modified to produce a single executable, trimmed for linux x64.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
    <PublishSingleFile>true</PublishSingleFile>
    <PublishTrimmed>true</PublishTrimmed>
  </PropertyGroup>
</Project>

After the change is made then just running "dotnet publish" will produce the binary.

If you are on linux and run "file" on it, it will show up as an ELF32 binary.

Changing the runtimeidentifier to "linux-arm" will compile it for the pi and bashbunny.

Enjoy.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...