Skip to content

Commit

Permalink
Merge pull request #70 from simonec73/dev
Browse files Browse the repository at this point in the history
Dev 2.1.5
  • Loading branch information
simonec73 authored Apr 4, 2024
2 parents 5d62998 + dc808f8 commit fd967fa
Show file tree
Hide file tree
Showing 160 changed files with 3,272 additions and 1,552 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2021 Simone Curzi
Copyright (c) 2018-2024 Simone Curzi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Samples/SampleExtensions/ExtensionLibrary.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.1.4")]
[assembly: ExtensionsContainer("2.1.5")]
56 changes: 56 additions & 0 deletions Samples/SampleExtensions/Reporting/EntitiesSheetProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.Linq;
using ThreatsManager.Extensions.Reporting;
using ThreatsManager.Interfaces;
using ThreatsManager.Interfaces.ObjectModel;
using ThreatsManager.Utilities;

namespace SampleExtensions.Reporting
{
/// <summary>
/// Summmary Sheet Providers add sheets to the Excel Summary.
/// This example is designed to add a table with the list of all entities defined in the threat model.
/// </summary>
[Extension("14BF4591-C8C6-4971-A324-AC966ECFB389", "Entities Sheet Provider", 100, ExecutionMode.Business)]
public class EntitiesSheetProvider : ISummarySheetProvider
{
/// <summary>
/// The name of the sheet to be created in Excel.
/// </summary>
public string Name => "Entities";

/// <summary>
/// Method called to get the rows of the table.
/// </summary>
/// <param name="model">Threat Model containing the information used to generate the sheet.</param>
/// <returns>The data to be used to create the sheet.</returns>
/// <remarks>TMS checks that every row has the same number of items. If not, it does not create the sheet.
/// The first row contains the header.</remarks>
public IEnumerable<IEnumerable<string>> GetRows(IThreatModel model)
{
IEnumerable<IEnumerable<string>> result = null;

// Let's first get the list of items to be created.
// This list could be sorted as required.
var entities = model?.Entities?.ToArray();

if (entities?.Any() ?? false)
{
var table = new List<IEnumerable<string>>();

// The first row contains the header.
table.Add(new[] { "Name", "Entity Type", "Description" });

// Enumeration of the entities.
foreach ( var entity in entities)
{
table.Add(new[] { entity.Name, entity.GetEntityType().GetEnumLabel(), entity.Description });
}

result = table;
}

return result;
}
}
}
50 changes: 27 additions & 23 deletions Samples/SampleExtensions/SampleExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,52 +43,55 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PostSharp, Version=2024.0.5.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Redist.2024.0.5\lib\net45\PostSharp.dll</HintPath>
<Reference Include="PostSharp, Version=2024.0.6.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Redist.2024.0.6\lib\net45\PostSharp.dll</HintPath>
</Reference>
<Reference Include="PostSharp.Patterns.Aggregation, Version=2024.0.5.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Aggregation.Redist.2024.0.5\lib\net45\PostSharp.Patterns.Aggregation.dll</HintPath>
<Reference Include="PostSharp.Patterns.Aggregation, Version=2024.0.6.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Aggregation.Redist.2024.0.6\lib\net45\PostSharp.Patterns.Aggregation.dll</HintPath>
</Reference>
<Reference Include="PostSharp.Patterns.Common, Version=2024.0.5.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Common.Redist.2024.0.5\lib\net47\PostSharp.Patterns.Common.dll</HintPath>
<Reference Include="PostSharp.Patterns.Common, Version=2024.0.6.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Common.Redist.2024.0.6\lib\net47\PostSharp.Patterns.Common.dll</HintPath>
</Reference>
<Reference Include="PostSharp.Patterns.Model, Version=2024.0.5.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Model.Redist.2024.0.5\lib\net45\PostSharp.Patterns.Model.dll</HintPath>
<Reference Include="PostSharp.Patterns.Model, Version=2024.0.6.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Model.Redist.2024.0.6\lib\net45\PostSharp.Patterns.Model.dll</HintPath>
</Reference>
<Reference Include="PostSharp.Patterns.Threading, Version=2024.0.5.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Threading.Redist.2024.0.5\lib\net45\PostSharp.Patterns.Threading.dll</HintPath>
<Reference Include="PostSharp.Patterns.Threading, Version=2024.0.6.0, Culture=neutral, PublicKeyToken=e7f631e6ce13f078, processorArchitecture=MSIL">
<HintPath>..\packages\PostSharp.Patterns.Threading.Redist.2024.0.6\lib\net45\PostSharp.Patterns.Threading.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.7.0.0\lib\net462\System.Drawing.Common.dll</HintPath>
<Reference Include="System.Drawing.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.8.0.3\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.IO.Packaging, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Packaging.7.0.0\lib\net462\System.IO.Packaging.dll</HintPath>
<Reference Include="System.IO.Packaging, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Packaging.8.0.0\lib\net462\System.IO.Packaging.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="ThreatsManager.AutoGenRules, Version=2.1.4.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.AutoGenRules.2.1.4\lib\net481\ThreatsManager.AutoGenRules.dll</HintPath>
<Reference Include="ThreatsManager.AutoGenRules, Version=2.1.5.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.AutoGenRules.2.1.5\lib\net481\ThreatsManager.AutoGenRules.dll</HintPath>
</Reference>
<Reference Include="ThreatsManager.AutoThreatGeneration, Version=2.1.4.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.AutoThreatGeneration.2.1.4\lib\net481\ThreatsManager.AutoThreatGeneration.dll</HintPath>
<Reference Include="ThreatsManager.AutoThreatGeneration, Version=2.1.5.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.AutoThreatGeneration.2.1.5\lib\net481\ThreatsManager.AutoThreatGeneration.dll</HintPath>
</Reference>
<Reference Include="ThreatsManager.Extensions.Client, Version=2.1.5.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.Extensions.Client.2.1.5\lib\net481\ThreatsManager.Extensions.Client.dll</HintPath>
</Reference>
<Reference Include="ThreatsManager.Icons, Version=2.1.1.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.Utilities.2.1.4\lib\net481\ThreatsManager.Icons.dll</HintPath>
<HintPath>..\packages\ThreatsManager.Utilities.2.1.5\lib\net481\ThreatsManager.Icons.dll</HintPath>
</Reference>
<Reference Include="ThreatsManager.Interfaces, Version=2.1.4.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.Interfaces.2.1.4\lib\net481\ThreatsManager.Interfaces.dll</HintPath>
<Reference Include="ThreatsManager.Interfaces, Version=2.1.5.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.Interfaces.2.1.5\lib\net481\ThreatsManager.Interfaces.dll</HintPath>
</Reference>
<Reference Include="ThreatsManager.Utilities, Version=2.1.4.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.Utilities.2.1.4\lib\net481\ThreatsManager.Utilities.dll</HintPath>
<Reference Include="ThreatsManager.Utilities, Version=2.1.5.0, Culture=neutral, PublicKeyToken=e345404a827fb4c3, processorArchitecture=MSIL">
<HintPath>..\packages\ThreatsManager.Utilities.2.1.5\lib\net481\ThreatsManager.Utilities.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
Expand All @@ -101,6 +104,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Reporting\EntitiesSheetProvider.cs" />
<Compile Include="RibbonExtensions\ImportAutoThreatGenRules.cs" />
<Compile Include="RibbonExtensions\ScanAzureSubscription.cs" />
</ItemGroup>
Expand Down
25 changes: 13 additions & 12 deletions Samples/SampleExtensions/packages.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="PostSharp.Patterns.Aggregation.Redist" version="2024.0.5" targetFramework="net481" />
<package id="PostSharp.Patterns.Common.Redist" version="2024.0.5" targetFramework="net481" />
<package id="PostSharp.Patterns.Model.Redist" version="2024.0.5" targetFramework="net481" />
<package id="PostSharp.Patterns.Threading.Redist" version="2024.0.5" targetFramework="net481" />
<package id="PostSharp.Redist" version="2024.0.5" targetFramework="net481" />
<package id="System.ComponentModel.Composition" version="7.0.0" targetFramework="net472" />
<package id="System.Drawing.Common" version="7.0.0" targetFramework="net472" />
<package id="System.IO.Packaging" version="7.0.0" targetFramework="net481" />
<package id="PostSharp.Patterns.Aggregation.Redist" version="2024.0.6" targetFramework="net481" />
<package id="PostSharp.Patterns.Common.Redist" version="2024.0.6" targetFramework="net481" />
<package id="PostSharp.Patterns.Model.Redist" version="2024.0.6" targetFramework="net481" />
<package id="PostSharp.Patterns.Threading.Redist" version="2024.0.6" targetFramework="net481" />
<package id="PostSharp.Redist" version="2024.0.6" targetFramework="net481" />
<package id="System.ComponentModel.Composition" version="8.0.0" targetFramework="net481" />
<package id="System.Drawing.Common" version="8.0.3" targetFramework="net481" />
<package id="System.IO.Packaging" version="8.0.0" targetFramework="net481" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net472" />
<package id="ThreatsManager.AutoGenRules" version="2.1.4" targetFramework="net481" />
<package id="ThreatsManager.AutoThreatGeneration" version="2.1.4" targetFramework="net481" />
<package id="ThreatsManager.Interfaces" version="2.1.4" targetFramework="net481" />
<package id="ThreatsManager.Utilities" version="2.1.4" targetFramework="net481" />
<package id="ThreatsManager.AutoGenRules" version="2.1.5" targetFramework="net481" />
<package id="ThreatsManager.AutoThreatGeneration" version="2.1.5" targetFramework="net481" />
<package id="ThreatsManager.Extensions.Client" version="2.1.5" targetFramework="net481" />
<package id="ThreatsManager.Interfaces" version="2.1.5" targetFramework="net481" />
<package id="ThreatsManager.Utilities" version="2.1.5" targetFramework="net481" />
</packages>
2 changes: 1 addition & 1 deletion Samples/SampleWinFormExtensions/ExtensionLibrary.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.1.4")]
[assembly: ExtensionsContainer("2.1.5")]
Loading

0 comments on commit fd967fa

Please sign in to comment.