-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
912 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Node artifact files | ||
node_modules/ | ||
dist/ | ||
|
||
# Visual studio | ||
*.vs | ||
|
||
|
||
# Compiled Java class files | ||
*.class | ||
|
||
# Compiled Python bytecode | ||
*.py[cod] | ||
|
||
# Log files | ||
*.log | ||
|
||
# Package files | ||
*.jar | ||
|
||
# Maven | ||
target/ | ||
dist/ | ||
|
||
# JetBrains IDE | ||
.idea/ | ||
|
||
# Unit test reports | ||
TEST*.xml | ||
|
||
# Generated by MacOS | ||
.DS_Store | ||
|
||
# Generated by Windows | ||
Thumbs.db | ||
|
||
# Applications | ||
*.app | ||
*.exe | ||
*.war | ||
|
||
# Large media files | ||
*.mp4 | ||
*.tiff | ||
*.avi | ||
*.flv | ||
*.mov | ||
*.wmv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
using LibGit2Sharp; | ||
using System; | ||
using System.IO; | ||
|
||
namespace OffensivePipeline | ||
{ | ||
static class Build | ||
{ | ||
public static string DownloadRepository(string toolName, string url) | ||
{ | ||
string path = "GitTools"; | ||
try | ||
{ | ||
if (!Directory.Exists(path)) | ||
{ | ||
DirectoryInfo di = Directory.CreateDirectory(path); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine("The process failed: {0}", e.ToString()); | ||
} | ||
string toolPath = Path.Combine(new string[] { path, toolName }); | ||
if (!Directory.Exists(toolPath)) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine(" Clonnig the repository: {0}", toolName); | ||
Console.ResetColor(); | ||
Repository.Clone(url, toolPath); | ||
using (var repo = new Repository(toolPath)) | ||
{ | ||
var commit = repo.Head.Tip; | ||
Console.WriteLine(@" Last commit: {0}", commit.Author.When.ToLocalTime()); | ||
} | ||
} | ||
return toolPath; | ||
} | ||
public static string BuildTool(string solutionPath, string toolName) | ||
{ | ||
string finalPath = string.Empty; | ||
string text = System.IO.File.ReadAllText(Path.Combine(new string[] { Directory.GetCurrentDirectory(), "Resources", "template_build.bat" })); | ||
string buildOptions = "/p:Platform=\"Any CPU\""; | ||
solutionPath = Path.Combine(new string[] { Directory.GetCurrentDirectory(), "GitTools", solutionPath }); | ||
string outputDir = Path.Combine(new string[] { Directory.GetCurrentDirectory(), "Output" }); | ||
if (File.Exists(solutionPath)) | ||
{ | ||
|
||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine(" Solving dependences with nuget..."); | ||
Console.ResetColor(); | ||
if (Helpers.ExecuteCommand(@"Resources\nuget.exe restore " + solutionPath) != 0) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine("Error -> nuget.exe: {0}", solutionPath); | ||
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); | ||
string batPath = Path.Combine(new string[] { Path.GetDirectoryName(solutionPath), "buildSolution.bat" }); | ||
File.WriteAllText(batPath, text); | ||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine(" Building solution..."); | ||
Console.ResetColor(); | ||
if (Helpers.ExecuteCommand(batPath) != 0) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine(" Error -> msbuild.exe: {0}", solutionPath); | ||
Console.ResetColor(); | ||
} else | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine(" No errors!"); | ||
Console.ResetColor(); | ||
} | ||
} | ||
return finalPath; | ||
} | ||
|
||
public static void Confuse(string folder) | ||
{ | ||
string[] exeList = Directory.GetFiles(folder, "*.exe"); | ||
foreach (string exe in exeList) | ||
{ | ||
string text = File.ReadAllText(Path.Combine(new string[] { Directory.GetCurrentDirectory(), "Resources", "template_confuserEx.crproj" })); | ||
text = text.Replace("{{BASE_DIR}}", folder); | ||
text = text.Replace("{{OUTPUT_DIR}}", Path.Combine(new string[] { folder, "Confused" })); | ||
text = text.Replace("{{EXE_FILE}}", exe); | ||
string crprojPath = Path.Combine(new string[] { folder, exe + ".crproj" }); | ||
System.IO.File.WriteAllText(crprojPath, text); | ||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine(" Confusing " + exe + "..."); | ||
Console.ResetColor(); | ||
if (Helpers.ExecuteCommand( | ||
Path.Combine(new string[] { Directory.GetCurrentDirectory(), "Resources", "ConfuserEx", "Confuser.CLI.exe" }) + " " + crprojPath) != 0) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine(" Error -> ConfuserEx: {0}", exe); | ||
Console.ResetColor(); | ||
} | ||
else | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine(" No errors!"); | ||
Console.ResetColor(); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Net; | ||
using System.Security.Cryptography; | ||
|
||
namespace OffensivePipeline | ||
{ | ||
static class Helpers | ||
{ | ||
public static int ExecuteCommand(string command) | ||
{ | ||
int exitCode = 0; | ||
try | ||
{ | ||
ProcessStartInfo processInfo; | ||
Process process; | ||
processInfo = new ProcessStartInfo("cmd.exe", "/c " + command); | ||
processInfo.CreateNoWindow = true; | ||
processInfo.UseShellExecute = false; | ||
processInfo.RedirectStandardError = true; | ||
processInfo.RedirectStandardOutput = true; | ||
process = Process.Start(processInfo); | ||
//process.WaitForExit(); | ||
string output = process.StandardOutput.ReadToEnd(); | ||
string error = process.StandardError.ReadToEnd(); | ||
exitCode = process.ExitCode; | ||
//Console.WriteLine("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output)); | ||
//Console.WriteLine("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error)); | ||
//Console.WriteLine("ExitCode: " + exitCode.ToString(), "ExecuteCommand"); | ||
process.Close(); | ||
} catch (Exception ex) | ||
{ | ||
Console.WriteLine("Error executing command <" + command + "> - " + ex.ToString()); | ||
return 1; | ||
} | ||
|
||
return exitCode; | ||
} | ||
|
||
public static string GetRandomString() | ||
{ | ||
string path = Path.GetRandomFileName(); | ||
path = path.Replace(".", ""); // Remove period. | ||
return path; | ||
} | ||
|
||
public static int DownloadResources(string url, string outputName, string outputPath) | ||
{ | ||
WebClient client = new WebClient(); | ||
try | ||
{ | ||
|
||
client.DownloadFile(url, Path.Combine(new string[] { Directory.GetCurrentDirectory(), outputPath, outputName })); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("Error downloading <" + url + "> - " + ex.ToString()); | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
public static int UnzipFile(string filePath, string outputFolder) | ||
{ | ||
try | ||
{ | ||
ZipFile.ExtractToDirectory(filePath, outputFolder); | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("Error unzipping <" + filePath + "> - " + ex.ToString()); | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
|
||
static string CalculateMD5(string filename) | ||
{ | ||
using (var md5 = MD5.Create()) | ||
{ | ||
using (var stream = File.OpenRead(filename)) | ||
{ | ||
var hash = md5.ComputeHash(stream); | ||
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); | ||
} | ||
} | ||
} | ||
|
||
public static void CalculateMD5Files(string folder) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine(" Calculating md5..."); | ||
Console.ResetColor(); | ||
string[] fileList = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories); | ||
List<string> md5List = new List<string>(); | ||
foreach (string filename in fileList) | ||
{ | ||
using (var md5 = MD5.Create()) | ||
{ | ||
using (var stream = File.OpenRead(filename)) | ||
{ | ||
var hash = md5.ComputeHash(stream); | ||
md5List.Add(filename + " - " + BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant()); | ||
} | ||
} | ||
} | ||
File.WriteAllLines(Path.Combine(new string[] { folder, "md5.txt" }), md5List); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<Authors>Aetsu</Authors> | ||
<Company>https://github.com/aetsu</Company> | ||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||
<Version>0.8</Version> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<DebugType>none</DebugType> | ||
<DebugSymbols>false</DebugSymbols> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="LibGit2Sharp" Version="0.26.2" /> | ||
<PackageReference Include="Microsoft.Build" Version="16.8.0" /> | ||
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="16.8.0" /> | ||
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.8.0" /> | ||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" /> | ||
<PackageReference Include="YamlDotNet" Version="9.1.4" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Tools\" /> | ||
<Folder Include="Properties\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="Resources\template_confuserEx.crproj"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="Build.cs"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Compile> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Resources\template_build.bat"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\Internal-Monologue.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\InveighZero.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\Rubeus.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\Seatbelt.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\Sharp-SMBExec.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpChromium.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpDPAPI.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpGPOAbuse.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpHound3.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpMove.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpRDP.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpSpray.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpStay.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpUp.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpView.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\SharpWMI.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\ThreatCheck.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\Watson.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Tools\winPEAS.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_LastSelectedProfileId>C:\Users\alpha\Desktop\OffensivePipeline\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> | ||
</PropertyGroup> | ||
</Project> |
Oops, something went wrong.