Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Covenant/Components/Grunts/GruntTaskAssignForm.razor
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ else
{
<div class="form-group col-md-12">
<label for="@GruntTask.Options[number].Name">@GruntTask.Options[number].Name</label><br />
<InputFile @ref="InputFile" id="@GruntTask.Options[number].Name" OnChange="OnUpload" />
<BlazorInputFile.InputFile @ref="InputFile" id="@GruntTask.Options[number].Name" OnChange="OnUpload" />
@if (this.UploadInProgress)
{
<span class="fe fe-loader spin"></span>
Expand Down Expand Up @@ -77,7 +77,7 @@ else
[Parameter]
public EventCallback<GruntTask> OnSubmit { get; set; }

public InputFile InputFile { get; set; }
public BlazorInputFile.InputFile InputFile { get; set; }
private SemaphoreSlim UploadSemaphore { get; set; } = new SemaphoreSlim(1, 1);
private bool UploadInProgress { get; set; } = false;

Expand Down
2 changes: 1 addition & 1 deletion Covenant/Components/HostedFiles/HostedFileForm.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="form-row">
<div class="form-group col-md-4">
<label for="Content">Content</label>
<InputFile id="Content" name="Content" class="form-control-file" OnChange="FileUpload" />
<BlazorInputFile.InputFile id="Content" name="Content" class="form-control-file" OnChange="FileUpload" />
</div>
</div>
<button type="button" class="btn btn-primary" @onclick="(e => OnSubmit.InvokeAsync(HostedFile))">
Expand Down
2 changes: 1 addition & 1 deletion Covenant/Components/Listeners/HttpListenerForm.razor
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<div class="form-group col-md-3 cert-div" hidden="@(!Listener.UseSSL)">
<label for="SSLCertificateFile">SSLCertificate</label>
<InputFile id="SSLCertificateFile" name="SSLCertificateFile" class="form-control-file"
<BlazorInputFile.InputFile id="SSLCertificateFile" name="SSLCertificateFile" class="form-control-file"
disabled="@Disabled"
OnChange="FileUpload" />
</div>
Expand Down
3 changes: 2 additions & 1 deletion Covenant/Core/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public static string GenerateJwtToken(string UserName, string UserId, string[] R
{
new Claim(JwtRegisteredClaimNames.Sub, UserName),
new Claim(JwtRegisteredClaimNames.Jti, CreateSecureGuid().ToString()),
new Claim(ClaimTypes.NameIdentifier, UserId)
//new Claim(ClaimTypes.NameIdentifier, UserId),
new Claim("uid", UserId)
};
foreach (string role in Roles)
{
Expand Down
52 changes: 26 additions & 26 deletions Covenant/Covenant.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<Configurations>Release;Debug</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,30 +29,30 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BlazorInputFile" Version="0.1.0-preview-00002" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.0.0" />
<PackageReference Include="BlazorInputFile" Version="0.2.0" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview2.19528.8" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="3.1.3" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.3.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.3.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.3.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.21" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.4" />
<PackageReference Include="YamlDotNet" Version="8.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.3" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.5.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.4" />
<PackageReference Include="System.Security.Principal.Windows" Version="4.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.11" />
<PackageReference Include="NLog.Web.AspNetCore" Version="6.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.11" />
<PackageReference Include="YamlDotNet" Version="16.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.11" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.11" />
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion Covenant/Data/Grunt/GruntHTTP/GruntHTTPStager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ public void ExecuteStager()
SessionKey.IV = Convert.FromBase64String(iv64str);
byte[] DecryptedAssembly = SessionKey.CreateDecryptor().TransformFinalBlock(messageBytes, 0, messageBytes.Length);
Assembly gruntAssembly = Assembly.Load(DecryptedAssembly);
gruntAssembly.GetTypes()[0].GetMethods()[0].Invoke(null, new Object[] { CovenantURI, CovenantCertHash, GUID, SessionKey });
Type t = gruntAssembly.GetType("GruntExecutor.Grunt");
MethodInfo m = t.GetMethod("Execute");
m.Invoke(null, new Object[] { CovenantURI, CovenantCertHash, GUID, SessionKey });
}
catch (Exception e) { Console.Error.WriteLine(e.Message + Environment.NewLine + e.StackTrace); }
}
Expand Down
4 changes: 2 additions & 2 deletions Covenant/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:9.0 AS build
WORKDIR /app

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS runtime
FROM mcr.microsoft.com/dotnet/core/sdk:9.0 AS runtime
WORKDIR /app
COPY --from=build /app/out .
COPY ./Data ./Data
Expand Down
9 changes: 6 additions & 3 deletions Covenant/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public void ConfigureServices(IServiceCollection services)
options.EnableSensitiveDataLogging(true);
}, ServiceLifetime.Transient);

services.AddIdentity<CovenantUser, IdentityRole>()
services.AddIdentity<CovenantUser, IdentityRole>(op =>
{
op.ClaimsIdentity.UserIdClaimType = "uid";
})
.AddEntityFrameworkStores<CovenantContext>()
.AddDefaultTokenProviders();

Expand Down Expand Up @@ -143,7 +146,7 @@ public void ConfigureServices(IServiceCollection services)
{
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
options.SerializerSettings.Converters.Add(new StringEnumConverter(new CamelCaseNamingStrategy()));
}).SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);
});
services.AddServerSideBlazor();

services.AddRouting(options => options.LowercaseUrls = true);
Expand Down Expand Up @@ -206,7 +209,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseDeveloperExceptionPage();
app.UseSwagger(c =>
{
c.SerializeAsV2 = true;
//c.SerializeAsV2 = true;
});
app.UseSwaggerUI(c =>
{
Expand Down