Skip to content

ConfuserEx: Fix issues with native method emulation #67

ConfuserEx: Fix issues with native method emulation

ConfuserEx: Fix issues with native method emulation #67

Workflow file for this run

name: CI Build
on:
push:
branches: [ "master" ]
tags: [ "*" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
env:
DOTNET_RUNTIME: net8.0
SETUP_DOTNET_VERSION: 8.0.x
BEAENGINE_TAG: v5.3.0
jobs:
build-windows:
name: Build Windows artifacts
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Build
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$msbuildPath = Split-Path (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1) -Parent
$env:PATH = "$msbuildPath;$env:PATH"
dotnet build -c Release -f net48 de4dot.netframework.sln
if ($LASTEXITCODE) { exit $LASTEXITCODE }
Remove-Item Release\net48\*.pdb, Release\net48\*.xml, Release\net48\Test.Rename.*
dotnet publish -c Release -f $env:DOTNET_RUNTIME -o publish-$env:DOTNET_RUNTIME de4dot
Remove-Item publish-$env:DOTNET_RUNTIME\*.pdb, publish-$env:DOTNET_RUNTIME\*.xml
- name: Build BeaEngine
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
git clone --depth 1 --branch $env:BEAENGINE_TAG https://github.com/BeaEngine/beaengine.git beaengine
# Win32 for .NET 4.8
cmake -S beaengine -B build-beaengine-32 `
-A Win32 `
-DoptBUILD_DLL=ON `
-DoptHAS_OPTIMIZED=ON `
-DoptHAS_SYMBOLS=OFF `
-DCMAKE_C_FLAGS_RELEASE="/MT" `
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
cmake --build build-beaengine-32 --config Release
$dll32 = Get-ChildItem -Recurse build-beaengine-32 -Filter BeaEngine*.dll | Select-Object -First 1
if (-not $dll32) {
throw "32-bit BeaEngine.dll not found"
}
Copy-Item $dll32.FullName Release/net48/BeaEngine.dll
Copy-Item beaengine/src/COPYING.txt Release/net48/LICENSES/LICENSE.BeaEngine.GPL.txt
Copy-Item beaengine/src/COPYING.LESSER.txt Release/net48/LICENSES/LICENSE.BeaEngine.LGPL.txt
# Win64 for .NET 8+
cmake -S beaengine -B build-beaengine-64 `
-A x64 `
-DoptBUILD_DLL=ON `
-DoptHAS_OPTIMIZED=ON `
-DoptHAS_SYMBOLS=OFF `
-DCMAKE_C_FLAGS_RELEASE="/MT" `
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
cmake --build build-beaengine-64 --config Release
$dll64 = Get-ChildItem -Recurse build-beaengine-64 -Filter BeaEngine*.dll | Select-Object -First 1
if (-not $dll64) {
throw "64-bit BeaEngine.dll not found"
}
Copy-Item $dll64.FullName publish-$env:DOTNET_RUNTIME/BeaEngine.dll
Copy-Item beaengine/src/COPYING.txt publish-$env:DOTNET_RUNTIME/LICENSES/LICENSE.BeaEngine.GPL.txt
Copy-Item beaengine/src/COPYING.LESSER.txt publish-$env:DOTNET_RUNTIME/LICENSES/LICENSE.BeaEngine.LGPL.txt
- uses: actions/upload-artifact@v4
with:
name: de4dotEx-net48
path: Release/net48
- uses: actions/upload-artifact@v4
with:
name: de4dotEx-${{ env.DOTNET_RUNTIME }}-win-x64
path: publish-${{ env.DOTNET_RUNTIME }}
build-linux:
name: Build Linux artifacts & package .deb
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.SETUP_DOTNET_VERSION }}
- name: Publish ${{ env.DOTNET_RUNTIME }}
run: |
dotnet publish -c Release -f "${DOTNET_RUNTIME}" -o publish-${DOTNET_RUNTIME} de4dot
rm -rf publish-${DOTNET_RUNTIME}/*.pdb publish-${DOTNET_RUNTIME}/*.xml
- name: Build BeaEngine
run: |
set -euo pipefail
git clone --depth 1 --branch "$BEAENGINE_TAG" https://github.com/BeaEngine/beaengine.git
cmake -S beaengine -B build64 \
-DoptBUILD_DLL=ON \
-DoptHAS_OPTIMIZED=ON \
-DoptHAS_SYMBOLS=OFF
cmake --build build64
so64=$(find build64 -name "libBeaEngine*.so" | head -n 1)
[[ -n "$so64" ]] || { echo "libBeaEngine not found"; exit 1; }
cp "$so64" publish-${DOTNET_RUNTIME}/libBeaEngine.so
cp beaengine/src/COPYING.txt publish-${DOTNET_RUNTIME}/LICENSES/LICENSE.BeaEngine.GPL.txt
cp beaengine/src/COPYING.LESSER.txt publish-${DOTNET_RUNTIME}/LICENSES/LICENSE.BeaEngine.LGPL.txt
- name: Upload publish folder
uses: actions/upload-artifact@v4
with:
name: de4dotEx-${{ env.DOTNET_RUNTIME }}-linux-x64
path: publish-${{ env.DOTNET_RUNTIME }}
- name: Extract version from Git tag
if: startsWith(github.ref, 'refs/tags/')
id: get_version
run: |
VERSION="${GITHUB_REF#refs/tags/}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create .deb package
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p deb-root/opt/de4dotEx
cp -r "publish-$DOTNET_RUNTIME/*" deb-root/opt/de4dotEx/
mkdir -p deb-root/usr/local/bin
ln -s /opt/de4dotEx/de4dot deb-root/usr/local/bin/de4dot
mkdir -p deb-root/DEBIAN
cat <<EOF > deb-root/DEBIAN/control
Package: de4dotEx
Version: ${{ steps.get_version.outputs.VERSION }}
Section: utils
Priority: optional
Architecture: amd64
Maintainer: G DATA Advanced Analytics GmbH <mwa@gdata-adan.de>
Depends: libicu78 | libicu77 | libicu76 | libicu74 | libicu72 | libicu70 | libicu67 | libicu66
Description: .NET deobfuscator and unpacker
de4dot is a .NET deobfuscator and unpacker. It will try its best to
restore a packed and obfuscated assembly to almost the original
assembly.
.
Most of the obfuscation can be completely restored (e.g., string
encryption), but symbol renaming is impossible to restore since the
original names aren't (usually) part of the obfuscated assembly.
EOF
dpkg-deb --build deb-root de4dotEx-${{ steps.get_version.outputs.VERSION }}.deb
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: de4dotEx-${{ steps.get_version.outputs.VERSION }}-${{ env.DOTNET_RUNTIME }}-x64-deb
path: de4dotEx-${{ steps.get_version.outputs.VERSION }}.deb