Skip to content

Commit

Permalink
v1.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
h4wkst3r committed Aug 1, 2024
1 parent cbbe937 commit 2e39b35
Show file tree
Hide file tree
Showing 34 changed files with 2,054 additions and 302 deletions.
23 changes: 22 additions & 1 deletion ADOKit/ADOKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ADOKit
private static string search = "";
private static string id = "";
private static string sshKey = "";
private static List<string> approvedModules = new List<string> { "check", "whoami", "listrepo", "searchrepo", "listproject", "searchproject", "searchcode", "searchfile", "listuser", "searchuser", "listgroup", "searchgroup", "getgroupmembers", "getpermissions", "createpat", "removepat", "listpat", "createsshkey", "removesshkey", "listsshkey", "addprojectadmin", "removeprojectadmin", "addbuildadmin", "removebuildadmin", "addcollectionadmin", "removecollectionadmin", "addcollectionbuildadmin", "removecollectionbuildadmin", "addcollectionbuildsvc", "removecollectionbuildsvc", "addcollectionsvc", "removecollectionsvc", "getpipelinevars", "getpipelinesecrets", "getvariablegroups", "getserviceconnections" };
private static List<string> approvedModules = new List<string> { "check", "whoami", "listrepo", "searchrepo", "listproject", "searchproject", "searchcode", "searchfile", "listuser", "searchuser", "listgroup", "searchgroup", "getgroupmembers", "getpermissions", "createpat", "removepat", "listpat", "createsshkey", "removesshkey", "listsshkey", "addprojectadmin", "removeprojectadmin", "addbuildadmin", "removebuildadmin", "addcollectionadmin", "removecollectionadmin", "addcollectionbuildadmin", "removecollectionbuildadmin", "addcollectionbuildsvc", "removecollectionbuildsvc", "addcollectionsvc", "removecollectionsvc", "getpipelinevars", "getpipelinesecrets", "getvariablegroups", "getserviceconnections", "creds", "getbuildlogs", "listbuildlogs", "searchbuildlogs", "listteam", "searchteam", "getteammembers" };



Expand Down Expand Up @@ -156,12 +156,24 @@ static async Task Main(string[] args)
case "searchcode":
await Modules.Recon.SearchCode.execute(credential, url, search);
break;
case "creds":
await Modules.Recon.Creds.execute(credential, url);
break;
case "searchfile":
await Modules.Recon.SearchFile.execute(credential, url, search);
break;
case "listuser":
await Modules.Recon.ListUser.execute(credential, url);
break;
case "listteam":
await Modules.Recon.ListTeam.execute(credential, url);
break;
case "searchteam":
await Modules.Recon.SearchTeam.execute(credential, url, search);
break;
case "getteammembers":
await Modules.Recon.GetTeamMembers.execute(credential, url, search);
break;
case "searchuser":
await Modules.Recon.SearchUser.execute(credential, url,search);
break;
Expand All @@ -177,6 +189,15 @@ static async Task Main(string[] args)
case "getpermissions":
await Modules.Recon.GetPermissions.execute(credential, url, project);
break;
case "getbuildlogs":
await Modules.Recon.GetBuildLogs.execute(credential, url, project);
break;
case "listbuildlogs":
await Modules.Recon.ListBuildLogs.execute(credential, url, project);
break;
case "searchbuildlogs":
await Modules.Recon.SearchBuildLogs.execute(credential, url, project, search);
break;
case "createpat":
await Modules.Persistence.CreatePAT.execute(credential, url);
break;
Expand Down
13 changes: 13 additions & 0 deletions ADOKit/ADOKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,28 @@
<Compile Include="Modules\Privesc\RemoveCollectionSvc.cs" />
<Compile Include="Modules\Privesc\RemoveProjectAdmin.cs" />
<Compile Include="Modules\Recon\Check.cs" />
<Compile Include="Modules\Recon\Creds.cs" />
<Compile Include="Modules\Recon\GetBuildLogs.cs" />
<Compile Include="Modules\Recon\GetGroupMembers.cs" />
<Compile Include="Modules\Recon\GetPermissions.cs" />
<Compile Include="Modules\Recon\GetTeamMembers.cs" />
<Compile Include="Modules\Recon\ListBuildLogs.cs" />
<Compile Include="Modules\Recon\ListGroup.cs" />
<Compile Include="Modules\Recon\ListProject.cs" />
<Compile Include="Modules\Recon\ListRepo.cs" />
<Compile Include="Modules\Recon\ListTeam.cs" />
<Compile Include="Modules\Recon\ListUser.cs" />
<Compile Include="Modules\Recon\SearchBuildLogs.cs" />
<Compile Include="Modules\Recon\SearchCode.cs" />
<Compile Include="Modules\Recon\SearchFile.cs" />
<Compile Include="Modules\Recon\SearchGroup.cs" />
<Compile Include="Modules\Recon\SearchProject.cs" />
<Compile Include="Modules\Recon\SearchRepo.cs" />
<Compile Include="Modules\Recon\SearchTeam.cs" />
<Compile Include="Modules\Recon\SearchUser.cs" />
<Compile Include="Modules\Recon\Whoami.cs" />
<Compile Include="Objects\Build.cs" />
<Compile Include="Objects\BuildLog.cs" />
<Compile Include="Objects\BuildVariable.cs" />
<Compile Include="Objects\CodeResult.cs" />
<Compile Include="Objects\File.cs" />
Expand All @@ -99,10 +108,13 @@
<Compile Include="Objects\Repo.cs" />
<Compile Include="Objects\ServiceConnection.cs" />
<Compile Include="Objects\SshKey.cs" />
<Compile Include="Objects\Team.cs" />
<Compile Include="Objects\TeamMember.cs" />
<Compile Include="Objects\User.cs" />
<Compile Include="ADOKit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\ArgUtils.cs" />
<Compile Include="Utilities\BuildUtils.cs" />
<Compile Include="Utilities\CodeUtils.cs" />
<Compile Include="Utilities\FileUtils.cs" />
<Compile Include="Utilities\GroupUtils.cs" />
Expand All @@ -112,6 +124,7 @@
<Compile Include="Utilities\RepoUtils.cs" />
<Compile Include="Utilities\ServiceConnectionUtils.cs" />
<Compile Include="Utilities\SshKeyUtils.cs" />
<Compile Include="Utilities\TeamUtils.cs" />
<Compile Include="Utilities\UserUtils.cs" />
<Compile Include="Utilities\WebUtils.cs" />
</ItemGroup>
Expand Down
10 changes: 2 additions & 8 deletions ADOKit/Modules/Privesc/AddBuildAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,25 @@ public static async Task execute(string credential, string url, string projectNa
// iterate through the list of users and find our user. this is way to get the user descriptor.
foreach (Objects.User user in userList)
{
//debug
//Console.WriteLine("potential user match : " + user.directoryAlias.ToLower());

// if we have found our user, keep going to get the user descriptor and group descriptor
if (user.directoryAlias.ToLower().Equals(username.ToLower()))
{
Console.WriteLine("Found user descriptor : " + user.directoryAlias.ToLower());

// fetch the user details so we can get the descriptor
Objects.User ourUser = await Utilities.UserUtils.getUserDetails(credential, url, user.descriptor, user.principalName);
userDescriptor = ourUser.descriptor;
//Console.WriteLine("User descriptor: " + groupDescriptor);

// get a listing of groups for the project we are wanting to add our user to as a build admin
List<Objects.Group> groupList = await Utilities.GroupUtils.getGroupPermissionsForProject(credential, url, projectName);

// iterate through the list of groups for the project and get the descriptor for the build administrators group
foreach (Objects.Group group in groupList)
{
//Console.WriteLine("potential group match : " + group.displayName.ToLower());

if (group.displayName.ToLower().Equals("build administrators"))
{
groupDescriptor = group.descriptor;
Console.WriteLine("Found group descriptor: " + groupDescriptor);

}

Expand All @@ -82,12 +76,12 @@ public static async Task execute(string credential, string url, string projectNa

if (groupDescriptor == "")
{
Console.WriteLine("[*] ERROR We didn't find a group descriptor - there wasn't a match. Stopping.");
Console.WriteLine("[-] ERROR: We didn't find a group descriptor - there wasn't a match. Stopping.");
return;
}
if (userDescriptor == "")
{
Console.WriteLine("[*] ERROR We didn't find a user descriptor - there wasn't a match. Stopping.");
Console.WriteLine("[-] ERROR: We didn't find a user descriptor - there wasn't a match. Stopping.");
return;
}

Expand Down
12 changes: 6 additions & 6 deletions ADOKit/Modules/Privesc/GetPipelineSecrets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static async Task execute(string credential, string url, string project)
{

// create table header
string tableHeader = string.Format("{0,30} | {1,30} | {2,20}", "Project Name", "Build Secret Name", "Build Secret Value");
string tableHeader = string.Format("{0,30} | {1,30} | {2,30} | {3,50}", "Project Name", "Pipeline Name", "Pipeline Secret Name", "Pipeline Secret Value");
Console.WriteLine(tableHeader);
Console.WriteLine(new String('-', tableHeader.Length));

Expand All @@ -58,10 +58,10 @@ public static async Task execute(string credential, string url, string project)
foreach (string buildUrl in buildDefinitionURLs)
{

List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildSecrets(credential, buildUrl);
List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildVarsOrSecrets(credential, buildUrl, true);
foreach (Objects.BuildVariable var in variables)
{
Console.WriteLine("{0,30} | {1,30} | {2,20}", proj.projectName, var.name, "[HIDDEN]");
Console.WriteLine("{0,30} | {1,30} | {2,30} | {3,50}", proj.projectName, var.pipelineName, var.name, "[HIDDEN]");
}
}

Expand All @@ -76,7 +76,7 @@ public static async Task execute(string credential, string url, string project)
else
{
// create table header
string tableHeader = string.Format("{0,30} | {1,20}", "Build Secret Name", "Build Secret Value");
string tableHeader = string.Format("{0,30} | {1,30} | {2,50}", "Pipeline Name", "Pipeline Secret Name", "Pipeline Secret Value");
Console.WriteLine(tableHeader);
Console.WriteLine(new String('-', tableHeader.Length));

Expand All @@ -87,10 +87,10 @@ public static async Task execute(string credential, string url, string project)
foreach (string buildUrl in buildDefinitionURLs)
{

List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildSecrets(credential, buildUrl);
List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildVarsOrSecrets(credential, buildUrl, true);
foreach (Objects.BuildVariable var in variables)
{
Console.WriteLine("{0,30} | {1,20}", var.name, "[HIDDEN]");
Console.WriteLine("{0,30} | {1,30} | {2,20}", var.name, "[HIDDEN]");
}
}

Expand Down
12 changes: 6 additions & 6 deletions ADOKit/Modules/Privesc/GetPipelineVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static async Task execute(string credential, string url, string project)
{

// create table header
string tableHeader = string.Format("{0,30} | {1,30} | {2,50}", "Project Name", "Pipeline Var Name", "Pipeline Var Value");
string tableHeader = string.Format("{0,30} | {1,30} | {2,30} | {3,50}", "Project Name", "Pipeline Name", "Pipeline Var Name", "Pipeline Var Value");
Console.WriteLine(tableHeader);
Console.WriteLine(new String('-', tableHeader.Length));

Expand All @@ -58,10 +58,10 @@ public static async Task execute(string credential, string url, string project)
foreach (string buildUrl in buildDefinitionURLs)
{

List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildVars(credential, buildUrl);
List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildVarsOrSecrets(credential, buildUrl, false);
foreach (Objects.BuildVariable var in variables)
{
Console.WriteLine("{0,30} | {1,30} | {2,50}", proj.projectName, var.name, var.value);
Console.WriteLine("{0,30} | {1,30} | {2,30} | {3,50}", proj.projectName, var.pipelineName, var.name, var.value);
}
}

Expand All @@ -76,7 +76,7 @@ public static async Task execute(string credential, string url, string project)
else
{
// create table header
string tableHeader = string.Format("{0,30} | {1,50}", "Pipeline Var Name", "Pipeline Var Value");
string tableHeader = string.Format("{0,30} | {1,30} | {2,50}", "Pipeline Name", "Pipeline Var Name", "Pipeline Var Value");
Console.WriteLine(tableHeader);
Console.WriteLine(new String('-', tableHeader.Length));

Expand All @@ -87,10 +87,10 @@ public static async Task execute(string credential, string url, string project)
foreach (string buildUrl in buildDefinitionURLs)
{

List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildVars(credential, buildUrl);
List<Objects.BuildVariable> variables = await Utilities.PipelineUtils.getBuildVarsOrSecrets(credential, buildUrl, false);
foreach (Objects.BuildVariable var in variables)
{
Console.WriteLine("{0,30} | {1,50}", var.name, var.value);
Console.WriteLine("{0,30} | {1,30} | {2,50}", var.pipelineName, var.name, var.value);
}
}

Expand Down
Loading

0 comments on commit 2e39b35

Please sign in to comment.