Skip to content

Instantly share code, notes, and snippets.

@natesubra
Created January 12, 2023 17:51
Show Gist options
  • Save natesubra/a8acc5431ac5b8d806ed4a25d868416a to your computer and use it in GitHub Desktop.
Save natesubra/a8acc5431ac5b8d806ed4a25d868416a to your computer and use it in GitHub Desktop.
Build Rubeus and clean some indicators
$old_guid = '658C8B7F-3664-4A95-9572-A3E5871DFC06'
$new_guid = (New-Guid).ToString()
[string[]] $filetypes = "*.cs", "*.sln", "*.csproj"
ForEach ($filetype in $filetypes) {
$files = Get-ChildItem -Path $filetype -Recurse -File
ForEach ($file in $files) {
$content = Get-Content $file
$content = $content -Replace "$old_guid", "$new_guid"
$content | Set-Content $file
}
}
$csproj = Get-ChildItem Rubeus\Rubeus.csproj
$csprojxml = [xml] (Get-Content $csproj.FullName)
$csprojxml.Project.PropertyGroup[0].RootNamespace = ''
$csprojxml.Project.PropertyGroup[0].AssemblyName = ''
$csprojxml.Save($csproj.FullName)
msbuild .\Rubeus.sln -t:Clean
msbuild .\Rubeus.sln /property:Configuration=Release /property:TargetFrameworkVersion=v4.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment