Skip to content

Using AsaLib

Gabe Stocco edited this page Apr 15, 2020 · 20 revisions

Getting Started

Getting AsaLib

Search Nuget for Microsoft.CST.AttackSurfaceAnalyzer.

API Documentation

API Documentation is available at https://microsoft.github.io/AttackSurfaceAnalyzer/.

Using AsaLib

Setting up for using the database

DatabaseManager.Setup(dbPath);

For logging messages (optional)

Logger.Setup(false, true);
Strings.Setup();

Disable telemetry (optional)

AsaTelemetry.Setup(test: true);

Collecting

You can perform collection and get the results in memory.

var cc = new CertificateCollector();
cc.Execute();
ConcurrentQueue<CollectObject> results = cc.Results;

You can also choose to write the results to the database.

cc.Results.AsParallel().ForAll(x => DatabaseManager.Write(x, FirstRunId));
while (DatabaseManager.HasElements)
{
    Thread.Sleep(1);
}

Comparing

Comparison is performed directly from the database.

BaseCompare bc = new BaseCompare();
if (!bc.TryCompare(FirstRunId, SecondRunId))
{
    // Error while comparing
}
else
{
    var results = bc.Results;
}

Clone this wiki locally