Skip to content

Commit e2ed99b

Browse files
authored
Merge pull request #11 from Microsoft/cleanup
Cleanup xxhash references and a few other minor cleanup items.
2 parents bfbfac9 + bb64636 commit e2ed99b

File tree

7 files changed

+18
-33
lines changed

7 files changed

+18
-33
lines changed

Gui/Views/Home/Analyze.cshtml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
@using AttackSurfaceAnalyzer.ObjectTypes
22
@using System.IO
33
@model AttackSurfaceAnalyzer.Models.DataRunListModel
4+
45
@{
56
var runList = new SelectList(Model.Runs, "Key", "Text");
67
var monitorRunList = new SelectList(Model.MonitorRuns, "Key", "Text");
78
}
9+
810
<link rel="stylesheet" href="~/css/Results.css" asp-append-version="true" />
911

1012
<br />
@@ -55,7 +57,7 @@
5557
else
5658
{
5759
<div class="explain card card-body warning">
58-
You must collect some results before performing analysis.
60+
You must collect some results before performing analysis.
5961
</div>
6062
}
6163
}
@@ -323,6 +325,6 @@
323325
<tbody id="FileMonitorResultsTableBody"></tbody>
324326
</table>
325327
</div>
326-
@section Scripts{
327-
<script type="text/javascript" src="~/js/Analyze.js" asp-append-version="true"></script> @* Visual Studio insists that scripts have a separate closing tag rather than an inclusive /> tag*@
328-
}
328+
@section Scripts{
329+
<script type="text/javascript" src="~/js/Analyze.js" asp-append-version="true"></script> @* Visual Studio insists that scripts have a separate closing tag rather than an inclusive /> tag*@
330+
}

Gui/wwwroot/js/Collect.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
$('#CollectLink').addClass('active');
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
$('#CollectLink').addClass('active');
24

35
EnableCollectionFields();
46
$("#StartCollectionButton").click(StartCollection);
@@ -218,4 +220,4 @@ function EnableCollectionFields() {
218220
second: '2-digit'
219221
}));
220222
}
221-
}
223+
}

Lib/AttackSurfaceAnalyzerLib.csproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ This NuGet contains the AttackSurfaceAnalyzer Library, which is used by the CLI
3838
</Compile>
3939
</ItemGroup>
4040
<ItemGroup>
41-
<PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="6.2.0-preview.4" />
42-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.2.0-preview.4" />
41+
<PackageReference Include="docfx.console" Version="2.41.0">
42+
<PrivateAssets>all</PrivateAssets>
43+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
44+
</PackageReference>
45+
<PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="6.2.0" />
46+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.2.0" />
4347
<PackageReference Include="Microsoft.Win32.Registry" Version="4.6.0-preview.19073.11" />
4448
<PackageReference Include="murmurhash" Version="1.0.3" />
4549
<PackageReference Include="NLog.Extensions.Logging" Version="1.4.0" />
@@ -53,7 +57,7 @@ This NuGet contains the AttackSurfaceAnalyzer Library, which is used by the CLI
5357
<PackageReference Include="System.Security.AccessControl" Version="4.6.0-preview.19073.11" />
5458
<PackageReference Include="System.Threading.AccessControl" Version="4.6.0-preview.19073.11" />
5559
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
56-
<PackageReference Include="NLog" Version="4.6.0-rc1" />
60+
<PackageReference Include="NLog" Version="4.6.1" />
5761
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.3" />
5862
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
5963
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2">

Lib/Collectors/FileSystem/FileSystemCollector.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace AttackSurfaceAnalyzer.Collectors.FileSystem
1515
{
1616
/// <summary>
17-
/// Collects metadata from the local file system.
17+
/// Collects Filesystem Data from the local file system.
1818
/// </summary>
1919
public class FileSystemCollector : BaseCollector
2020
{

Lib/Collectors/FileSystem/FileSystemUtils.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33
using System;
44
using System.Collections.Generic;
5-
using System.Data.HashFunction.xxHash;
65
using System.IO;
76
using System.Runtime.InteropServices;
87
using System.Security.Cryptography;

Lib/Collectors/FileSystem/WindowsFileSystemUtils.cs

-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33
using System;
4-
using System.Data.HashFunction.xxHash;
54
using System.IO;
65
using System.Security.AccessControl;
76
using AttackSurfaceAnalyzer.Utils;
@@ -53,25 +52,5 @@ protected internal static string GetFilePermissions(FileSystemInfo fileInfo)
5352
else
5453
return null;
5554
}
56-
57-
protected internal static string GetFileHash(FileSystemInfo fileInfo)
58-
{
59-
Logger.Instance.Info(fileInfo.FullName);
60-
61-
string hashValue = null;
62-
try
63-
{
64-
var hashFunction = xxHashFactory.Instance.Create();
65-
using (var stream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read))
66-
{
67-
hashValue = hashFunction.ComputeHash(stream).AsBase64String();
68-
}
69-
}
70-
catch (Exception ex)
71-
{
72-
Logger.Instance.Warn("Unable to take hash of file: {0}: {1}", fileInfo.FullName, ex.Message);
73-
}
74-
return hashValue;
75-
}
7655
}
7756
}

Lib/Utils/CryptoHelpers.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33
using System;
4-
using System.Data.HashFunction.xxHash;
54
using System.IO;
65
using System.Security.Cryptography;
76
using System.Text;

0 commit comments

Comments
 (0)