Skip to content

Commit 1512d9c

Browse files
author
Harri Klingsten
committed
Version 0.6.0.1
1 parent 0bef4b7 commit 1512d9c

File tree

12 files changed

+86
-36
lines changed

12 files changed

+86
-36
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
This repo contains a Power Command Console project that combines **CycloneDX** and **Dependency Track** to let you create SBOM files from git repos and import them in to OWASP Dependency Track which gives you a nice GUI where you can analyze your repos vulnerabilities.
55

6+
There is also a command to get a Exploit Prediction score (EPSS) with a CVE as input. That command does not need any prerequisites at all.
7+
8+
## Epss
9+
```epss <your CVE>```
10+
11+
Returns EPSS score for provided CVE, the value is percent where 0 is minimum and 100 is maximum. Read more about the score at the bottom of this page.
12+
13+
### Example
14+
```epss CVE-2022-27225```
15+
16+
617
# Prerequisites
718
If this is the first time you use a Power Commands implementation a encryption setup will be done at the first startup. The encryption key is setup for all Power Commands projects and is unique for every machine. Encryption is used by this Power Commands project to secure your **Dependency Track** API key.
819

@@ -81,11 +92,18 @@ Read more about Power Commands: https://github.com/PowerCommands/PowerCommands20
8192

8293
Read more about SBOM: https://www.cisa.gov/sbom
8394

84-
<img src="dt_cdxgen_logos.png" alt="Dependency Track logo" width="256">
95+
<img src="dt_cdxgen_logos.png" alt="Dependency Track logo" width="512">
8596

8697
## CycloneDX Generator
8798
[CycloneDX Generator](https://github.com/CycloneDX/cdxgen) on github.
8899

89100
## Dependency Track
90101

91-
[Dependency Track Community](https://github.com/DependencyTrack) on github.
102+
[Dependency Track Community](https://github.com/DependencyTrack) on github.
103+
104+
## Exploit Prediction Scoring System (EPSS)
105+
106+
[EPSS](https://www.first.org/epss/user-guide) user guide.
107+
108+
EPSS provides a fundamentally new capability for efficient, data-driven vulnerability management. It is a data-driven effort that uses current threat information from CVE and real-world exploit data. The EPSS model produces a probability score between 0 and 1 (0 and 100%), where the higher the score, the greater the probability that a vulnerability will be exploited.
109+

dt_cdxgen_logos.png

27.9 KB
Loading

src/SecTools/Core/PainKiller.PowerCommands.Core/BaseClasses/CommandBase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ public virtual void RunCompleted()
7171
#endregion
7272

7373
#region RunResult
74-
protected RunResult Ok() => new(this, Input, _ouput.ToString(), RunResultStatus.Ok);
75-
protected RunResult Quit() => new(this, Input, _ouput.ToString(), RunResultStatus.Quit);
74+
protected RunResult Ok(string message) => new(this, Input, $"{message} {_ouput}", RunResultStatus.Ok);
75+
protected RunResult Ok() => Ok(_ouput.ToString());
76+
protected RunResult Quit() => Quit(_ouput.ToString());
77+
protected RunResult Quit(string message) => new(this, Input, $"{message} {_ouput}", RunResultStatus.Ok);
7678
protected RunResult BadParameterError(string output) => new(this, Input, output, RunResultStatus.ArgumentError);
7779
protected RunResult ExceptionError(string output) => new(this, Input, output, RunResultStatus.ExceptionThrown);
7880
protected RunResult ContinueWith(string rawInput) => new(this, Input, _ouput.ToString(), RunResultStatus.ExceptionThrown, rawInput);
Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,5 @@
11
# What is new?
22

3-
## Version 1.0.2.1
4-
**Released 2023-07-24**
5-
- ```ReadLineService``` now has two static events by the ```OpenShortCutPressed``` Occurs when user press [`Ctrl + O`], ```SaveShortCutPressed``` Occurs when user press [`Ctrl + S`].
6-
- ```DialogService.ListDialog``` now returns a ```Dictionary<int, string>``` instead of ```List<string>``` so string value and index is returned for each selected item.
7-
- ```ChecksumManager``` now exposing it´t functions for calculating MDF checksum.
8-
- ```DialogService``` standard dialogs has some minor improvements.
9-
- ```PowerCommandsManager.RunCustomCode``` now has a parameter ```RunFlowManager runFlow```.
10-
- Adjusted creation of commands using ```powercommand new --command Name``` so that the new command class now has the correct namespace. (removed PainKiller.PowerCommands.)
11-
## Version 1.0.2.0
12-
**Released 2023-07-01**
13-
- Toolbar functionality moved to own ```ToolbarService``` and reworked it completely, not using timers anymore that caused problems, so it is now a more stable feature (but still a bit experimental).
14-
- Added PasswordPromptDialog to the ```DialogService```.
15-
- New List feature, display a list which selectable items.
16-
- ```DirCommand``` is now a Core command instead of a Demo command.
17-
- It is now possible to move the cursor up and down with ```CTRL``` + (```⬆️``` or ⬇️).
18-
## Version 1.0.1.0
19-
**Released 2023-06-20**
20-
### Toolbar styled Commands
21-
- Added new base command class ```CommandWithToolbarBase``` that opens upp for a new way of designing your commands with a displayed toolbar in the bottom right corner. Can either be display suggestions or be set programmatically listening and reacting on to the cmd line input.
22-
- Added the constant for array splitter to the ```ConfigurationGlobals```, and refactored all code to use it, makes it easier to swap that if necessary.
23-
- Adjusted the run process so that RunCompleted is always triggered, when running async or when a exception is thrown.
24-
## Version 1.0.0.1
25-
**Released 2023-06-12**
26-
### Capability to Run PowerCommand with a service account and using secrets
27-
If you want to run your PowerCommands application as a Windows scheduled task started by a service accounts that is not allowed to login on the machine, you need to do a couple of steps.
28-
29-
- You need to copy the PainKiller directory from your %User%\AppData\Roaming to the corresponding one for the service account.
30-
- Copy the environment variable _encryptionManager and create the same as a system environment variable. EncryptionService will look for the system environment variable if the user environment variable is not there.
31-
- For your stored secrets you will need to to do the same thing and change target: User to target: Machine in the **PowerCommandsConfiguration.yaml** file.
32-
### Improved logging
33-
Every log post now includes the current user running the PowerCommand application, the Log commands has been re-designed to use suggestions instead of options where more appropriate.
3+
## Version 0.6.0.1
4+
**Released 2023-09-08**
5+
- ```EpssCommand``` new command to retrive Exploit Prediction Score using the https://api.first.org/data/v1/epss API.

src/SecTools/PainKiller.PowerCommands.PowerCommandsConsole/PainKiller.PowerCommands.PowerCommandsConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<AssemblyName>p-sec-tools</AssemblyName>
10-
<Version>0.6.0.0</Version>
10+
<Version>0.6.0.1</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cdxgen/@EntryIndexedValue">True</s:Boolean>
33
<s:Boolean x:Key="/Default/UserDictionary/Words/=dependencytrack/@EntryIndexedValue">True</s:Boolean>
4+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Epss/@EntryIndexedValue">True</s:Boolean>
45
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sbom/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Net.Http.Json;
2+
using SecToolsCommands.DomainObjects;
3+
4+
namespace SecToolsCommands.Commands;
5+
6+
[PowerCommandDesign( description: "Show the EPSS score for a given CVE vulnerability.",
7+
arguments: "!<CVE>",
8+
example: "epss CVE-2022-27225")]
9+
public class EpssCommand : CommandBase<PowerCommandsConfiguration>
10+
{
11+
public EpssCommand(string identifier, PowerCommandsConfiguration configuration) : base(identifier, configuration) { }
12+
13+
public override RunResult Run()
14+
{
15+
var cve = Input.SingleArgument;
16+
var url = $"{Configuration.Epss.ApiUrl}{cve}";
17+
var httpClient = new HttpClient();
18+
var result = httpClient.GetFromJsonAsync<ExploitPrediction>(url).Result;
19+
if (result == null || result.data.Length == 0) return Ok($"{url} returned no result");
20+
WriteCodeExample("EPSS: ",result.data.OrderByDescending(d => d.date).First().GetPercent());
21+
return Ok();
22+
}
23+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace SecToolsCommands.Configuration;
2+
3+
public class EpssConfiguration
4+
{
5+
public string ApiUrl { get; set; } = "https://api.first.org/data/v1/epss?cve=";
6+
}

src/SecTools/SecToolsCommands/Configuration/PowerCommandsConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class PowerCommandsConfiguration : CommandsConfiguration
77
public DockerDesktopConfiguration DockerDesktop { get; set; } = new();
88
public CdxgenConfiguration Cdxgen { get; set; } = new();
99
public DependencyTrackerConfiguration DependencyTracker { get; set; } = new();
10+
public EpssConfiguration Epss { get; set; } = new();
1011
public ToolbarConfiguration? StartupToolbar { get; set; }
1112
}
1213
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace SecToolsCommands.DomainObjects;
2+
3+
public class ExploitPrediction
4+
{
5+
public string status { get; set; }
6+
public int statuscode { get; set; }
7+
public string version { get; set; }
8+
public string access { get; set; }
9+
public int total { get; set; }
10+
public int offset { get; set; }
11+
public int limit { get; set; }
12+
public ExploitPredictionScore[] data { get; set; }
13+
}

0 commit comments

Comments
 (0)