Skip to content

Commit

Permalink
bug fixed: some tools could not be obfuscated
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetsu committed Mar 4, 2021
1 parent b17eaeb commit 2f456e0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
39 changes: 37 additions & 2 deletions OffensivePipeline/Build.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using LibGit2Sharp;
using System;
using System.IO;
using Microsoft.Build.Construction;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Linq;

namespace OffensivePipeline
{
Expand Down Expand Up @@ -55,6 +59,7 @@ public static string BuildTool(string solutionPath, string toolName)
Console.ResetColor();
}
finalPath = Path.Combine(new string[] { outputDir, toolName + "_" + Helpers.GetRandomString() });

text = text.Replace("{{SOLUTION_PATH}}", solutionPath);
text = text.Replace("{{BUILD_OPTIONS}}", buildOptions);
text = text.Replace("{{OUTPUT_DIR}}", finalPath);
Expand All @@ -68,12 +73,42 @@ public static string BuildTool(string solutionPath, string toolName)
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" Error -> msbuild.exe: {0}", solutionPath);
Console.ResetColor();
} else
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" No errors!");
Console.ResetColor();
}

//Gets all references to the project to obfuscate it with confuser
SolutionFile s = SolutionFile.Parse(solutionPath);
foreach (ProjectInSolution p in s.ProjectsInOrder)
{
if (File.Exists(p.AbsolutePath))
{
XNamespace msbuild = "http://schemas.microsoft.com/developer/msbuild/2003";
XDocument projDefinition = XDocument.Load(p.AbsolutePath);
IEnumerable<string> references = projDefinition
.Element(msbuild + "Project")
.Elements(msbuild + "ItemGroup")
.Elements(msbuild + "Reference")
.Elements(msbuild + "HintPath")
.Select(refElem => refElem.Value);
foreach (string reference in references)
{
string referenceFile = reference.Replace(@"..\", "");
if (File.Exists(Path.Combine(new string[] { Path.GetDirectoryName(solutionPath), referenceFile })))
{
File.Copy(
Path.Combine(new string[] { Path.GetDirectoryName(solutionPath), referenceFile }),
Path.Combine(new string[] { finalPath, Path.GetFileName(referenceFile) }),
true);
}
}
}

}
}
return finalPath;
}
Expand All @@ -98,7 +133,7 @@ public static void Confuse(string folder)
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" Error -> ConfuserEx: {0}", exe);
Console.ResetColor();
}
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Expand Down
4 changes: 0 additions & 4 deletions OffensivePipeline/GitPoc.csproj

This file was deleted.

3 changes: 2 additions & 1 deletion OffensivePipeline/OffensivePipeline.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<Authors>Aetsu</Authors>
<Company>https://github.com/aetsu</Company>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
<AssemblyVersion>0.8.2.0</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,3 @@ tool:
- winPEAS:
- Description: Privilege Escalation Awesome Scripts SUITE
- GitLink: https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite
## TODO
- [ ] Some tools have problems when they are obfuscated (ConfuserEx does not find the dependencies). In a future release of OffensivePipeline this will be patched.
- [ ] Add more tools
- [ ] Bugs?

0 comments on commit 2f456e0

Please sign in to comment.